Closed Andrew-Sheridan closed 2 years ago
Thanks a lot for your interest and support :)
Such behaviour is indeed strange...
Please can you try to run your pipeline with LOG_LEVEL:DEBUG in your .mega-linter.yml file or ENV var , so we can see how exactly is called cspell with your configuration ?
With debug enabled these are the logs:
Edit: This run had the mkdir
command included so it didnt fail while writing to the report dir.
Hmm I noticed this in the logs, not sure if it is related:
2022-04-09T16:00:05.3405041Z Linter version command: ['/usr/bin/npm', 'list', 'eslint-plugin-jsonc']
2022-04-09T16:00:06.0328973Z Linter version result: 1 /github/workspace
2022-04-09T16:00:06.0329839Z βββ (empty)
2022-04-09T16:00:06.0330030Z
2022-04-09T16:00:06.0330037Z
2022-04-09T16:00:06.0330357Z Unable to get version for linter [eslint-plugin-jsonc]
2022-04-09T16:00:06.0330979Z /usr/bin/npm list eslint-plugin-jsonc returned output: (1) /github/workspace
2022-04-09T16:00:06.0331484Z βββ (empty)
2022-04-09T16:00:06.0331884Z
2022-04-09T16:00:06.0331890Z
2022-04-09T16:00:06.0332288Z Unable to extract version with regex re.compile('\\d+(\\.\\d+)+') from ERROR
Looks similar to https://github.com/megalinter/megalinter/issues/845
Such error in not related :)
It seems that you proposition with os.makedirs would do the job, would you like to make a pull request ? :)
Sure, I can make that PR.
Iβm not sure it will resolve the first issue - cspell does not appear to be respecting the config. All the files it found errors in are ignored in the config. If the config is at the default location the files are correctly ignored.
As you can see in the log, your config file is called ... maybe it's a cspell issue , something like it does not understand absolute paths in -c argument ?
2022-04-09T16:00:04.8382432Z [cspell] command: ['cspell', '-c', '/github/workspace/.github/linters/cspell.json', '/github/workspace/.github/linters/cspell.json', '/github/workspace/.github/workflows/lint-megalinter-all.yaml', '/github/workspace/.github/workflows/lint-megalinter-documentation.yaml', '/github/workspace/.github/workflows/lint-megalinter-java.yaml', '/github/workspace/.github/workflows/lint-megalinter-python.yaml'] 2022-04-09T16:00:04.8393820Z [cspell] CWD: /github/workspace
Hmmm.
I think I will play around with the cspell cli locally and open an issue upstream at https://github.com/streetsidesoftware/cspell if I need to.
edit: oh yeah both @Andrew-Sheridan and @andrewasheridan are me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale π€
label or comment on the issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale π€
label or comment on the issue.
I had to put this in the mega linter config -
# Excludes cspell file itself
SPELL_MISSPELL_FILTER_REGEX_EXCLUDE: cspell.
So that it will ignore all types of cspell config files, because the linter reported errors in the config itself. (My cspell config is in the root of the directory)
Do you have a lot of banned words in your configs? Misspell tends to lean heavily towards avoiding false positives, so I am slightly surprised you had to filter out the CSpell config.
This is my config
And no I do not have lot of banned words as per verbal english usage.
But I do have 71 words which are correct in the context of the project.
I found out the actual cause btw - there is Ther
word in cspell config, which misspell was correcting it to There
Due to which cspell reported Ther
as a misspell while scanning.
I saw that misspell linter executed before cspell
By this I come to a realisation that in my situation config is loading properly, but I had entirely different issue. And my issue is not relevant with this issue. Sorry my bad π
Thanks for the great tool - we have been integrating megalinter to our pipelines have found it to be quite nice :)
During our initial configuration we have encountered some mild troubles with
cspell
.To reduce the number of top-level files we store linter configs in
.github/linters/
and so the cspell config is at.github/linters/cspell.json
This causes two issues:
If we have
SPELL_CSPELL_CONFIG_FILE: .github/linters/cspell.json
then we see this in the logs:which looks great except it is followed by content that shows the config is not respected.
If we move the file to the top of the repo and adjust
SPELL_CSPELL_CONFIG_FILE
accordingly, the rules are followed and no errors / warnings are reported.If we add a step to create those dirs under
report
before running megalinter, then it does not fail.The issue might be in this block:
https://github.com/megalinter/megalinter/blob/73c41ea0e18d4bbc4f8eff9ecdfc0040cfe8ad52/megalinter/linters/CSpellLinter.py#L77-L83
which may be alleviated by including a mkdir call:
Note: We use the same location for the yaml
prettier
andyamllint
configs and they do not appear to face these issues.Our cspell config:
Thank you!