Skip to content

plugin_convention_warnings.py script#178

Merged
alexandraBara merged 6 commits intodevelopmentfrom
jaspals_precommitchecks
Apr 8, 2026
Merged

plugin_convention_warnings.py script#178
alexandraBara merged 6 commits intodevelopmentfrom
jaspals_precommitchecks

Conversation

@jaspals3123
Copy link
Copy Markdown
Collaborator

this script runs as a part of pre commit check to ensure :

  1. class variable follows a certain naming convention CMD_XYZ
  2. for collect/analyzer args Every variable should be a pydantic Field with description field populated

jaspals added 3 commits March 30, 2026 16:29
- scripts/plugin_convention_warnings.py: AST checks for CMD_/Field conventions
- .pre-commit-config.yaml: local hook (always_run, exits 0)

Made-with: Cursor
return False


def _check_cmd_prefixes(path: Path, tree: ast.Module) -> list[str]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add a docstring here and comment on how the collector CMD_<> should look like. Its easier to read that than try and interpret this code. Users should be able to read the comments in this script and figure out what the rules are. Maybe add a module level docstring and details every rule there. Then reference the item number in the docstring of the function. Something like this:
module docstring:

Rules to follow:
1. Every collector command needs to be added like: CMD_<> or CMD
2. ...

Then in the function that checks the rule add the docstring like:

Implement rule #2. Check that collector cmd variable is of format: CMD_<>

@alexandraBara alexandraBara merged commit e561b83 into development Apr 8, 2026
6 checks passed
@alexandraBara alexandraBara deleted the jaspals_precommitchecks branch April 8, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants