Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

# pylint: … line comments do not play well with other code analyzers (they have to appear at the end) #2485

Closed
posita opened this issue Sep 12, 2018 · 4 comments
Labels

Comments

@posita
Copy link

posita commented Sep 12, 2018

Consider someone who uses Mypy notations, pyflakes, pylint, and bandit. This will confuse pylint:

… # type: … # noqa: E501 # pylint: disable=line-too-long # nosec

Pylint will give you the warning: pylint: Bad option value 'line-too-long # nosec' ("bad-option-value"). Pylint requires the line be written as follows (with the # pylint comment at the end):

… # type: … # noqa: E501 # nosec # pylint: disable=line-too-long

See also #199 and #2297.

@PCManticore
Copy link
Contributor

Yes, this is 💩 . We should definitely fix it. Another separate idea is that we should add support for noqa: ERROR MESSAGE. While I was against bare noqa in the past, I think noqa: error message would help with this whole mess where every linter specifies its own pragma controls.

@PCManticore
Copy link
Contributor

Should be fixed now. Please give it a go and let me know if it works for you!

DevynCJohnson added a commit to DevynCJohnson/pylint that referenced this issue Oct 7, 2018
DevynCJohnson added a commit to DevynCJohnson/pylint that referenced this issue Oct 7, 2018
DevynCJohnson added a commit to DevynCJohnson/pylint that referenced this issue Oct 7, 2018
DevynCJohnson added a commit to DevynCJohnson/pylint that referenced this issue Oct 7, 2018
DevynCJohnson added a commit to DevynCJohnson/pylint that referenced this issue Oct 7, 2018
@DevynCJohnson
Copy link

@PCManticore , thank you for taking the time to try to fix this issue. I had reported this issue as well - #2470 . However, I tried the code here on GitHub, but there is no change in behavior. For instance, I have a line like this some_code # noqa: N801 # pylint: disable=R0903, but Pylint will not see the its linter comment.

Although, I submitted a pull request that has the solution for #2297, #2470, and #2485.

The solution: Pull Request 2537

@PCManticore
Copy link
Contributor

PCManticore commented Oct 10, 2018

@DevynCJohnson Thanks but I don't think your PR actually changes anything for your linked issues. As mentioned in #2537 (comment), the current master should deal with all the linked issues, but your PR improves though a potential bug in format.py related to line-too-long and other additional linter comments.
I also have to complain about the use of try to fix the issue, please avoid it as it's quite patronising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants