Alijonov
Alijonov

Reputation: 43

Pylint warn the usage of print statement

I am using pylint_django for my django project. And I want to disable print statement usage or warn about it at least. Because I am using custom logger class. But there is no any warn about usage of print.


extension-pkg-whitelist=

ignore=CVS

ignore-patterns=

jobs=1


limit-inference-results=100

load-plugins=

persistent=yes

suggestion-mode=yes

unsafe-load-any-extension=no


[MESSAGES CONTROL]
confidence=

disable=missing-docstring,
        invalid-name,
        astroid-error,
        protected-access,
        broad-except

enable=c-extension-no-member, print-statement


[REPORTS]
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

output-format=text

reports=no

score=yes


[REFACTORING]

max-nested-blocks=5

never-returning-functions=sys.exit


[LOGGING]

logging-format-style=old

logging-modules=logging

....

How can i solve this issue?

VsCode settings.json

{
  "python.linting.pylintEnabled": true,
  "python.linting.enabled": true,
  "python.linting.flake8Enabled": false,
  "python.linting.prospectorEnabled": false,
  "python.linting.pylintArgs": [
    "--load-plugins=pylint_django",
    "--rcfile=.pylintrc",
    "--enable=print-statement"
  ]
}

Upvotes: 0

Views: 321

Answers (2)

Rafael Nicolas Trozzo
Rafael Nicolas Trozzo

Reputation: 21

In my case Pierre's answer didn't worked out of the box, I needed to change it by:

[tool.pylint.deprecated_builtins]
bad-functions=map,filter,print

I think Pylint does not like the "". I searched on GitHub and there are many ways people use it but I barely saw any quotation marks in the .pylintrc files https://github.com/search?q=bad-functions&type=code

Upvotes: 0

Pierre.Sassoulas
Pierre.Sassoulas

Reputation: 4282

You can do that using the deprecated checkers bad-functions options:

[tool.pylint]
bad-functions = ["map", "filter", "print"]

Upvotes: 1

Related Questions