Pylint invalid constant name

When checking names, Pylint differentiates between constants, variables, classes etc. Any name that is not inside a function/class will be considered a constant, anything else is a variable. See http://docs.pylint.org/features.html#basic-checker variable-rgx: [a-z_][a-z0-9_]{2,30}$ const-rgx: (([A-Z_][A-Z0-9_]*)|(__.*__))$ Because you’re in a function, MIN_SOIL_PARTICLE_DENS is (according to pylint) supposed to be a variable, pylint however treats it as a … Read more

pytest fixtures Redefining name from outer scope [pylint]

The pytest docs for @pytest.fixture say this: If a fixture is used in the same module in which it is defined, the function name of the fixture will be shadowed by the function arg that requests the fixture; one way to resolve this is to name the decorated function fixture_<fixturename> and then use @pytest.fixture(name=”<fixturename>”). So … Read more

How do I tell PyLint “it’s a variable, not a constant” to stop message C0103?

# pylint: disable-msg=C0103 Put it in the scope where you want these warnings to be ignored. You can also make the above an end-of-line comment, to disable the message only for that line of code. IIRC it is true that pylint interprets all module-level variables as being ‘constants’. newer versions of pylint will take this … Read more

Avoid Pylint warning E1101: ‘Instance of .. has no .. member’ for class with dynamic attributes

This page describes the error and gives an easy way to address it directly in the code. tl;dr Used when an object (variable, function, …) is accessed for a non-existent member. False positives: This message may report object members that are created dynamically, but exist at the time they are accessed. A commentor mentions that … Read more

Error message “Linter pylint is not installed”

Check the path Pylint has been installed to, by typing which pylint on your terminal. You will get something like: /usr/local/bin/pylint Copy it. Go to your Visual Studio Code settings in the preferences tab and find the line that goes “python.linting.pylintPath”: “pylint” Edit the line to be “python.linting.pylintPath”: “/usr/local/bin/pylint”, replacing the value “pylint” with the … Read more

Pylint raise-missing-from

The link in the comment on your question above outlines the issue and provides a solution, but for clarity of those landing straight on this page like myself, without having to go off to another thread, read and gain context, here is the answer to your specific problem: TL;DR; This is simply solved by aliasing … Read more

How to run Pylint with PyCharm

You can set up Pylint to work with PyCharm by following the following steps: Install pylint: $ pip install pylint Locate your pylint installation folder: $ which pylint # MacOS/Linux /usr/local/bin/pylint # This is just a possible output – check yours <!–> $ where pylint # Windows %LocalAppData%\Programs\Python\Python36-32\Scripts\pylint.exe # Possible location Open the PyCharm settings … Read more

How to fix pylint logging-not-lazy? [duplicate]

This means, that you should rewrite your code as: logging.debug(“detect mimetypes faild because %s”, e) According to https://docs.python.org/2/library/logging.html Logger.debug(msg, *args, **kwargs) … Logs a message with level DEBUG on this logger. The msg is the message format string, and the args are the arguments which are merged into msg using the string formatting operator. (Note … Read more