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

add UseLintFixmeCommentRule #161

Merged
merged 1 commit into from
Dec 7, 2020
Merged

Conversation

jimmylai
Copy link
Contributor

@jimmylai jimmylai commented Dec 7, 2020

Summary

add UseLintFixmeCommentRule to warn on deprecated noqa comment.
Converting a noqa to lint-fixme requires extra information (lint rule name) which makes it hard to provide autofix.
It also requires moving inline noqa comments to a standalone line.
We could consider provide a VSCode plugin as follow up that can suggest adding a lint-fixme or lint-ignore given a lint warning as a second option.

Test Plan

tox -e py38 -- fixit.tests.UseLintFixmeCommentRule

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 7, 2020
@jimmylai jimmylai requested review from Kronuz and zsol December 7, 2020 08:55
@jimmylai jimmylai marked this pull request as ready for review December 7, 2020 08:55
Copy link
Contributor

@Kronuz Kronuz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you could use that regex instead, to handle when users use #noqa (no space, or multiple spaces) or when users put noqa after another comment. But for simplicity, I think handling uppercase/lowercase # noqa could be enough.

@jimmylai
Copy link
Contributor Author

jimmylai commented Dec 7, 2020

I guess you could use that regex instead, to handle when users use #noqa (no space, or multiple spaces) or when users put noqa after another comment. But for simplicity, I think handling uppercase/lowercase # noqa could be enough.

The regex requires one specific space before noqa. For the case of noqa after another comment, as long as the comment starts with noqa, it's a valid noqa comment which we want to show this warning.

r"^# noqa(?!-file)(?:: (?P<codes>([a-zA-Z0-9]+,\s*)*[-_a-zA-Z0-9]+))?",

@jimmylai jimmylai merged commit 286659e into Instagram:master Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants