Skip to content

New EditorConfig-Checker config file is not applied by default #5061

@llaville

Description

@llaville

Describe the bug

Since v3.1.0 EditorConfig-Checker has changed is configuration filename.
It now emits a deprecation warning on old file .ecrc, while in same time it expect to find a new .editorconfig-checker.json config file.

Recently, I've decided to rename old file to new one with MegaLinter 8.5.0, and discover that I've wrong results now, while it works fine before renaming config file.

I've investigated and found that default config file is still point to old name : https://github.com/oxsecurity/megalinter/blob/v8.5.0/megalinter/descriptors/editorconfig.megalinter-descriptor.yml#L20

To Reproduce
Steps to reproduce the behavior:

  1. Do not set any env var EDITORCONFIG_EDITORCONFIG_CHECKER_CONFIG_FILE or entry into your .mega-linter.yml config file (to take LINTER_DEFAULT behaviour)
  2. Rename old EDITORCONFIG_CHECKER config file from .ecrc to .editorconfig-checker.json
  3. Run MegaLinter with at least EDITORCONFIG_CHECKER enabled on a project source file
  4. See errors found
  5. While expected behaviour is to see no error (no regression)

Additional context
For example with one of my project, I've file exclusions defined (https://github.com/llaville/php-compatinfo-db/blob/master/.github/linters/.ecrc#L7)

Before renaming EC config file, I got such kind of output

[editorconfig-checker] command: ['editorconfig-checker', '-config', '/tmp/lint/.github/linters/.ecrc']
[editorconfig-checker] CWD: /tmp/lint
[editorconfig-checker] result: 0 The default configuration file name `.ecrc` is deprecated. Use `.editorconfig-checker.json` instead. You can simply rename it
Config: 
Exclude Regexp: \.idea|\.editorconfig|\.github|LICENSE|vendor|mkdocs\.yml|\.changes|phpunit\.xml|\.git[\/]|[\/]node_modules[\/]|^\.yarn/|^yarn\.lock$|^package-lock\.json$|^composer\.lock$|^Cargo\.lock$|^Gemfile\.lock$|^\.pnp\.cjs$|^\.pnp\.js$|^\.pnp\.loader\.mjs$|\.snap$|\.otf$|\.woff$|\.woff2$|\.eot$|\.ttf$|\.gif$|\.png$|\.jpg$|\.jpeg$|\.webp$|\.avif$|\.pnm$|\.pbm$|\.pgm$|\.ppm$|\.mp4$|\.wmv$|\.svg$|\.ico$|\.bak$|\.bin$|\.pdf$|\.zip$|\.gz$|\.tar$|\.7z$|\.bz2$|\.log$|\.patch$|\.css\.map$|\.js\.map$|min\.css$|min\.js$

✅ Linted [EDITORCONFIG] files with [editorconfig-checker] successfully - (7.01s)
- Using [editorconfig-checker v3.2.1] https://megalinter.io/8.5.0/descriptors/editorconfig_editorconfig_checker
- MegaLinter key: [EDITORCONFIG_EDITORCONFIG_CHECKER]
- Rules config: [/.github/linters/.ecrc]
- Command: [editorconfig-checker -config /tmp/lint/.github/linters/.ecrc]

After renaming EC config file, I got :

❌ Linted [EDITORCONFIG] files with [editorconfig-checker]: Found 1 error(s) and 0 warning(s) - (7.32s)
- Using [editorconfig-checker v3.2.1] https://megalinter.io/8.5.0/descriptors/editorconfig_editorconfig_checker
- MegaLinter key: [EDITORCONFIG_EDITORCONFIG_CHECKER]
- Rules config: identified by [editorconfig-checker]
- Command: [editorconfig-checker]
--Error detail:
LICENSE:
	8: Wrong amount of left-padding spaces(want multiple of 4)
	11-12: Wrong amount of left-padding spaces(want multiple of 4)
	15-16: Wrong amount of left-padding spaces(want multiple of 4)
mkdocs.yml:
	34-41: Wrong amount of left-padding spaces(want multiple of 4)

4 errors found

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions