-
Notifications
You must be signed in to change notification settings - Fork 64
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 validate command #480
Add validate command #480
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.
I think I would prefer this to take a direct path to a config (eg, pyproject.toml
or fixit.toml
), read the "raw" config with read_configs([path])
, and then manually call parse_rule()
for each string in every enable/disable option (including in every override block). Then call find_rules()
on each qualified rule and log errors/warnings for anything that fails to load.
That way, we're not validating the config for a single code path in the repo, but instead validating all possible rules that are referenced from the file, including in all override blocks, to make sure that rules are correctly expressed, findable, and importable.
Bonus points if the warnings/errors can reference the specific block/enable/disable section to make it clear to the user which element is causing the problem.
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.
Looks great overall. One last request: can we add a simple smoke test that tests this command against a bogus config file and make sure it produces some baseline expected output? You should be able to follow examples in tests/smoke.py
for validating expected output on stdout.
Summary
Added command to Fixit to check if a config file is valid
Test Plan
Created invalid fixit.toml files such as:
and ran the new command against them: