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 SortedAttributesRule #149

Merged
merged 1 commit into from
Oct 15, 2020
Merged

Add SortedAttributesRule #149

merged 1 commit into from
Oct 15, 2020

Conversation

oopDaniel
Copy link
Contributor

Summary

Support sorting class attributes alphabetically with autofix.

Test Plan

Unit test by running tox -e py37

All tests passed!

Screen Shot 2020-10-14 at 6 37 11 PM

@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 Oct 15, 2020
@codecov-io
Copy link

Codecov Report

Merging #149 into master will increase coverage by 25.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #149       +/-   ##
===========================================
+ Coverage   59.48%   84.56%   +25.08%     
===========================================
  Files         272       84      -188     
  Lines       38943     3441    -35502     
===========================================
- Hits        23164     2910    -20254     
+ Misses      15779      531    -15248     
Impacted Files Coverage Δ
fixit/rules/sorted_attributes_rule.py 100.00% <100.00%> (ø)
...age/lib/python3.8/site-packages/mypy_extensions.py
...coverage/lib/python3.8/site-packages/yaml/cyaml.py
...e-packages/libcst/_parser/parso/python/tokenize.py
...e/lib/python3.8/site-packages/flake8/statistics.py
...b/python3.8/site-packages/libcst/helpers/common.py
...overage/lib/python3.8/site-packages/pycodestyle.py
...thon3.8/site-packages/flake8/formatting/default.py
...3.8/site-packages/setuptools/command/py36compat.py
...kages/libcst/_parser/parso/pgen2/grammar_parser.py
... and 181 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a61d8f...22baa7c. Read the comment docs.

@oopDaniel oopDaniel marked this pull request as ready for review October 15, 2020 02:17
""",
)
]
ONCALL_SHORTNAME = "ig_creation_backend"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not needed.

Suggested change
ONCALL_SHORTNAME = "ig_creation_backend"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catches 👍 . I'm pushing a new version that solves all the comments.

return
self.report(
node,
self.MESSAGE,
Copy link
Contributor

Choose a reason for hiding this comment

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

self.MESSAGE is used by default.

Suggested change
self.MESSAGE,

"""
)
]
MESSAGE: str = "It appears you are using the @sorted directive and the class variables are unsorted. See the lint autofix suggestion."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MESSAGE: str = "It appears you are using the @sorted directive and the class variables are unsorted. See the lint autofix suggestion."
MESSAGE: str = "It appears you are using the @sorted-attributes directive and the class variables are unsorted. See the lint autofix suggestion."

resolve 'future feature annotations is not defined'

address comments
@jimmylai jimmylai merged commit f4cd9a0 into Instagram:master Oct 15, 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.

5 participants