editorconfig-checker.javascript icon indicating copy to clipboard operation
editorconfig-checker.javascript copied to clipboard

Works incorrectly with paths

Open Alecto opened this issue 3 years ago • 6 comments

Hello! Please help me figure out how to exclude several folders from the scan.

documentation says to use valid regular expressions image

with one folder - exception works image

but if I use a valid regular expression - the plugin doesn't work image path not found as the result image

please explain where I went wrong and how to set an exception for a group of certain files or folders.

Alecto avatar Aug 07 '22 16:08 Alecto

Can you try:

    "editorconfig": "editorconfig-checker -exclude 'libs|styles\\.css'"

I think it has to do with how npm/node interprets the script command.

mstruebing avatar Aug 08 '22 07:08 mstruebing

@mstruebing doesnt work image ...path not found

and if I leave only the folder - it doesn't work either image

the impression is that the regular expression is not perceived at all, only the simplest string.

Alecto avatar Aug 08 '22 07:08 Alecto

For me it works:

https://user-images.githubusercontent.com/12071529/183366955-cb34e0f3-d405-4fa8-98e1-da1b9e9e13ae.mov

mstruebing avatar Aug 08 '22 07:08 mstruebing

Uhhh, sorry, I just realized: it looks like you are on windows by the path your terminal shows? I don't really have a clue about windows development and don't have a machine to test.

Could you may run the command with --verbose --debug to may see additional information?

mstruebing avatar Aug 08 '22 07:08 mstruebing

that's how it works image

but if you put '...' - it stops working image

even if you specify one folder, but in quotes - it no longer works image path not found

image

look like ' - is a part of path

image image

Alecto avatar Aug 08 '22 07:08 Alecto

It looks like any paths are incorrectly being mapped. Also the paths in .editorconfig file itself.

With the following (part of) .editorconfig:

[tests/**.ts]
trim_trailing_whitespace = false

It should not give the following errors: image

jerone avatar Aug 12 '22 21:08 jerone

I don't know it is required in this context, but the regex

libs|styles\\.css

may need parentheses:

(libs|styles\\.css)

Also, I don't know if it applies here, but Windows' CMD.EXE needs the double quote character (instead of the apostrophe) to surround strings. So can you try:

"editorconfig-checker -exclude \"(libs|styles\\.css)\""

rasa avatar Sep 04 '22 16:09 rasa

@rasa Thanks a lot, it looks like your solution works! I'll check with a fresh mind, but so far I've managed to ignore files and folders! thanks again.

Alecto avatar Sep 04 '22 17:09 Alecto

@Alecto Great news! If it's solved your issue, please close this ticket if you don't mind. Thanks.

rasa avatar Sep 04 '22 23:09 rasa

This is still an issue when using the .editorconfig paths, instead of CLI command. Creating some custom altered version for the CLI command, specifically for one OS, will not work for an .editorconfig file.

See reply above; https://github.com/editorconfig-checker/editorconfig-checker.javascript/issues/387#issuecomment-1213539658

jerone avatar Sep 05 '22 17:09 jerone

@jerone Your fix changes \\ to / in the .editorconfig file. Is this the issue you are raising? That editorconfig-checker handles /s properly, but fails on treating \\ as a valid directory separator on Windows?

If that is the case, note that https://spec.editorconfig.org/#file-format says: "Backslashes (\) are not allowed as path separators (even on Windows)."

rasa avatar Feb 11 '23 16:02 rasa

@jerone Your fix changes \\ to / in the .editorconfig file. Is this the issue you are raising? That editorconfig-checker handles /s properly, but fails on treating \\ as a valid directory separator on Windows?

Aldo this was an half year ago, I think that "fix" was an test to see editorconfig-checker in action. The issue at that time, was that it would not handle any path separators. See https://github.com/editorconfig-checker/editorconfig-checker.javascript/issues/387#issuecomment-1237329381 If that is still an issue, I have no idea.

jerone avatar Feb 11 '23 17:02 jerone