Skip to content

feat: accept slither.conf.json as alternative default config - #3011

Merged
smonicas merged 2 commits into
crytic:masterfrom
cats2101:feat/slither-conf-json-alias
Jul 28, 2026
Merged

feat: accept slither.conf.json as alternative default config#3011
smonicas merged 2 commits into
crytic:masterfrom
cats2101:feat/slither-conf-json-alias

Conversation

@cats2101

Copy link
Copy Markdown
Contributor

Closes #595

Summary

When no --config-file is provided, Slither will now look for slither.conf.json as a fallback if slither.config.json is not present. If both files exist, slither.config.json takes precedence (preserves current behavior).

This matches the request in the issue: accept slither.conf.json for convenience without breaking anyone.

Changes

  • slither/utils/command_line.py: introduce DEFAULT_CONFIG_FILENAMES = ("slither.config.json", "slither.conf.json") and update read_config_file to iterate the tuple.
  • slither/__main__.py and slither/tools/slither_format/__main__.py: update --config-file help text. For slither-format, the default changes from the hardcoded string "slither.config.json" to None so 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

  • New unit tests pass (pytest tests/unit/utils/test_command_line.py -v)
  • ruff check passes on modified files
  • Behavior check: with only slither.conf.json present, it is picked up and its flags are applied
  • Behavior check: with both present, slither.config.json still wins

@cats2101
cats2101 requested a review from smonicas as a code owner April 20, 2026 00:07
@cats2101

cats2101 commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Gentle ping — anything else needed here?

@smonicas
smonicas merged commit 0edb5e3 into crytic:master Jul 28, 2026
35 checks passed
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.

Support slither.conf.json and slither.config.json

2 participants