pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.24k stars 1.12k forks source link

Investigate if there is anything to learn from pytype #2156

Open PCManticore opened 6 years ago

PCManticore commented 6 years ago

https://github.com/google/pytype/blob/master/docs/errors.md Seems to have a bunch of errors similar to those from pylint. Let's see if we can learn anything from this tool (architectural decisions, new checks, etc.)

sushobhit27 commented 6 years ago

Here some checks/use cases in pytype which can be included in pylint:

  1. invalid-namedtuple-arg $ cat sample.py
    from collections import namedtuple
    my_named_tuple = namedtuple('my_named_tuple', ['_abc'])

    $ pytype sample.py Analyzing 1 sources with 0 dependencies File "sample.py", line 3, in : collections.namedtuple argument '_abc' is not a valid typename or field name. [invalid-namedtuple-arg]

For more details, see https://github.com/google/pytype/blob/master/docs/errors.md#invalid-namedtuple-arg.

$ pylint sample.py


Your code has been rated at 10.00/10

  1. unsupported-operands $ cat sample.py
    x = "hello" ^ "world"

    $ pytype sample.py Analyzing 1 sources with 0 dependencies File "sample.py", line 1, in : unsupported operand type(s) for xor: 'str' and 'str' [unsupported-operands]

For more details, see https://github.com/google/pytype/blob/master/docs/errors.md#unsupported-operands.

$ pylint sample.py


Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)