-
Notifications
You must be signed in to change notification settings - Fork 65
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
Script to add new rule file #123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also include this tool in the documentation.
You can run jupyter notebook
in your local venv to start Jupyter notebook and edit it in browser.
It uses nbsphinx to generate doc and text cell needs to use rst
format.
https://nbsphinx.readthedocs.io/en/0.7.1/raw-cells.html
The best place to mention this command is in the section of "Lint Rule Scaffolding".
As far as I could estimate from writing 2 rules is that, saving the rule to |
I already suggest this, but As per @jimmylai suggestion, I have not implemented this functionality. |
Will add
|
The class name is in camel case and the file name is in underscore-separated-case. They doesn't necessary to be the same name. So provide another parameter like |
Yeah, makes sense (the thing that was in my mind was .split('_') + .title() + .join() + 'Rule') |
How about this? def snake_to_camelcase(name):
"""Convert snake-case string to camel-case string."""
return "".join(n.capitalize() for n in name.split("_")) |
Yeah, that works. Then we should explain it clearly in the documentation. |
@jimmylai Should I start working on |
We can leave the |
@acharles7 it looks really awesome now! |
@jimmylai Thank you for your quick reviews. |
Sure, please go ahead. |
Summary
Fixes #119
new_rule.py
This will create a skeleton of the rule file at the path given in the
--path
argumentnew_rule.py