Pylint plugin for improving code analysis for when using Django

Overview

pylint-django

https://travis-ci.org/PyCQA/pylint-django.svg?branch=master https://landscape.io/github/landscapeio/pylint-django/master/landscape.png

About

pylint-django is a Pylint plugin for improving code analysis when analysing code using Django. It is also used by the Prospector tool.

Installation

To install:

pip install pylint-django

WARNING: pylint-django will not install Django by default because this causes more trouble than good, see discussion. If you wish to automatically install the latest version of Django then:

pip install pylint-django[with_django]

otherwise sort out your testing environment and please DO NOT report issues about missing Django!

Usage

Ensure pylint-django is installed and on your path. In order to access some of the internal Django features to improve pylint inspections, you should also provide a Django settings module appropriate to your project. This can be done either with an environment variable:

DJANGO_SETTINGS_MODULE=your.app.settings pylint --load-plugins pylint_django [..other options..] <path_to_your_sources>

Alternatively, this can be passed in as a commandline flag:

pylint --load-plugins pylint_django --django-settings-module=your.app.settings [..other options..] <path_to_your_sources>

If you do not configure Django, default settings will be used but this will not include, for example, which applications to include in INSTALLED_APPS and so the linting and type inference will be less accurate. It is recommended to specify a settings module.

Prospector

If you have prospector installed, then pylint-django will already be installed as a dependency, and will be activated automatically if Django is detected:

prospector [..other options..]

Features

  • Prevents warnings about Django-generated attributes such as Model.objects or Views.request.
  • Prevents warnings when using ForeignKey attributes ("Instance of ForeignKey has no <x> member").
  • Fixes pylint's knowledge of the types of Model and Form field attributes
  • Validates Model.__unicode__ methods.
  • Meta informational classes on forms and models do not generate errors.
  • Flags dangerous use of the exclude attribute in ModelForm.Meta.
  • Uses Django's internal machinery to try and resolve models referenced as strings in ForeignKey fields. That relies on django.setup() which needs the appropriate project settings defined!

Additional plugins

pylint_django.checkers.migrations looks for migrations which:

  • add new model fields and these fields have a default value. According to Django docs this may have performance penalties especially on large tables. The prefered way is to add a new DB column with null=True because it will be created instantly and then possibly populate the table with the desired default values. Only the last migration from a sub-directory will be examined;
  • are migrations.RunPython() without a reverse callable - these will result in non reversible data migrations;

This plugin is disabled by default! To enable it:

pylint --load-plugins pylint_django --load-plugins pylint_django.checkers.migrations

Contributing

Please feel free to add your name to the CONTRIBUTORS.rst file if you want to be credited when pull requests get merged. You can also add to the CHANGELOG.rst file if you wish, although we'll also do that when merging.

Tests

The structure of the test package follows that from pylint itself.

It is fairly simple: create a module starting with func_ followed by a test name, and insert into it some code. The tests will run pylint against these modules. If the idea is that no messages now occur, then that is fine, just check to see if it works by running scripts/test.sh.

Any command line argument passed to scripts/test.sh will be passed to the internal invocation of pytest. For example if you want to debug the tests you can execute scripts/test.sh --capture=no. A specific test case can be run by filtering based on the file name of the test case ./scripts/test.sh -k 'func_noerror_views'.

Ideally, add some pylint error suppression messages to the file to prevent spurious warnings, since these are all tiny little modules not designed to do anything so there's no need to be perfect.

It is possible to make tests with expected error output, for example, if adding a new message or simply accepting that pylint is supposed to warn. A test_file_name.txt file contains a list of expected error messages in the format error-type:line number:class name or empty:1st line of detailed error text:confidence or empty.

License

pylint-django is available under the GPLv2 license.

Comments
  • Python 3.7 pylint 2.0.0.dev2 AttributeError: module 'astroid.nodes' has no attribute 'CallFunc'

    Python 3.7 pylint 2.0.0.dev2 AttributeError: module 'astroid.nodes' has no attribute 'CallFunc'

    I'm trying to use pylint for Python 3.7, which isn't supported until pylint 2.0.0, so it is still in dev. However, I thought I would bring this here as pylint 2.0.0 fails when loading pylint_django, simply when checking the version (no file to be linted).

    2062$ pylint --version
    pylint 2.0.0.dev2
    astroid 2.0.0.dev4
    Python 3.7.0 (default, Jun 28 2018, 02:32:19) 
    [GCC 5.4.0 20160609]
    

    Fails when loading the plugin pylint_django:

    2061$ pylint --version --load-plugins pylint_django
    Traceback (most recent call last):
      File "/home/ferd/.virtualenvs/python37/bin/pylint", line 11, in <module>
        sys.exit(run_pylint())
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint/__init__.py", line 18, in run_pylint
        Run(sys.argv[1:])
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint/lint.py", line 1293, in __init__
        linter.load_plugin_modules(self._plugins)
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint/lint.py", line 502, in load_plugin_modules
        module = modutils.load_module_from_name(modname)
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/astroid/modutils.py", line 187, in load_module_from_name
        return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/astroid/modutils.py", line 230, in load_module_from_modpath
        module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/imp.py", line 245, in load_module
        return load_package(name, filename)
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/imp.py", line 217, in load_package
        return _load(spec)
      File "<frozen importlib._bootstrap>", line 696, in _load
      File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint_django/__init__.py", line 7, in <module>
        from pylint_django import plugin
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint_django/plugin.py", line 9, in <module>
        from pylint_django import transforms  # noqa, pylint: disable=unused-import
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint_django/transforms/__init__.py", line 12, in <module>
        foreignkey.add_transform(MANAGER)
      File "/home/ferd/.virtualenvs/python37/lib/python3.7/site-packages/pylint_django/transforms/foreignkey.py", line 59, in add_transform
        manager.register_transform(nodes.CallFunc, inference_tip(infer_key_classes),
    AttributeError: module 'astroid.nodes' has no attribute 'CallFunc'
    

    Freeze:

    astroid==2.0.0.dev4
    isort==4.3.4
    lazy-object-proxy==1.3.1
    mccabe==0.6.1
    Pillow==5.2.0
    pylint==2.0.0.dev2
    pylint-django==0.11.1
    pylint-plugin-utils==0.3
    six==1.11.0
    wrapt==1.10.11
    
    opened by fsnidely 26
  • UnboundLocalError: local variable 'key_cls' referenced before assignment

    UnboundLocalError: local variable 'key_cls' referenced before assignment

    I found this failure in my CI logs, but could not reproduce it locally. The corresponding code looks wrong but I don't know exactly how to correct it. If I can be of any help fixing it let me know.

    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
        return iter(_cache[func, node])
    KeyError: (<function infer_key_classes at 0x7fe149cfe048>, <Call l.306 at 0x7fe142e66320>)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/bin/pylint", line 11, in <module>
        sys.exit(run_pylint())
      File "/usr/local/lib/python3.6/site-packages/pylint/__init__.py", line 20, in run_pylint
        Run(sys.argv[1:])
      File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1628, in __init__
        linter.check(args)
      File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 943, in check
        self._do_check(files_or_modules)
      File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1075, in _do_check
        self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
      File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1158, in check_astroid_module
        walker.walk(ast_node)
      File "/usr/local/lib/python3.6/site-packages/pylint/utils.py", line 1303, in walk
        self.walk(child)
      File "/usr/local/lib/python3.6/site-packages/pylint/utils.py", line 1300, in walk
        cb(astroid)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 57, in augment_func
        augmentation(chain, node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 148, in do_suppress
        chain()
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 56, in chain
        old_method(node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 57, in augment_func
        augmentation(chain, node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 148, in do_suppress
        chain()
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 56, in chain
        old_method(node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 57, in augment_func
        augmentation(chain, node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 148, in do_suppress
        chain()
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 56, in chain
        old_method(node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 57, in augment_func
        augmentation(chain, node)
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 148, in do_suppress
        chain()
      File "/usr/local/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 56, in chain
        old_method(node)
      File "/usr/local/lib/python3.6/site-packages/pylint/checkers/classes.py", line 729, in visit_classdef
        self._check_bases_classes(node)
      File "/usr/local/lib/python3.6/site-packages/pylint/checkers/classes.py", line 1444, in _check_bases_classes
        unimplemented_abstract_methods(node, is_abstract).items(),
      File "/usr/local/lib/python3.6/site-packages/pylint/checkers/utils.py", line 782, in unimplemented_abstract_methods
        infered = safe_infer(obj)
      File "/usr/local/lib/python3.6/site-packages/pylint/checkers/utils.py", line 1066, in safe_infer
        value = next(inferit)
      File "/usr/local/lib/python3.6/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
        yield next(generator)
      File "/usr/local/lib/python3.6/site-packages/astroid/decorators.py", line 95, in wrapped
        res = next(generator)
      File "/usr/local/lib/python3.6/site-packages/astroid/bases.py", line 137, in _infer_stmts
        for inferred in stmt.infer(context=context):
      File "/usr/local/lib/python3.6/site-packages/astroid/node_classes.py", line 348, in infer
        return self._explicit_inference(self, context, **kwargs)
      File "/usr/local/lib/python3.6/site-packages/astroid/__init__.py", line 93, in _inference_tip_cached
        result = func(*args, **kwargs)
      File "/usr/local/lib/python3.6/site-packages/pylint_django/transforms/foreignkey.py", line 91, in infer_key_classes
        return iter([key_cls.instantiate_class()])
    UnboundLocalError: local variable 'key_cls' referenced before assignment
    

    Version: pylint-django==2.0.8

    opened by federicobond 19
  • AttributeError: 'AssignAttr' object has no attribute 'qname'

    AttributeError: 'AssignAttr' object has no attribute 'qname'

    I frequently, but not always, see AttributeError: 'AssignAttr' object has no attribute 'qname' when running pylint on my sourcecode.

    Unfortunately I was unable to find any clues as to why this is happening. I have tried pylint 1.7.4 and pylint 1.6.5. I am using astroid 1.5.3.

    Please advise how I can investigate this further.

    See the attached backtrace: error (3).txt

    need info 
    opened by alex-hutton 18
  • Add support for new load_configuration hook of pylint

    Add support for new load_configuration hook of pylint

    This PR adds new pylint hook load_configuration(). This hook serves for adjusting configuration of linter: http://pylint.pycqa.org/en/latest/how_tos/plugins.html

    Closes #181

    opened by matusvalo 17
  • Repo is dead - I've made a fork

    Repo is dead - I've made a fork

    Upgrading to pylint 1.8.1 has made this repo no longer work.

    Various people have made PRs that fix this repo, however, it appears this repo is inactive.

    Therefore, I've made a fork:

    https://pypi.python.org/pypi/pylint-django-forked https://github.com/JuggleJobs/pylint-django-forked/

    PRs are welcome. I'm also looking for an additional maintainer to help prevent this useful repo from falling into disrepair should I not be around to maintain it for whatever reason.

    opened by colinhowe 17
  • Plugin appears to broken by astroid 2.9.1

    Plugin appears to broken by astroid 2.9.1

    With astroid 2.9.1, pylint-django appears not to work correctly.

    For example, it produces errors like Class 'MyModel' has no 'objects' member (no-member), even when it should be able to infer that the objects member exists.

    Full repro steps, including Pipenv.lock file with precise package versions, is available in the following repo:

    https://github.com/amdw/pylint-django-repro

    opened by amdw 16
  • AttributeError: Can't pickle local object 'augment_visit.<locals>.augment_func'

    AttributeError: Can't pickle local object 'augment_visit..augment_func'

    Dear Colleagues,

    enabling this plugin on the DjangoChannelsGraphqlWs gives me the traceback below. It is worth mentioning that it has worked fine some months ago. Unfortunately I could not track what particular change made this happen, probably Python version upgrade or PyLInt version upgrade, I am not sure. Anyway, currently I cannot make it running and had to disable pylint-django otherwise PyLint fails.

    Traceback (most recent call last):
      File "/Volumes/Dev/DjangoChannelsGraphqlWs/.venv/bin/pylint", line 8, in <module>
        sys.exit(run_pylint())
      File "/Volumes/Dev/DjangoChannelsGraphqlWs/.venv/lib/python3.8/site-packages/pylint/__init__.py", line 22, in run_pylint
        PylintRun(sys.argv[1:])
      File "/Volumes/Dev/DjangoChannelsGraphqlWs/.venv/lib/python3.8/site-packages/pylint/lint/run.py", line 344, in __init__
        linter.check(args)
      File "/Volumes/Dev/DjangoChannelsGraphqlWs/.venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 874, in check
        check_parallel(
      File "/Volumes/Dev/DjangoChannelsGraphqlWs/.venv/lib/python3.8/site-packages/pylint/lint/check_parallel.py", line 92, in check_parallel
        with multiprocessing.Pool(jobs, initializer=initializer, initargs=[linter]) as pool:
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/context.py", line 119, in Pool
        return Pool(processes, initializer, initargs, maxtasksperchild,
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/pool.py", line 212, in __init__
        self._repopulate_pool()
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/pool.py", line 303, in _repopulate_pool
        return self._repopulate_pool_static(self._ctx, self.Process,
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
        w.start()
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/process.py", line 121, in start
        self._popen = self._Popen(self)
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
        return Popen(process_obj)
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
        super().__init__(process_obj)
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
        self._launch(process_obj)
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 47, in _launch
        reduction.dump(process_obj, fp)
      File "/Users/prokher/.pyenv/versions/3.8.5/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
        ForkingPickler(file, protocol).dump(obj)
    AttributeError: Can't pickle local object 'augment_visit.<locals>.augment_func'
    

    Here is pip freeze output:

    pip freeze 
    WARNING: Could not find setup.py for directory /Volumes/Dev/DjangoChannelsGraphqlWs (tried all parent directories)
    aiohttp==3.6.2
    aioredis==1.3.1
    aniso8601==7.0.0
    apipkg==1.5
    appdirs==1.4.4
    appnope==0.1.0
    asgiref==3.2.10
    astroid==2.4.2
    async-timeout==3.0.1
    attrs==19.3.0
    autobahn==20.7.1
    Automat==20.2.0
    backcall==0.2.0
    black==19.10b0
    cffi==1.14.0
    cfgv==3.0.0
    channels==2.4.0
    channels-redis==3.0.1
    chardet==3.0.4
    click==7.1.2
    constantly==15.1.0
    coverage==5.2.1
    cryptography==3.0
    daphne==2.5.0
    decorator==4.4.2
    distlib==0.3.1
    Django==3.0.8
    -e git+https://gitlab.sd.datadvance.net/sd/pseven/DjangoChannelsGraphqlWs.git@ce8d5936a4dda3489c3d8951380f24745264106a#egg=django_channels_graphql_ws
    execnet==1.7.1
    filelock==3.0.12
    graphene==2.1.8
    graphene-django==2.12.1
    graphql-core==2.3.2
    graphql-relay==2.0.1
    hiredis==1.1.0
    hyperlink==19.0.0
    identify==1.4.25
    idna==2.10
    incremental==17.5.0
    ipython==7.16.1
    ipython-genutils==0.2.0
    isort==4.3.21
    jedi==0.17.2
    lazy-object-proxy==1.4.3
    mccabe==0.6.1
    more-itertools==8.4.0
    msgpack==1.0.0
    multidict==4.7.6
    mypy==0.782
    mypy-extensions==0.4.3
    nodeenv==1.4.0
    packaging==20.4
    parso==0.7.1
    pathspec==0.8.0
    pexpect==4.8.0
    pickleshare==0.7.5
    pluggy==0.13.1
    plumbum==1.6.9
    pre-commit==2.1.1
    promise==2.3
    prompt-toolkit==3.0.3
    ptyprocess==0.6.0
    py==1.9.0
    pyasn1==0.4.8
    pyasn1-modules==0.2.8
    pycparser==2.20
    pydocstyle==5.0.2
    Pygments==2.6.1
    PyHamcrest==2.0.2
    pylint==2.5.3
    pylint-django==2.2.0
    pylint-plugin-utils==0.6
    pylint-quotes==0.2.1
    pyOpenSSL==19.1.0
    pyparsing==2.4.7
    pytest==5.4.3
    pytest-asyncio==0.14.0
    pytest-cov==2.10.0
    pytest-django==3.9.0
    pytest-forked==1.2.0
    pytest-pythonpath==0.7.3
    pytest-xdist==1.33.0
    pytz==2020.1
    PyYAML==5.3.1
    regex==2020.7.14
    Rx==1.6.1
    service-identity==18.1.0
    singledispatch==3.4.0.3
    six==1.15.0
    snowballstemmer==2.0.0
    sqlparse==0.3.1
    toml==0.10.1
    tox==3.18.0
    traitlets==4.3.3
    Twisted==20.3.0
    txaio==20.4.1
    typed-ast==1.4.1
    typing-extensions==3.7.4.2
    Unidecode==1.1.1
    virtualenv==20.0.28
    wcwidth==0.2.5
    wrapt==1.12.1
    yarl==1.4.2
    zope.interface==5.1.0
    
    opened by prokher 16
  • Do not rely on the version number to know if the tests are present and fixing test matrix

    Do not rely on the version number to know if the tests are present and fixing test matrix

    Hi guys,

    Sometimes the distro re-add the files that were removed from the pip packages and in this case it will probably be the case in a few days, so maybe it would be better to check if the test directory exists instead of relying on the version. What do you think?

    Thanks for your help, Joseph

    opened by aerostitch 16
  • Upgrading from pylint `2.14.5` to `2.15.0` causes `django.core.exceptions.ImproperlyConfigured` to be raised

    Upgrading from pylint `2.14.5` to `2.15.0` causes `django.core.exceptions.ImproperlyConfigured` to be raised

    After upgrading pylint from 2.14.5 to 2.15.0, running pylint **/*.py now raises django.core.exceptions.ImproperlyConfigured. If I downgrade to pylint 2.14.5, the issue disappears.

    With pylint 2.15.0:

    $ pylint --version
    pylint 2.15.0
    astroid 2.12.5
    Python 3.10.6 (main, Aug  3 2022, 10:13:24) [GCC 10.2.1 20210110]
    
    $ pylint **/*.py
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/site-packages/pylint_django/checkers/foreign_key_strings.py", line 92, in open
        django.setup()
      File "/usr/local/lib/python3.10/site-packages/django/__init__.py", line 19, in setup
        configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
      File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 92, in __getattr__
        self._setup(name)
      File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 72, in _setup
        raise ImproperlyConfigured(
    django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/site-packages/pylint_django/checkers/foreign_key_strings.py", line 120, in open
        settings.configure(Settings(self.config.django_settings_module))
      File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 190, in __init__
        mod = importlib.import_module(self.SETTINGS_MODULE)
      File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'config'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/bin/pylint", line 8, in <module>
        sys.exit(run_pylint())
      File "/usr/local/lib/python3.10/site-packages/pylint/__init__.py", line 35, in run_pylint
        PylintRun(argv or sys.argv[1:])
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/run.py", line 207, in __init__
        linter.check(args)
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 672, in check
        with self._astroid_module_checker() as check_astroid_module:
      File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
        return next(self.gen)
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 962, in _astroid_module_checker
        checker.open()
      File "/usr/local/lib/python3.10/site-packages/pylint_django/checkers/foreign_key_strings.py", line 125, in open
        self.add_message(
      File "/usr/local/lib/python3.10/site-packages/pylint/checkers/base_checker.py", line 164, in add_message
        self.linter.add_message(
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1284, in add_message
        self._add_one_message(
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1217, in _add_one_message
        self.stats.increase_single_module_message_count(
      File "/usr/local/lib/python3.10/site-packages/pylint/utils/linterstats.py", line 309, in increase_single_module_message_count
        self.by_module[modname][type_name] += increase
    KeyError: 'Command line or configuration file'
    

    With pylint 2.14.5:

    $ pylint --version
    pylint 2.14.5
    astroid 2.11.7
    Python 3.10.6 (main, Aug  3 2022, 10:13:24) [GCC 10.2.1 20210110]
    
    $ pylint **/*.py
    
    --------------------------------------------------------------------
    Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
    

    The Django settings module is provided through pyproject.toml (see below). If I provide the Django settings module through environmental variables, a somewhat different exception is raised with pylint 2.15.0:

    $ pylint --version
    pylint 2.15.0
    astroid 2.12.5
    Python 3.10.6 (main, Aug  3 2022, 10:13:24) [GCC 10.2.1 20210110]
    
    $ export DJANGO_SETTINGS_MODULE="config.settings"
    
    $ pylint **/*.py
    Traceback (most recent call last):
      File "/usr/local/bin/pylint", line 8, in <module>
        sys.exit(run_pylint())
      File "/usr/local/lib/python3.10/site-packages/pylint/__init__.py", line 35, in run_pylint
        PylintRun(argv or sys.argv[1:])
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/run.py", line 207, in __init__
        linter.check(args)
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 672, in check
        with self._astroid_module_checker() as check_astroid_module:
      File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
        return next(self.gen)
      File "/usr/local/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 962, in _astroid_module_checker
        checker.open()
      File "/usr/local/lib/python3.10/site-packages/pylint_django/checkers/foreign_key_strings.py", line 92, in open
        django.setup()
      File "/usr/local/lib/python3.10/site-packages/django/__init__.py", line 19, in setup
        configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
      File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 92, in __getattr__
        self._setup(name)
      File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 79, in _setup
        self._wrapped = Settings(settings_module)
      File "/usr/local/lib/python3.10/site-packages/django/conf/__init__.py", line 190, in __init__
        mod = importlib.import_module(self.SETTINGS_MODULE)
      File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'config'
    

    This exception disappears with pylint 2.14.5:

    $ pylint --version
    pylint 2.14.5
    astroid 2.11.7
    Python 3.10.6 (main, Aug  3 2022, 10:13:24) [GCC 10.2.1 20210110]
    
    $ export DJANGO_SETTINGS_MODULE="config.settings"
    
    $ pylint **/*.py
    
    --------------------------------------------------------------------
    Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
    

    Output from pip freeze:

    asgiref==3.5.2
    astroid==2.11.7
    attrs==22.1.0
    Babel==2.10.3
    black==22.6.0
    certifi==2022.6.15
    charset-normalizer==2.1.1
    click==8.1.3
    commonmark==0.9.1
    coverage==6.4.4
    defusedxml==0.7.1
    dill==0.3.5.1
    distlib==0.3.6
    dj-database-url==1.0.0
    dj-email-url==1.0.5
    Django==4.1
    django-cache-url==3.4.2
    django-extensions==3.2.0
    django-fake-model==0.1.4
    django-money==2.1.1
    django-stubs-ext==0.5.0
    django-types==0.16.0
    djangorestframework==3.13.1
    djangorestframework-types==0.8.0
    environs==9.5.0
    execnet==1.9.0
    filelock==3.8.0
    get-docker-secret==1.0.2
    httpie==3.2.1
    idna==3.3
    importlib-resources==5.9.0
    inclusive-django-range-fields==0.2.3
    iniconfig==1.1.1
    isort==5.10.1
    lazy-object-proxy==1.7.1
    lorem-text==2.1
    marshmallow==3.17.1
    mccabe==0.7.0
    multidict==6.0.2
    mypy-extensions==0.4.3
    packaging==21.3
    pathspec==0.10.0
    pipenv==2022.8.24
    platformdirs==2.5.2
    pluggy==1.0.0
    psycopg2==2.9.3
    py==1.11.0
    py-moneyed==1.2
    Pygments==2.13.0
    pylint-django==2.5.3
    pylint-plugin-utils==0.7
    pyparsing==3.0.9
    PySocks==1.7.1
    pytest==7.1.2
    pytest-cov==3.0.0
    pytest-django==4.5.2
    pytest-forked==1.4.0
    pytest-xdist==2.5.0
    python-dotenv==0.20.0
    pytz==2022.2.1
    PyYAML==6.0
    requests==2.28.1
    requests-toolbelt==0.9.1
    rich==12.5.1
    sqlparse==0.4.2
    StrEnum==0.4.8
    tomli==2.0.1
    tomlkit==0.11.4
    types-psycopg2==2.9.21
    typing_extensions==4.3.0
    uritemplate==4.1.1
    urllib3==1.26.12
    virtualenv==20.16.4
    virtualenv-clone==0.5.7
    wrapt==1.14.1
    yachalk==0.1.5
    
    + pylint==2.14.5 or 2.15.0
    + two editable local python packages
    

    pylint config in pyproject.toml:

    [tool.pylint.master]
    ignore-patterns = ["manage.py", "migrations/"]
    load-plugins = [
        "pylint.extensions.docparams",
        "pylint_django",
        "pylint_django.checkers.migrations",
        "local_pylint_plugin",
    ]
    
    [tool.pylint.miscellaneous]
    notes = ["BUG"]
    
    [tool.pylint.parameter_documentation]
    accept-no-raise-doc = "no"
    
    [tool.pylint.similarities]
    min-similarity-lines = 10
    
    [tool.pylint.basic]
    no-docstring-rgx = "([a-zA-Z]+Inline)|([a-zA-Z]+Admin)|([a-zA-Z]+Config)|([a-zA-Z]+Config)"
    class-const-rgx = "([A-Z]{1}[a-zA-Z_]+)"
    
    [tool.pylint."DJANGO FOREIGN KEYS REFERENCED BY STRINGS"]
    django-settings-module = "config.settings"
    
    [tool.pylint."MESSAGES CONTROL"]
    disable = [
        "too-few-public-methods",
        "wrong-import-order",
        "unsubscriptable-object",
    ]
    
    Upstream Bug 🪲 
    opened by simensol 15
  • AttributeError: 'NoneType' object has no attribute 'pattern'

    AttributeError: 'NoneType' object has no attribute 'pattern'

    Travis CI is falling for me in another project because of

    $ python -m pylint lowfat
    Using config file /home/travis/build/softwaresaved/lowfat/pylintrc
    Traceback (most recent call last):
      File "/opt/python/3.5.4/lib/python3.5/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/opt/python/3.5.4/lib/python3.5/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/__main__.py", line 7, in <module>
        pylint.run_pylint()
      File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/__init__.py", line 16, in run_pylint
        Run(sys.argv[1:])
      File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/lint.py", line 1312, in __init__
        linter.load_plugin_modules(plugins)
      File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/lint.py", line 495, in load_plugin_modules
        module.register(self)
      File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint_django/plugin.py", line 22, in register
        start = name_checker.config.const_rgx.pattern[:-2]
    AttributeError: 'NoneType' object has no attribute 'pattern'
    

    Any suggestions of what can be causing it?

    opened by rgaiacs 15
  • List Django as a dependency. Fix #96

    List Django as a dependency. Fix #96

    also add a big warning statement about possible side effects and to deter people from reporting issues about Django version mismatches. Updates README formatting a bit as well.

    @jakirkham this should fix #96.

    @carlio I've read your reasoning about not listing this as a dependency and the side effects it may have. Let's see if the warning text I've added has any effect. If we start seeing consistent reports about Django version mismatches I'm all for dropping the Django dependency from setup.py and adjusting the warning so that folks are aware they have to install Django explicitly.

    opened by atodorov 13
  • pylint-django to check models raise error if it have foreignkey like this

    pylint-django to check models raise error if it have foreignkey like this

    error:

    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/inference_tip.py", line 38, in _inference_tip_cached
        result = _cache[func, node]
    KeyError: (<function infer_key_classes at 0x7fd7a30493a0>, <Call l.18 at 0x7fd7a20c89a0>)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/pylint/checkers/utils.py", line 1344, in safe_infer
        value = next(infer_gen)
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/nodes/node_ng.py", line [16](https://github.com/liangqingzhao/my_local_test/actions/runs/3628194094/jobs/6118923554#step:7:17)9, in infer
        yield from self._infer(context=context, **kwargs)
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/decorators.py", line 140, in raise_if_nothing_inferred
        yield next(generator)
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/decorators.py", line 109, in wrapped
        for res in _func(node, context, **kwargs):
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/bases.py", line 165, in _infer_stmts
        for inf in stmt.infer(context=context):  # type: ignore[union-attr]
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/nodes/node_ng.py", line 159, in infer
        results = list(self._explicit_inference(self, context, **kwargs))
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/inference_tip.py", line 45, in _inference_tip_cached
        result = _cache[func, node] = list(func(*args, **kwargs))
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/pylint_django/transforms/foreignkey.py", line 1[20](https://github.com/liangqingzhao/my_local_test/actions/runs/3628194094/jobs/6118923554#step:7:21), in infer_key_classes
        MANAGER.ast_from_module_name(module_name)
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/manager.py", line [21](https://github.com/liangqingzhao/my_local_test/actions/runs/3628194094/jobs/6118923554#step:7:22)6, in ast_from_module_name
        raise e
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/manager.py", line 161, in ast_from_module_name
        found_spec = self.file_from_module_name(modname, context_file)
      File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/astroid/manager.py", line [26](https://github.com/liangqingzhao/my_local_test/actions/runs/3628194094/jobs/6118923554#step:7:27)7, in file_from_module_name
        raise value.with_traceback(None)  # pylint: disable=no-member
    astroid.exceptions.AstroidImportError: Failed to import module main.models with error:
    No module named main.models.
    

    this is my model

    class EngravingPromotionOrder(models.Model):
        engraving_promotion_number = models.ForeignKey('main.EngravingPromotion', blank=True, null=True, related_name='engraving_promotion', on_delete=models.CASCADE)
        order_number = models.OneToOneField('order.Order', blank=True, null=True, on_delete=models.CASCADE)
    

    if i change it to this way,the error will dissappear

    from xxx.apps.main.models import EngravingPromotion
    class EngravingPromotionOrder(models.Model):
        engraving_promotion_number = models.ForeignKey(EngravingPromotion, blank=True, null=True, related_name='engraving_promotion', on_delete=models.CASCADE)
        order_number = models.OneToOneField('order.Order', blank=True, null=True, on_delete=models.CASCADE)
    

    do we must to use the second way,if not it will raise error i find a similar issue #2995 also use this way to slove the error

    opened by liangqingzhao 0
  • Error when chaining more than two Q objects

    Error when chaining more than two Q objects

    When chaining more than two Q Objects I get an E1131: unsupported operand type(s) for | (unsupported-binary-operation)`. I created a code example:

    from django.db.models import Q
    
    from django.contrib.auth.models import Permission
    
    
    def pylint_alright():
        Permission.objects.filter(Q(pk=1) | Q(pk=2))
    
    
    def pylint_error():
        # ************* Module app.scratch
        # scratch.py:13:30: E1131: unsupported operand type(s) for | (unsupported-binary-operation)
        Permission.objects.filter(Q(pk=1) | Q(pk=2) | Q(pk=3))
    
    

    freeze:

    amqp==2.6.1 
    arabic-reshaper==2.1.4 
    arrow==1.2.3 
    asgiref==3.5.2 
    asn1crypto==1.5.1 
    babel==2.11.0 
    billiard==3.6.4.0 
    bleach==3.3.1 
    celery==4.4.0 
    certifi==2022.9.24 
    cffi==1.15.1 
    charset-normalizer==2.1.1 
    click==8.1.3 
    colorama==0.4.6 
    cryptography==38.0.4 
    cssselect2==0.7.0 
    defusedxml==0.7.1 
    deprecated==1.2.13 
    django-appconf==1.0.5 
    django-axes==5.39.0 
    django-celery-email==3.0.0 
    django-classy-tags==4.0.0 
    django-cms==3.11.0 
    django-countries==7.2.1 
    django-elasticsearch-dsl==7.2.2 
    django-environ==0.7.0 
    django-filer==2.2.3 
    django-filter==2.4.0 
    django-formtools==2.4 
    django-hamlpy==1.4.4 
    django-ipware==4.0.2 
    django-js-asset==2.0.0 
    django-localflavor==3.1 
    django-modeltranslation==0.17.7 
    django-mptt==0.14.0 
    django-multiselectfield==0.1.11 
    django-npm==1.0.0 
    django-oauth-toolkit==1.7.1 
    django-phonenumber-field[phonenumbers]==4.0.0 
    django-polymorphic==3.1.0 
    django-recaptcha==3.0.0 
    django-sekizai==2.0.0 
    django-tinymce4-lite==1.8.0 
    django-treebeard==4.5.1 
    django==3.2.16 
    djangocms-admin-style==3.2.0 
    djangocms-attributes-field==2.0.0 
    djangocms-file==3.0.0 
    djangocms-link==3.0.0 
    djangocms-picture==4.0.0 
    djangocms-text-ckeditor==5.0.1 
    djangorestframework-xml==2.0.0 
    djangorestframework==3.13.1 
    djangosaml2==1.5.4 
    djangosaml2idp==0.7.2 
    docutils==0.16 
    easy-thumbnails==2.8.3 
    easy-thumbnails[svg]==2.8.3 
    elasticsearch-dsl==7.4.0 
    elasticsearch==7.17.7 
    elementpath==3.0.2 
    factory-boy==3.2.1 
    faker==15.3.4 
    future==0.18.2 
    greenlet==2.0.1 
    gunicorn==20.1.0 
    hashids==1.3.1 
    html5lib==1.1 
    idna==3.4 
    jsmin==3.0.1 
    jsonpickle==1.5.2 
    jwcrypto==1.4.2 
    kombu==4.6.11 
    lxml==4.9.1 
    oauthlib==3.2.2 
    oscrypto==1.3.0 
    packaging==21.3 
    phonenumbers==8.13.1 
    pillow==9.3.0 
    psycopg2==2.9.5 
    pycparser==2.21 
    pyhanko-certvalidator==0.19.6 
    pyhanko==0.15.1 
    pyopenssl==21.0.0 
    pyparsing==3.0.9 
    pypdf3==1.0.6 
    pysaml2==7.2.1 
    python-bidi==0.4.2 
    python-dateutil==2.8.2 
    python-memcached==1.59 
    python-stdnum==1.18 
    pytz-deprecation-shim==0.1.0.post0 
    pytz==2022.6 
    pyyaml==6.0 
    qrcode==7.3.1 
    regex==2022.10.31 
    reportlab==3.5.63 
    requests==2.28.1 
    sentry-sdk==1.11.1 
    setuptools==65.6.3 
    six==1.16.0 
    sqlalchemy==1.4.44 
    sqlparse==0.3.1 
    svglib==1.4.1 
    tinycss2==1.2.1 
    tqdm==4.64.1 
    tzdata==2022.7 
    tzlocal==4.2 
    unidecode==1.1.2 
    uritools==4.0.0 
    urllib3==1.26.13 
    vine==1.3.0 
    webencodings==0.5.1 
    wheel==0.38.4 
    whitenoise==5.0.1 
    wrapt==1.14.1 
    xhtml2pdf==0.2.8 
    xmlschema==2.1.1 
    
    opened by rvanlaar 0
  • Issue using commandline flag with pylint

    Issue using commandline flag with pylint

    I get a crash now when using the commandline flags.

    Fix https://github.com/PyCQA/pylint-django/issues/385

    The issue is that creating the Settings objects already configures the settings.

    See the symptom:

    $ pylint --load-plugins=pylint_django --enable=W0611 --disable=bad-continuation,invalid-name,no-self-argument,E0211,C0116,C0115,C0114 --max-line-length=110 --django-settings-module=heypluto.settings.local **/*.py
    ************* Module Command line
    Command line:1:0: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3571. (useless-option-value)
    Traceback (most recent call last):
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint_django/checkers/foreign_key_strings.py", line 92, in open
        django.setup()
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
        configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/django/conf/__init__.py", line 82, in __getattr__
        self._setup(name)
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/django/conf/__init__.py", line 63, in _setup
        raise ImproperlyConfigured(
    django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/dev/.virtualenvs/pluto-chat/bin/pylint", line 8, in <module>
        sys.exit(run_pylint())
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint/__init__.py", line 25, in run_pylint
        PylintRun(argv or sys.argv[1:])
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint/lint/run.py", line 207, in __init__
        linter.check(args)
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 646, in check
        self._check_files(
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 681, in _check_files
        with self._astroid_module_checker() as check_astroid_module:
      File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
        return next(self.gen)
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 859, in _astroid_module_checker
        checker.open()
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/pylint_django/checkers/foreign_key_strings.py", line 120, in open
        settings.configure(Settings(self.config.django_settings_module))
      File "/home/dev/.virtualenvs/pluto-chat/lib/python3.8/site-packages/django/conf/__init__.py", line 118, in configure
        raise RuntimeError('Settings already configured.')
    RuntimeError: Settings already configured.
    

    Pylint version:

    $ pylint --version
    pylint 2.14.5
    astroid 2.11.7
    Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
    [GCC 9.4.0]
    

    Relevant pip freeze:

    Django==3.2.16
    
    opened by slorg1 0
  • Linter 'pylint' failed to parse the output when plugin loaded

    Linter 'pylint' failed to parse the output when plugin loaded

    I have installed and setup pylint_django and when running from the command line I am not receiving an error. But when run from vscode itself pylint crashes due to Syntax error

    Versions pylint 2.15.5 astroid 2.12.12 Python 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] pylint_django 2.5.3

    VSCODE Version: 1.73.1 (system setup) Commit: 6261075646f055b99068d3688932416f2346dd3b Date: 2022-11-09T04:27:29.066Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Windows_NT x64 10.0.22000 Sandboxed: No

    ##########Linting Output - pylint##########

    [ERROR 2022-10-30 19:15:36.361]: Linter 'pylint' failed to parse the output '. SyntaxError: Unexpected end of JSON input at JSON.parse () at s.parseMessages (/root/.vscode-server/extensions/ms-python.python-2022.18.2/src/client/linters/pylint.ts:48:39) at s.run (/root/.vscode-server/extensions/ms-python.python-2022.18.2/src/client/linters/baseLinter.ts:99:31) at runMicrotasks () at process.messages (node:internal/process/task_queues:96:5) at s.runLinter (/root/.vscode-server/extensions/ms-python.python-2022.18.2/src/client/linters/pylint.ts:21:15)

    PIP FREEZE asgiref==3.5.2 astroid==2.12.12 black==22.10.0 certifi==2022.9.24 charset-normalizer==2.1.1 click==8.1.3 colorama==0.4.6 cssbeautifier==1.14.7 cssselect2==0.7.0 dill==0.3.6 dj-database-url==1.0.0 Django==3.1.14 django-classy-tags==3.0.1 django-cms==3.8.0 django-filer==2.2.3 django-formtools==2.4 django-js-asset==2.0.0 django-mptt==0.14.0 django-polymorphic==3.1.0 django-sekizai==3.0.1 django-treebeard==4.4 djangocms-admin-style==2.0.2 djangocms-attributes-field==2.1.0 djangocms-bootstrap4==2.0.0 djangocms-file==3.0.0 djangocms-googlemap==2.0.0 djangocms-icon==2.0.0 djangocms-installer==2.0.0 djangocms-link==3.1.0 djangocms-picture==3.0.0 djangocms-style==3.0.0 djangocms-text-ckeditor==4.0.0 djangocms-video==3.0.0 djangorestframework==3.14.0 djlint==1.19.4 easy-thumbnails==2.8.3 EditorConfig==0.12.3 free-proxy==1.0.6 gunicorn==20.1.0 html-tag-names==0.1.2 html-void-elements==0.1.0 html5lib==1.1 idna==3.4 importlib-metadata==5.0.0 isort==5.10.1 jellyfish==0.9.0 jsbeautifier==1.14.7 lazy-object-proxy==1.8.0 lxml==4.9.1 mccabe==0.7.0 mypy-extensions==0.4.3 pathspec==0.10.1 Pillow==9.3.0 platformdirs==2.5.2 psycopg2==2.9.5 pylint==2.15.5 pylint-django==2.5.3 pylint-plugin-utils==0.7 pytz==2022.6 pytz-deprecation-shim==0.1.0.post0 PyYAML==6.0 regex==2022.10.31 reportlab==3.6.12 requests==2.28.1 six==1.16.0 sqlparse==0.4.3 supermarket-connector==0.0.26 svglib==1.4.1 tinycss2==1.2.1 tomli==2.0.1 tomlkit==0.11.6 tqdm==4.64.1 tzdata==2022.6 tzlocal==4.2 Unidecode==1.1.2 urllib3==1.26.12 webencodings==0.5.1 wrapt==1.14.1 zipp==3.10.0

    opened by Repsay 0
  • Redirect stdout to stderr when running Django setup

    Redirect stdout to stderr when running Django setup

    This prevents from a malformed JSON being created if any stdout output is made during Django setup, e.g.: print().

    Signed-off-by: Noam Stolero [email protected]

    opened by noamsto 1
Releases(v2.5.3)
Owner
Python Code Quality Authority
Organization for code quality tools (and plugins) for the Python programming language
Python Code Quality Authority
Utilities for pycharm code formatting (flake8 and black)

Pycharm External Tools Extentions to Pycharm code formatting tools. Currently supported are flake8 and black on a selected code block. Usage Flake8 [P

Haim Daniel 13 Nov 03, 2022
It's not just a linter that annoys you!

README for Pylint - https://pylint.pycqa.org/ Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives softwa

Python Code Quality Authority 4.4k Jan 04, 2023
A static type analyzer for Python code

pytype - 🦆 ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Simple Python style checker in one Python file

pycodestyle (formerly called pep8) - Python style guide checker pycodestyle is a tool to check your Python code against some of the style conventions

Python Code Quality Authority 4.7k Jan 01, 2023
A static-analysis bot for Github

Imhotep, the peaceful builder. What is it? Imhotep is a tool which will comment on commits coming into your repository and check for syntactic errors

Justin Abrahms 221 Nov 10, 2022
Flake8 Type Annotation Checking

flake8-annotations flake8-annotations is a plugin for Flake8 that detects the absence of PEP 3107-style function annotations and PEP 484-style type co

S. Co1 118 Jan 05, 2023
A plugin for flake8 integrating Mypy.

flake8-mypy NOTE: THIS PROJECT IS DEAD It was created in early 2017 when Mypy performance was often insufficient for in-editor linting. The Flake8 plu

Łukasz Langa 103 Jun 23, 2022
Typed interface stubs for Pythonista iOS

Pythonista Stubs Stubs for the Pythonista iOS API. This allows for better error detection and IDE / editor autocomplete. Installation and Usage pip in

Harold Martin 12 Jul 14, 2020
An open-source, mini imitation of GitHub Copilot for Emacs.

Second Mate An open-source, mini imitation of GitHub Copilot using EleutherAI GPT-Neo-2.7B (via Huggingface Model Hub) for Emacs. This is a much small

Sam Rawal 238 Dec 27, 2022
Tool to automatically fix some issues reported by flake8 (forked from autoflake).

autoflake8 Introduction autoflake8 removes unused imports and unused variables from Python code. It makes use of pyflakes to do this. autoflake8 also

francisco souza 27 Sep 08, 2022
The official GitHub mirror of https://gitlab.com/pycqa/flake8

Flake8 Flake8 is a wrapper around these tools: PyFlakes pycodestyle Ned Batchelder's McCabe script Flake8 runs all the tools by launching the single f

Python Code Quality Authority 2.6k Jan 03, 2023
Flake8 plugin for managing type-checking imports & forward references

flake8-type-checking Lets you know which imports to put in type-checking blocks. For the imports you've already defined inside type-checking blocks, i

snok 67 Dec 16, 2022
Backport Python 3.8+ typing utils & add issubtype & more

typing-utils Backport Python3.8+ typing utils & issubtype & more Install API issubtype get_origin get_args get_type_hints Install pip install typi

10 Nov 09, 2022
docstring style checker

pydocstyle - docstring style checker pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. pydocstyle suppor

Python Code Quality Authority 982 Jan 03, 2023
Mypy stubs for the PyQt5 framework

Mypy stubs for the PyQt5 framework This repository holds the stubs of the PyQt5 framework. It uses the stub files that are produced during compilation

62 Nov 22, 2022
Optional static typing for Python 3 and 2 (PEP 484)

Mypy: Optional Static Typing for Python Got a question? Join us on Gitter! We don't have a mailing list; but we are always happy to answer questions o

Python 14.4k Jan 08, 2023
PEP-484 typing stubs for SQLAlchemy 1.4 and SQLAlchemy 2.0

SQLAlchemy 2 Stubs These are PEP-484 typing stubs for SQLAlchemy 1.4 and 2.0. They are released concurrently along with a Mypy extension which is desi

SQLAlchemy 139 Dec 30, 2022
flake8 plugin to catch useless `assert` statements

flake8-useless-assert flake8 plugin to catch useless assert statements Download or install on the PyPI page Violations Code Description Example ULA001

1 Feb 12, 2022
Stubs with type annotations for ordered-set Python library

ordered-set-stubs - stubs with type annotations for ordered-set Python library Archived - now type annotations are the part of the ordered-set library

Roman Inflianskas 2 Feb 06, 2020
flake8 plugin that integrates isort

Flake8 meet isort Use isort to check if the imports on your python files are sorted the way you expect. Add an .isort.cfg to define how you want your

Gil Forcada Codinachs 139 Nov 08, 2022