Closed edmaarcosta closed 11 months ago
Do not evaluate anything since that have no changes between current HEAD from the master branch to evaluate (besides the .credo.exs updates).
The command you used does not look at the current HEAD of main
.
Maybe that is the problem?
All command line options are explained here: https://hexdocs.pm/credo/diff_command.html#command-line-switches
or by typing mix credo diff --help
🙂
Do not evaluate anything since that have no changes between current HEAD from the master branch to evaluate (besides the .credo.exs updates).
The command you used does not look at the current HEAD of
main
.Maybe that is the problem?
All command line options are explained here: https://hexdocs.pm/credo/diff_command.html#command-line-switches
or by typing
mix credo diff --help
🙂
Hi!
So, maybe I expressed myself wrong. Sorry. The documentation says:
Diff from where the current HEAD branched off from the given merge base.
$ mix credo diff --from-git-merge-base develop
This runs Credo only on the things that changed on your branch after it branched off of the given ref.
In my example, I created the testing/credo
branched off master
branch. Running mix credo diff --from-git-merge-base master
in testing/credo
branch, Credo will runs only on the things that changed in testing/credo
branch? Do I understand the --from-git-merge-base
flag right?
Yes, that is how it's supposed to work. It is also important to note that the language might need a clarification: Credo does not run "only on the things that changed" but rather it runs Credo against both refs and diffs the results.
Maybe I misunderstood your original point?
What's do you mean with "refs and diffs"?
I running some tests with my old .credo.exs
in those scenario:
A branch called testing/credo
branched off master
;
In testing/credo
branch I added a problematic code;
Running mix credo diff --from-git-merge-base master
Credo point up the issue with my code.
☝️ This is a expected behavior
A branch called testing/credo2
branched off testing/credo
;
Running mix credo diff --from-git-merge-base testing/credo
Credo doesn't point up any issue since that is no difference between the two branches.
☝️ This is a expected behavior
With the same use case above, but running mix credo diff --from-git-merge-base master
Credo do point up the same issue from the first case. 👈 this is a expected behavior too.
But whats not clear for me yet its why with the new checks in .credo.exs
the behavior are not the same. The behavior with the new checks is to point up issues when (in my tiny head) none changes as made in the codebase.
I don't know if I made myself clear here. My apologies for any misunderstood.
Yes, that is how it's supposed to work. It is also important to note that the language might need a clarification: Credo does not run "only on the things that changed" but rather it runs Credo against both refs and diffs the results.
Maybe I misunderstood your original point?
Thanks a lot @rrrene, this finally clears up our confusion. I was also struggling with the same thing as @edmaarcosta. I thought that if I enable a new check in a new git branch (called feature
for example) that was branched from master
, it will run only for the changes that I will get from git diff master feature
.
I would like for the newly added check to not be "retro-active" (unless I want it to), because that would mean so many fixes at once. Do I understand that correctly that this is not possible now?
Do I understand that correctly that this is not possible now?
This should be possible by adding --config-file .credo.exs
to the command, because that way you are telling Credo to use that config file for both evaluations.
Please report back if that solves your use case, then we can add the example to the documentation :+1:
Please report back if that solves your use case, then we can add the example to the documentation 👍
Thanks a lot @rrrene, this solved our problem. 👌🏻
Environment
mix credo -v
): 1.7.0elixir -v
): 1.7.4What were you trying to do?
Running
mix credo diff --from-git-merge-base master
with.credo.exs
bellow:I just added new
enabled
checks to file. After the update,mix credo diff
stopped working.Expected outcome
Do not evaluate anything since that have no changes between current HEAD from the
master
branch to evaluate (besides the.credo.exs
updates).Maybe some checks doesn't respect the
mix credo diff
execution?Output with the old
.credo.exs
:Output with the new
.credo.exs
:Old
.credo.exs
: