editorconfig-checker / editorconfig-checker

A tool to verify that your files are in harmony with your .editorconfig
https://editorconfig-checker.github.io/
MIT License
441 stars 52 forks source link

Passing directory arguments results in `Could not get the ContentType` errors since 2.8.0 #326

Closed silverwind closed 8 months ago

silverwind commented 9 months ago

Since 2.8.0, this module seems to no longer work when passing directories as arguments:

$ mkdir foo
$ touch foo/bar.txt
$ go run github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0 foo
$ go run github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker@2.8.0 foo
Could not get the ContentType of file: bar.txt
stat bar.txt: no such file or directory
silverwind commented 9 months ago

Another related problem is that exit code seems to be 0 with these Could not get the ContentType errors, but I would have expected it to be non-zero when any errors are present.

greut commented 9 months ago

@silverwind it was likely introduced by me there: #292

327 seems to fix this, you may try it using the commit as below.

$ go run github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker@a7a8d55e3aaecd1b5f1d4c98df01bc12ccf857b7
janedbal commented 8 months ago

Will you tag the fix? Thanks

mstruebing commented 8 months ago

@janedbal tagged a release, but as a breaking change: https://github.com/editorconfig-checker/editorconfig-checker/releases/tag/v3.0.0