Skip to content
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

Only the last of multiple configuration files is processed #467

Closed
rbailey-godaddy opened this issue Mar 21, 2023 · 0 comments · Fixed by #468
Closed

Only the last of multiple configuration files is processed #467

rbailey-godaddy opened this issue Mar 21, 2023 · 0 comments · Fixed by #468
Labels
bug Something isn't working

Comments

@rbailey-godaddy
Copy link
Contributor

🐛 Bug Report

If tartufo is executed using multiple --config options, only the last-specified configuration file is processed.

To Reproduce

Using the tartufo repository itself as an example:

  1. Copy the tartufo stuff out of pyproject.toml into a new foo.toml (leave all of the existing stuff alone so that what you are trying to look at doesn't get washed out with findings)
  2. Add a new exclude-path-patterns entry such as {path-pattern = 'foo', reason = 'Testing'}, to foo.toml
  3. Duplicate foo.toml to bar.toml, and change that new entry from foo to bar
  4. Run tartufo -v --config foo.toml --config bar.toml scan-local-repo .

You can see in the output that the excluded paths list includes bar but not foo. Switch the order of the files and you get opposite results.

Interestingly, if you add a short exclude-entropy-patterns in foo.toml, for example:

exclude-entropy-patterns = [
    {path-pattern = 'foo', pattern = 'whatever', reason = 'Testing'},
]

this will get erased by bar.toml (even though bar.toml doesn't have an exclude-entropy-patterns in it), so it really is a case of "all but the last --config have no effect"

Expected Behavior

The multiple humans I have discussed this issue with expect that configuration files should be cumulative.

  • List-valued parameters, such as exclude-path-patterns and exclude-entropy-patterns, should be merged
  • Single-valued parameters, such as cleanup and entropy, should be determined by the last-specified configuration

Environment

I am reporting this problem against tartufo 4.0.1, but I believe this behavior exists in all previous versions of tartufo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant