Closed r0fls closed 5 years ago
@r0fls I believe the flag is conflicting with the default rcfile provided. Please run directly pylint --py3k --rcfile=$PATH_TO_PYLINTRC view/my_view.py
and see if the problem persists.
You can also check the full output of the linter in the cache folder (~/.git-lint/cache/pylint/
)
That seems to be true, but I tried specifying a different location for the rcfile and still doesn't work, nor does placing the pylintrc file in the default location ~/.pylintrc:
$ pylint --py3k views/my_view.py
.py
Using config file /Users/raphaeldeem/.pylintrc
************* Module views/my_view.py
E: 19, 0: print statement used (print-statement)
Versus
$ git-lint
Linting file: views/my_view.py
OK
With the following in .git-lint.yaml
:
$ cat .gitlint.yaml
# Python
pylint:
extensions:
- .py
command: pylint
arguments:
- --rcfile=~/.pylintrc
- --output-format=text
- >-
--msg-template={{abspath}}:{{line}}:{{column}}:
[{{category}}:{{symbol}}] {{obj}}: {{msg}}
- --reports=n
filter: >-
^{filename}:(?P<line>{lines}):((?P<column>\d+):)?
\[(?P<severity>.+):(?P<message_id>\S+)\]\s+(:
)?(?P<message>.+)$
installation: "Run pip install pylint."
I also tried specifying the pylintrc location as ./.pylintrc
and placing it in the project root. So, it seems to not be consuming the rcfile argument correctly.
I also tried this:
6 arguments:
7 - --rcfile={REPO_HOME}/.pylintrc
In .gitlint.yaml with .pylintrc in the repo root.
Using REPO_HOME
to specify the path should have worked. Are you sure that the path exists? Can you check the output in the cache directory?
Try adding --verbose
to pylint, so that it prints the config file being used.
you could even try some of the other alternatives for specifying the config file. See https://docs.pylint.org/en/1.6.0/run.html#command-line-options
Hmm, I'm not sure what was causing this to fail before because I thought I tried this configuration already. FWIW I'll share what worked. I put this in .gitlint.yaml
in the repo root:
# Python
pylint:
extensions:
- .py
command: pylint
arguments:
- --py3k
- --rcfile={REPO_HOME}/pylintrc
- --output-format=text
- >-
--msg-template={{abspath}}:{{line}}:{{column}}:
[{{category}}:{{symbol}}] {{obj}}: {{msg}}
- --reports=n
filter: >-
^{filename}:(?P<line>{lines}):((?P<column>\d+):)?
\[(?P<severity>.+):(?P<message_id>\S+)\]\s+(:
)?(?P<message>.+)$
installation: "Run pip install pylint."
Then I took the pylintrc from here: https://github.com/kubeflow/examples/blob/master/.pylintrc
But modified it so that all linters were enabled and added that to the repo root ad pylintrc
.
I have the following configuration:
Which results in linting the python file when I make a change to it:
However it reports
OK
although with the--py3k
argument it should not. I've also tried just putting- py3k
in the arguments list.Whereas this is the output when running
pylint
directly:Am I passing the argument incorrectly?