-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 scripts to generate plugin and check boilerplate #1579
Conversation
7f7d9da
to
d0c3f8b
Compare
scripts/add_check.py
Outdated
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description="Generate boilerplate for a new check.", | ||
epilog=("python scripts/add_check.py --name PreferListBuiltin --code PIE807 --plugin flake8-pie"), |
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.
Since these arguments are required, I think I'd rather make them positional e.g.
python scripts/add_check.py flake8-pie PIE807 PreferListBuiltin
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.
My gripe with that is that you then have to remember the order.
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.
Right, I think that could be mitigated by doing some input validation and providing nice error messages e.g:
- providing a nice error message if the first argument isn't an existing plugin
- providing a nice error message if the second argument doesn't have the prefix of the plugin
d0c3f8b
to
954aa63
Compare
954aa63
to
4318e44
Compare
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://togithub.com/charliermarsh/ruff) | `^0.0.207` -> `^0.0.208` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.208/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.208/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.208/compatibility-slim/0.0.207)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.208/confidence-slim/0.0.207)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.208`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.208) [Compare Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.207...v0.0.208) #### What's Changed - Adds a codespell linter by [@​colin99d](https://togithub.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/1553](https://togithub.com/charliermarsh/ruff/pull/1553) - Avoid merging import from statements with inline comments by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1562](https://togithub.com/charliermarsh/ruff/pull/1562) - Avoid PEP 604 rewrites for runtime annotations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1563](https://togithub.com/charliermarsh/ruff/pull/1563) - Implement `flake8-pytest-style` by [@​edgarrmondragon](https://togithub.com/edgarrmondragon) in [https://github.com/charliermarsh/ruff/pull/1506](https://togithub.com/charliermarsh/ruff/pull/1506) - Always check directly-passed-in files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1564](https://togithub.com/charliermarsh/ruff/pull/1564) - Remove common-path dependency by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1565](https://togithub.com/charliermarsh/ruff/pull/1565) - Rename checks.rs to registry.rs by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1566](https://togithub.com/charliermarsh/ruff/pull/1566) - Remove extend- from docstring configuration examples by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1571](https://togithub.com/charliermarsh/ruff/pull/1571) - Avoid invalid trailing comma fixes for mock rewrites by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1570](https://togithub.com/charliermarsh/ruff/pull/1570) - Automatically set baseline D codes based on convention by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1574](https://togithub.com/charliermarsh/ruff/pull/1574) - Remove need for vendored format/cformat code by [@​olliemath](https://togithub.com/olliemath) in [https://github.com/charliermarsh/ruff/pull/1573](https://togithub.com/charliermarsh/ruff/pull/1573) - Warn user when D203 and D211 are enabled by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1576](https://togithub.com/charliermarsh/ruff/pull/1576) - Add `flake8-pie` plugin with `prefer_list_builtin` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1578](https://togithub.com/charliermarsh/ruff/pull/1578) - Add scripts to generate plugin and check boilerplate by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1579](https://togithub.com/charliermarsh/ruff/pull/1579) - Implement unnecessary-pass-statement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1580](https://togithub.com/charliermarsh/ruff/pull/1580) - Implement dupe-class-field-definitions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1581](https://togithub.com/charliermarsh/ruff/pull/1581) - Implement autofix for F541 by [@​harupy](https://togithub.com/harupy) in [https://github.com/charliermarsh/ruff/pull/1577](https://togithub.com/charliermarsh/ruff/pull/1577) - Add a link to GitHub from the playground by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1583](https://togithub.com/charliermarsh/ruff/pull/1583) - Mark `FStringMissingPlaceholders` as fixable by [@​harupy](https://togithub.com/harupy) in [https://github.com/charliermarsh/ruff/pull/1582](https://togithub.com/charliermarsh/ruff/pull/1582) - Swap accent color for playground by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1584](https://togithub.com/charliermarsh/ruff/pull/1584) - Prefer GitHub icon on mobile by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1585](https://togithub.com/charliermarsh/ruff/pull/1585) - Implement and-false and or-true rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1586](https://togithub.com/charliermarsh/ruff/pull/1586) **Full Changelog**: astral-sh/ruff@v0.0.207...v0.0.208 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43NC4yIiwidXBkYXRlZEluVmVyIjoiMzQuNzQuMiJ9--> Signed-off-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
These are pretty hacky, but they work, and they'll save us a ton of time. Since they're dev-only, they can be pretty scrappy, so let's just iterate on them as we go.
To generate a plugin:
To generate a check code:
Resolves #1531 and #1532.