Existing software design suggestions are not ignored on diff
Environment
- Credo version (
mix credo -v): 1.6.2 - Erlang/Elixir version (
elixir -v): 1.12.0 - Operating system: MacOS
What were you trying to do?
First, thanks for all the hard work on this library!
I am introducing Credo on an existing codebase and I am trying to get a reasonable CI setup in place. The new diff options looked like exactly what I want, in that I'd like to only fail for issues that are new to the branch under test. I ran the following on a branch with no changes:
mix credo diff --from-git-ref origin/main
Expected outcome
All existing issues are marked fixed/kept. No existing issues are marked added. Exits with code 0.
Actual outcome
Changes between origin/main and working dir:
+ added 29 new software design suggestions,
✔ fixed 5 consistency issues, 9 warnings, 126 refactoring opportunities, 1355 code readability issues, 33 software design suggestions, and
~ kept 5 consistency issues, 9 warnings, 126 refactoring opportunities, 1355 code readability issues, 4 software design suggestions.
Use `mix credo explain` to explain issues, `mix credo diff --help` for options.
Exits with code 2.
The new diff options looked like exactly what I want, in that I'd like to only fail for issues that are new to the branch under test.
This sounds like you want to use --from-git-merge-base? Could be wrong though.
--from-git-ref works like git diff in that it compares the current state of origin/main with your branch.
--from-git-merge-base compares only the parts that changed on your branch, since you branched it off of origin/main.
Hi @rrrene, thanks for the reply! The output is the same regardless of which git diff flag I use. :) It's a little odd since design seems to be the only category afflicted.
Mmmm, sounds strange. Do you know of any open source repos where you have this problem? Repos where we can reproduce this, that is.
At the moment, no :( But on second glance, the problem appears to be isolated to duplicate code suggestions.
I will see if I can make a sample project to reproduce :)
I apologize for the age/inactivity on this issue. I should have done a better job at resolving this properly. 😥
Please feel free to re-open this issue at your discretion, especially if this is still a problem with Credo's current version.