Please help me using credo

In Structuring projects - this ok? I was hinted towards Credo. Credo seems to be a great tool.

I am using Credo with Visual Studio Code / Windows with the extension “ElixirLS”. My VCS settings are:

{
    "files.autoSave": "onFocusChange",
    "editor.trimAutoWhitespace": true,
    "files.trimTrailingWhitespace": true,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "workbench.colorTheme": "Monokai Dimmed",
    "editor.formatOnSave": true,
    "files.insertFinalNewline": false,
    "editor.minimap.enabled": false
}

Could you help me with some credo statements?

The first one that irritates me:

There should be no trailing white-space at the end of a line

But there are no trailing white-spaces in my .ex(s) files at the stated place…

It that message shown if you run ‘mix credo’? My biggest gripe with code is that it’s hard to tell sometimes what all is linting/formatting.

This is shown multiple times for each of my files when I type mix credo --strict.

This is just an assumption, based on the path of the shell in your config.

It seems as if you were using windows, and most windows editors use \r\n as line endings. It might be, that the Credo Check reports a false positive here, as it consideres \r whitespace and only \n as the newline.

Please convert your files to use Linux Style line endings.

In Visual code you can check which style is used in the lower right corner, CRLF is windows style, LF is linux style.

6 Likes

Thanks, that helped :slight_smile:

Having said that, one might argue that Credo is at fault here, because it (for better or worse…) is definitely not the default/normal behaviour on Windows to use Linux style line endings.
If you feel that it is counter-intuitive and something Credo could at least explain better, @Nefcairon, you might want to consider opening an issue on the Credo repository to start a conversation with the maintainers about this :slight_smile:.

2 Likes