Regular expression fix for PHP CS Fixer version#4611
Conversation
|
/build
|
328e159 to
6234b31
Compare
🦙 MegaLinter status:
|
| Descriptor | Linter | Files | Fixed | Errors | Elapsed time |
|---|---|---|---|---|---|
| ✅ API | spectral | 1 | 0 | 1.67s | |
| bash-exec | 6 | 1 | 0.02s | ||
| ✅ BASH | shellcheck | 6 | 0 | 0.21s | |
| ✅ BASH | shfmt | 6 | 0 | 0 | 0.94s |
| ✅ COPYPASTE | jscpd | yes | no | 2.88s | |
| ✅ DOCKERFILE | hadolint | 129 | 0 | 25.8s | |
| ✅ JSON | jsonlint | 20 | 0 | 0.4s | |
| ✅ JSON | v8r | 22 | 0 | 15.61s | |
| markdownlint | 267 | 0 | 302 | 23.04s | |
| ✅ MARKDOWN | markdown-table-formatter | 267 | 0 | 0 | 161.72s |
| bandit | 215 | 66 | 3.45s | ||
| ✅ PYTHON | black | 215 | 0 | 0 | 4.73s |
| ✅ PYTHON | flake8 | 215 | 0 | 2.31s | |
| ✅ PYTHON | isort | 215 | 0 | 0 | 1.42s |
| ✅ PYTHON | mypy | 215 | 0 | 17.25s | |
| ✅ PYTHON | pylint | 215 | 0 | 35.12s | |
| ✅ PYTHON | ruff | 215 | 0 | 0 | 0.55s |
| ✅ REPOSITORY | checkov | yes | no | 37.15s | |
| ✅ REPOSITORY | git_diff | yes | no | 1.09s | |
| grype | yes | 24 | 13.91s | ||
| ✅ REPOSITORY | secretlint | yes | no | 12.58s | |
| ✅ REPOSITORY | trivy | yes | no | 15.79s | |
| ✅ REPOSITORY | trivy-sbom | yes | no | 0.27s | |
| trufflehog | yes | 1 | 53.79s | ||
| ✅ SPELL | cspell | 718 | 0 | 12.56s | |
| lychee | 349 | 27 | 5.31s | ||
| ✅ XML | xmllint | 3 | 0 | 0 | 0.88s |
| ✅ YAML | prettier | 160 | 0 | 0 | 4.16s |
| ✅ YAML | v8r | 102 | 0 | 30.43s | |
| ✅ YAML | yamllint | 161 | 0 | 3.32s |
See detailed report in MegaLinter reports
🦙 MegaLinter status:
|
| Descriptor | Linter | Files | Fixed | Errors | Elapsed time |
|---|---|---|---|---|---|
| ✅ API | spectral | 1 | 0 | 1.73s | |
| bash-exec | 6 | 1 | 0.02s | ||
| ✅ BASH | shellcheck | 6 | 0 | 0.18s | |
| ✅ BASH | shfmt | 6 | 0 | 0 | 0.83s |
| ✅ COPYPASTE | jscpd | yes | no | 2.9s | |
| ✅ DOCKERFILE | hadolint | 129 | 0 | 24.99s | |
| ✅ JSON | jsonlint | 20 | 0 | 0.2s | |
| ✅ JSON | v8r | 22 | 0 | 14.99s | |
| markdownlint | 267 | 0 | 302 | 21.39s | |
| ✅ MARKDOWN | markdown-table-formatter | 267 | 0 | 0 | 164.44s |
| bandit | 215 | 66 | 3.87s | ||
| ✅ PYTHON | black | 215 | 0 | 0 | 4.37s |
| ✅ PYTHON | flake8 | 215 | 0 | 2.33s | |
| ✅ PYTHON | isort | 215 | 0 | 0 | 1.44s |
| ✅ PYTHON | mypy | 215 | 0 | 15.38s | |
| ✅ PYTHON | pylint | 215 | 0 | 28.91s | |
| ✅ PYTHON | ruff | 215 | 0 | 0 | 0.85s |
| ✅ REPOSITORY | checkov | yes | no | 33.6s | |
| ✅ REPOSITORY | git_diff | yes | no | 0.83s | |
| grype | yes | 24 | 14.44s | ||
| ✅ REPOSITORY | secretlint | yes | no | 11.43s | |
| ✅ REPOSITORY | trivy | yes | no | 18.35s | |
| ✅ REPOSITORY | trivy-sbom | yes | no | 0.29s | |
| trufflehog | yes | 1 | 54.07s | ||
| ✅ SPELL | cspell | 718 | 0 | 13.26s | |
| lychee | 349 | 27 | 25.06s | ||
| ✅ XML | xmllint | 3 | 0 | 0 | 0.94s |
| ✅ YAML | prettier | 160 | 0 | 0 | 3.62s |
| ✅ YAML | v8r | 102 | 0 | 25.65s | |
| ✅ YAML | yamllint | 161 | 0 | 2.52s |
See detailed report in MegaLinter reports
|
It seems your regex doesn't work with PHP CS Fixer 3.68.3 Persian Successor by Fabien Potencier, Dariusz Ruminski and contributors. maybe the colors in the output ? |
If so, can you call the version with no colors to help you out? |
|
Ok error came from colors ouput. I confirmed because I've disabled it locally on a slim linter php-cs-fixer linter only and run tests with NO_COLOR=true (https://no-color.org/) env var supported by this linter. Now, the ultimate question is : how to disable it only for getting version number but keep color output for linter results ? |
|
There's a way to set either arguments, extra arguments, or even the executable to execute for getting the version. So, with that, set it to send the env var inline before calling the tool, I think it would work |
|
Or you adapt the regex to support/ignore the color.. if there's a general way, it could apply to the whole Megalinter, to ignore ANSI escape codes |
If there is a solution, I'm glad to hear it ! |
|
Ok I think I got the solution, I'm on way to test it ... |
|
Patch is : And result by image : |
|
Ready for code review (acceptance) ! |
nvuillam
left a comment
There was a problem hiding this comment.
We could have found a way without addint a variable for all linters but... It's good enough for me, thanks for the PR :)


Fixes #4610
Proposed Changes
Readiness Checklist
Author/Contributor
Reviewing Maintainer
breakingif this is a large fundamental changeautomation,bug,documentation,enhancement,infrastructure, orperformance