-
Notifications
You must be signed in to change notification settings - Fork 106
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 lint check plugin for DN API endpoints #2787
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rickyrombo
force-pushed
the
mjp-api-gen-tests
branch
from
April 1, 2022 03:36
6e4cfeb
to
af9d5e8
Compare
…in API declarations
This reverts commit 2bd9b80.
rickyrombo
force-pushed
the
mjp-api-gen-lint
branch
from
April 1, 2022 04:29
cd73faf
to
95dc351
Compare
piazzatron
approved these changes
Apr 1, 2022
theoilie
pushed a commit
that referenced
this pull request
Apr 4, 2022
* Add linting flake8 plugin to ensure decorator order and route params in API declarations * Remove __init__.py * Revert "Remove __init__.py" This reverts commit 2bd9b80. * Modify visitor to make testing easier * Disable plugin test, rely on visitor test instead * Move to using local plugin * Disable rule temporarily * Fix bugs, add new rule, solve edge cases * Enable linter * add default case * Add tests to vscode test config * Made plugin more readable * Move to subfolder * Move to plugin.py * Split to several files * Update setup.cfg to point to plugin * Make readme * Fix order config * Fix README typo * Fix lint errors * Use absolute imports * Set root correctly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Creates
flask_decorator_plugin
which is a flake8 plugin to help keep the API well documented and formatted. Note that I also have a PR up with a test for API documentation:See README for rules and rationales
Also StyleGuide in Notion
It's pretty naive, super opinionated, and definitely not optimized and I'm sure there will be edge cases, but this will help keep the chaos a bit more structured. This also lays the groundwork if there's other rules/plugins we want on our wishlist and we can always enable/disable rules and iterate.
It's also super super niche and definitely makes a lot of assumptions on how the routes are formatted/how the routes are documented based on our existing patterns. If anyone gets into an edge case from one of these, let me know.
Callouts/Qs
ast.Name
or a function or something it ignores that check.Tests
Adds some basic test cases. Is itself tested against DN's current clean state.
How will this change be monitored? Are there sufficient logs?
Sending a message in Slack alerting team to ping me if they run into issues.