feat: accept slither.conf.json as alternative default config#3011
Open
cats2101 wants to merge 1 commit intocrytic:masterfrom
Open
feat: accept slither.conf.json as alternative default config#3011cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101 wants to merge 1 commit intocrytic:masterfrom
Conversation
This file contains hidden or 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
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.
Closes #595
Summary
When no
--config-fileis provided, Slither will now look forslither.conf.jsonas a fallback ifslither.config.jsonis not present. If both files exist,slither.config.jsontakes precedence (preserves current behavior).This matches the request in the issue: accept
slither.conf.jsonfor convenience without breaking anyone.Changes
slither/utils/command_line.py: introduceDEFAULT_CONFIG_FILENAMES = ("slither.config.json", "slither.conf.json")and updateread_config_fileto iterate the tuple.slither/__main__.pyandslither/tools/slither_format/__main__.py: update--config-filehelp text. Forslither-format, the default changes from the hardcoded string"slither.config.json"toNoneso the auto-detection chain applies consistently across both entrypoints.docs/src/Usage.md: mention both filenames.tests/unit/utils/test_command_line.py: new unit tests covering both filenames, precedence, and the no-default case.Test plan
pytest tests/unit/utils/test_command_line.py -v)ruff checkpasses on modified filesslither.conf.jsonpresent, it is picked up and its flags are appliedslither.config.jsonstill wins