Open altdsoy opened 2 years ago
Hi @altdsoy,
First, thanks for the thorough report 🙂
I just ran the test suite after updating to credo 1.6 and it passed successfully:
$ mix deps | grep credo
* credo (Hex package) (mix)
locked at 1.6.3 (credo) 1167cde0
$ mix test
Excluding tags: [to_be_implemented: true]
..............................
Finished in 0.1 seconds
30 tests, 0 failures
Randomized with seed 293833
So I don’t think a conflict with credo 1.6 and credo_naming is the issue here.
A few questions:
lib/test_naming.exs
file? If not, that could be a sign that the file is ignored by your configuration.strict: false
to strict: true
? The ModuleFilename
check has a low priority, it might get skipped.Thank you!
Hello and thanks for the reply.
Are you able to generate errors from another check into your lib/test_naming.exs file? If not, that could be a sign that the file is ignored by your configuration.
Yes. For example, when I add a simple IO.inspect
, I'm getting a warning from credo.
What happens if you change strict: false to strict: true? The ModuleFilename check has a low priority, it might get skipped.
Ok this seems to do it. It worked!
Since it's within a Phoenix project I'm getting many (low [D]
) level warning Nested modules could be aliased at the top of the invoking module.
from generated Phoenix files (namely every test/support/*_case.ex
files.
But this is weird because they all come from Credo.Check.Design.AliasUsage
which are already within the enabled
key as seen above...
So now I wonder what makes the strict
flag enabling or not some checks already in the enabled
sections?
I guess I can simply disable or change the options for that check so that I can use CredoNaming
without changing any Phoenix files.
Though, CredoNaming
triggers so many inconsistencies anyway for Phoenix controllers, view, etc... that I still need to handle them somehow.. Which if we should think strictly it's true, but those naming also makes sense the way they are..
So do you have a suggestion for some rules to add to ignore them?
More generally, how I can add a rule that allows me to have things like FooThing.ex
to be inside things/foo_thing.ex
. Which applies for example for plugs
, tasks
, controllers
, views
etc..
Maybe it could be also set as a default for CredoNaming
?
For example, for something named FooThing
it would have make more sense to have it under things/foo.ex
(and by the way having also that as a valid rule for CredoNaming
would have been nice I think). Since the _thing.ex
is redundant with the parent folder despite the plural/singular form.
The problem in that case is if I have now FooOtherThing
inside other_things/foo.ex
it could be difficult to search for files and we are ending with many foo.ex
files that we don't know what they are unless we look at the parent folders (which is the case with Phoenix Views, Controllers etc.).
Sure this can be solved within one's IDE, but still..
Anyway, I guess this issue is somehow solved. So feel free to close the issue.
Thanks for the plugin BTW.
Edit: I forgot to explicitly ask, how I can make CredoNaming
work without the strict: true
and if it was intended to be used this way or not?
Hello,
I'm trying to add CredoNaming but nothing happens, I guess it's not longer compatible with credo 1.6?
Everything is default Phoenix. Here is the only addition to
mix.exs
for example:Here are my default
.credo.exs
file generated bymix credo gen.config
.Am I missing something?
I also tried to add into
CredoNaming
in therequire
andplugin
sections, but it's not working.Thanks.
Edit:
Forgot to mention that in order to test I only added the following module
test_naming.exs
inlib
: