Giter VIP home page Giter VIP logo

yala's Introduction

YALA - Yet Another Linter Aggregator

build coveralls codecov codacy issue_time

PyPI downloads

YALA combines many linters to improve the quality of your code. Other projects may come to your mind, but does anyone have all the features below?

Works with latest linters

Yala uses linters' outputs and doesn't break when their APIs change.

Same defaults

No changes to linters' default configuration.

Easy to configure

Set any command-line option for any linter (even pylint!) in setup.cfg.

Fast

Run linters in parallel.

Current Status

Currently supported Python tools:

Install

Tested with Python >= 3.6. You can specify multiple linters separated by commas:

  • yala installs isort, pycodestyle, and pylint (minimal install);
  • yala[all] adds mypy, pydocstyle, pyflakes, and radon;
  • yala[all,flake8] also adds flake8;

If you are willing to hack yala's code, run the command below in this README's folder:

Usage

Just call yala followed by the files and/or folders to lint.

Configuration

Besides the standard configuration files of each linter, as in their docs, you can specify any command-line option in setup.cfg with yala.

Writing command-line arguments for linters in setup.cfg is particularly useful for pylint because it ignores setup.cfg and requires you to write an extra file. Now, you don't have to.

The default configuration file is in yala/setup.cfg. You can copy it to your project's root folder and customize it. If you need other configuration for a nested directory, just create another file there.

Linters' options

For example, to disable a specific pylint warning and output grades C and lower for Radon Maintainability Index (default is D or worse), add the following to setup.cfg:

Besides pylint, you can define CLI options for isort, pycodestyle, pydocstyle, etc (the names are exactly as they are called in command line).

Choosing linters

All supported and installed linters are enabled by default.

You can customize the linters in setup.cfg by either:

or

Or even a mix of both: multiple linters in multiple lines.

Example

Run pydocstyle and pylint without missing-docstring errors (besides isort, pycodestyle, and pylint that are installed by default):

If you're using black with isort, pycodestyle and flake8, make sure to set options that won't conflict, for instance:

Hacking: Adding a linter

Check the file yala/linters.py and feel free to ask for help.

yala's People

Contributors

cemsbr avatar diraol avatar pyup-bot avatar viniarck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yala's Issues

Look for setup.cfg on the project root

It you be nice to be able to run yala from within a specific submodule directory.
In order to do that, yala may look on the parent directories those with __init__.py until the first one and then look for setup.cfg on the parent of the first "package"/"module" level.

Omit redundant errors

Multiple tools are complaining about the same error. We could map these equivalences and omit the errors of lower-priority linters. The mapping should be easy to be maintained.

Installation not working with pip10

The following command was run a new and empty virtualenv with python 3.5.6 and after running pip install -U pip setuptools wheel:

$ pip install -U yala
Collecting yala
  Using cached https://files.pythonhosted.org/packages/5b/e3/3567f7eec9dd31e87671e64db62be80d217cb6b129e29ec13387e0cfaece/yala-1.5.0.tar.gz
Collecting docopt (from yala)
  Using cached https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz
Collecting isort (from yala)
  Using cached https://files.pythonhosted.org/packages/1f/2c/22eee714d7199ae0464beda6ad5fedec8fee6a2f7ffd1e8f1840928fe318/isort-4.3.4-py3-none-any.whl
Collecting pycodestyle (from yala)
  Using cached https://files.pythonhosted.org/packages/e5/c6/ce130213489969aa58610042dff1d908c25c731c9575af6935c2dfad03aa/pycodestyle-2.4.0-py2.py3-none-any.whl                                                                                                                                                            
Collecting pydocstyle (from yala)
  Using cached https://files.pythonhosted.org/packages/43/8a/f1141af0c8406788a5c38ad5001d4163d903b5384a6517239d2ac42734c8/pydocstyle-2.1.1-py3-none-any.whl
Collecting pylint (from yala)
  Using cached https://files.pythonhosted.org/packages/8b/62/b2c07085dd7bb4b7e8bb813873421692c1157191e87234550a1c39dff232/pylint-1.8.4-py2.py3-none-any.whl
Collecting radon (from yala)
  Using cached https://files.pythonhosted.org/packages/7f/d3/e92a44106d3ef11a932b704c02c3eb6471b08de04a77c4e462eedb3ff596/radon-2.2.0-py2.py3-none-any.whl
Collecting six (from pydocstyle->yala)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting snowballstemmer (from pydocstyle->yala)
  Using cached https://files.pythonhosted.org/packages/d4/6c/8a935e2c7b54a37714656d753e4187ee0631988184ed50c0cf6476858566/snowballstemmer-1.2.1-py2.py3-none-any.whl                                                                                                                                                        
Collecting astroid<2.0,>=1.6 (from pylint->yala)
  Using cached https://files.pythonhosted.org/packages/f8/59/12a1d965bb99b595bfd72cc9a44863a0c00a2c05c38178f6139285bb00b5/astroid-1.6.3-py2.py3-none-any.whl
Collecting mccabe (from pylint->yala)
  Using cached https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting flake8-polyfill (from radon->yala)
  Using cached https://files.pythonhosted.org/packages/86/b5/a43fed6fd0193585d17d6faa7b85317d4461f694aaed546098c69f856579/flake8_polyfill-1.0.2-py2.py3-none-any.whl                                                                                                                                                        
Collecting mando<0.7,>=0.6 (from radon->yala)
  Using cached https://files.pythonhosted.org/packages/e6/cc/f6e25247c1493a654785e68cd975e479c311e99dafedd49ed17f8d300e0c/mando-0.6.4-py2.py3-none-any.whl
Collecting colorama<0.4,>=0.3 (from radon->yala)
  Using cached https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Collecting wrapt (from astroid<2.0,>=1.6->pylint->yala)
  Using cached https://files.pythonhosted.org/packages/a0/47/66897906448185fcb77fc3c2b1bc20ed0ecca81a0f2f88eda3fc5a34fc3d/wrapt-1.10.11.tar.gz
Collecting lazy-object-proxy (from astroid<2.0,>=1.6->pylint->yala)
  Using cached https://files.pythonhosted.org/packages/65/1f/2043ec33066e779905ed7e6580384425fdc7dc2ac64d6931060c75b0c5a3/lazy_object_proxy-1.3.1-cp36-cp36m-manylinux1_x86_64.whl                                                                                                                                          
Collecting flake8 (from flake8-polyfill->radon->yala)
  Using cached https://files.pythonhosted.org/packages/b9/dc/14e9d94c770b8c4ef584e906c7583e74864786a58d47de101f2767d50c0b/flake8-3.5.0-py2.py3-none-any.whl
Collecting pyflakes<1.7.0,>=1.5.0 (from flake8->flake8-polyfill->radon->yala)
  Using cached https://files.pythonhosted.org/packages/d7/40/733bcc64da3161ae4122c11e88269f276358ca29335468005cb0ee538665/pyflakes-1.6.0-py2.py3-none-any.whl
Building wheels for collected packages: yala, docopt, wrapt
  Running setup.py bdist_wheel for yala ... done
  Stored in directory: /home/diraol/.cache/pip/wheels/32/38/79/6e0065ed4c925daa74175b8c5980023a55bdf7f202bbd420a0
  Running setup.py bdist_wheel for docopt ... done
  Stored in directory: /home/diraol/.cache/pip/wheels/9b/04/dd/7daf4150b6d9b12949298737de9431a324d4b797ffd63f526e
  Running setup.py bdist_wheel for wrapt ... done
  Stored in directory: /home/diraol/.cache/pip/wheels/48/5d/04/22361a593e70d23b1f7746d932802efe1f0e523376a74f321e
Successfully built yala docopt wrapt
flake8 3.5.0 has requirement pycodestyle<2.4.0,>=2.0.0, but you'll have pycodestyle 2.4.0 which is incompatible.
Installing collected packages: docopt, isort, pycodestyle, six, snowballstemmer, pydocstyle, wrapt, lazy-object-proxy, astroid, mccabe, pylint, pyflakes, flake8, flake8-polyfill, mando, colorama, radon, yala                                                                                                             
Successfully installed astroid-1.6.3 colorama-0.3.9 docopt-0.6.2 flake8-3.5.0 flake8-polyfill-1.0.2 isort-4.3.4 lazy-object-proxy-1.3.1 mando-0.6.4 mccabe-0.6.1 pycodestyle-2.4.0 pydocstyle-2.1.1 pyflakes-1.6.0 pylint-1.8.4 radon-2.2.0 six-1.11.0 snowballstemmer-1.2.1 wrapt-1.10.11 yala-1.5.0                       

Initial Update

Hi ๐Ÿ‘Š

This is my first visit to this fine repo, but it seems you have been working hard to keep all dependencies updated so far.

Once you have closed this issue, I'll create separate pull requests for every update as soon as I find one.

That's it for now!

Happy merging! ๐Ÿค–

Print linter on stderr

Currently, pylint prints to stderr "No config file found, using default configuration". This may seem like coming from yala. We should capture stderr print it after adding the linter name, as we currently do in stdout..

Error while using yala.

Traceback (most recent call last):
  File "/home/.../.virtualenvs/kytos/bin/yala", line 7, in <module>
    from yala.main import main
  File "/home/.../.virtualenvs/kytos/lib/python3.6/site-packages/yala/__init__.py", line 6, in <module>
    disable_existing_loggers=False)
  File "/usr/local/lib/python3.6/logging/config.py", line 74, in fileConfig
    cp.read(fname)
  File "/usr/local/lib/python3.6/configparser.py", line 693, in read
    for filename in filenames:
TypeError: 'PosixPath' object is not iterable

Prospector

Hey @cemsbr , have you seen prospector ?

It looks like both yala and Prospector aim to do the same thing. Which are the main differences?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.