New Linter : PHP-CS-Fixer
Is your feature request related to a problem? Please describe. It's not a problem, and we may consider it as an improvement to PHP linters
Describe the solution you'd like Add first integration of the official https://github.com/PHP-CS-Fixer/PHP-CS-Fixer tool to automatically check/fix PHP Coding Standards issues
Describe alternatives you've considered It's an alternative to PHP_CodeSniffer
Additional context
Actually, I've already worked on a SARIF support (and my converter PhpCsFixerConverter for bartlett/sarif-php-sdk : https://github.com/llaville/sarif-php-sdk is ready)
Pre-conditions :
- apply first PR to solve https://github.com/oxsecurity/megalinter/issues/3515 (need to be upgrade a little)
- hope that PHP-CS-Fixer maintainers will accept my proposal https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/discussions/7995 otherwise SARIF won't be supported by this new linter.
Here is a preview of such integration to MegaLinter
#3515 doesn't appear like a PR for me
@echoix Of course, because I'm not opened a PR yet. I wanted to keep it under test, especially due to this new linter, to see if I've missed something. But, as it is not the case, I'll open a PR tomorrow.
I'm sad but I must admit that the SARIF support to PHP-CS-Fixer won't be for tomorrow (next days and/or months).
BTW, I should at least propose a new PHP linter (following official project in current version 3.56 or greater)
I think it's a shame not to be able to use the autofix feature for PHP Linters.
So, even if PHP-CS-Fixer new linter is ready, I'm still working to be able to use the APPLY_FIXES with at least PHP_PHPCSFIXER
First run that seems matched
At least PHP-CS-Fixer do its job, and the fix was applied, but the UPDATED_SOURCES_REPORTER said the opposite !
~@nvuillam Do you prefer to have a separate PR for PHP linter autofix ? or may I include in the upcoming PR for adding this new linter ?~
Finally, I've choosen to prepare a PR without autofix feature fix for this linter
@nvuillam I need your help to finish this linter. Following https://megalinter.io/latest/contributing/#add-a-new-linter I don't know what is missing !
see chunk of deployment/test workflow
=========================== short test summary info ============================
FAILED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_success
===== 1 failed, 594 passed, 336 skipped, 48 warnings in 614.33s (0:10:14) ======
Pytest exited 1
Test automation failed, but runtime is correct for me.
@llaville it seems that phpcs fixer does not accept to find non fixable errors
❌ Linted [PHP] files with [php-cs-fixer]: Found 1 error(s) - (0.16s) (expand for details)
- Using [php-cs-fixer v3.56.1] https://megalinter.io/features-php-cs-fixer/descriptors/php_php_cs_fixer
- MegaLinter key: [PHP_PHPCSFIXER]
- Rules config: [.php-cs-fixer.dist.php]
--Error detail:
PHP CS Fixer 3.56.1 15 Keys Accelerate by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.7
Loaded config default from "/action/lib/.automation/.php-cs-fixer.dist.php".
Using cache file ".php-cs-fixer.cache".
Found 0 of 5 files that can be fixed in 0.001 seconds, 14.000 MB memory used
Files that were not fixed due to errors reported during linting before fixing:
1) ./php_bad_2.php
2) ./php_bad_1.php
If the test files do not fit, you can create another test directory and redirect tests to it using descriptor property test_folder :)
@nvuillam After trying your tip, and see that it won't fix anything (sorry to said that), I've spent my time to track down where it came from.
So I've look deeper into MegaLinter to see how test are run with pytest, and see that :
- https://github.com/oxsecurity/megalinter/blob/v7.11.1/megalinter/utilstest.py#L181
And PHP-CS-Fixer in in same context
After applying patch below
diff --git a/megalinter/utilstest.py b/megalinter/utilstest.py
index 011c01c34d..7d6e2ad5aa 100644
--- a/megalinter/utilstest.py
+++ b/megalinter/utilstest.py
@@ -186,7 +186,7 @@ def test_linter_success(linter, test_self):
)
else:
test_self.assertRegex(output, rf"\[{linter_name}\] .*good.* - SUCCESS")
- elif linter.descriptor_id != "SPELL": # This log doesn't appear in SPELL linters
+ elif linter.descriptor_id != "SPELL" or linter.linter_name != "php-cs-fixer": # This log doesn't appear in SPELL linters
test_self.assertRegex(
output,
rf"Linted \[{linter.descriptor_id}\] files with \[{linter_name}\] successfully",
I've rebuild the PHP flavor image, and run test again, in official megalinter/.automation/test/php directory
docker run -e TEST_CASE_RUN=true -e TEST_KEYWORDS="php_phpcsfixer" -e OUTPUT_FORMAT=text -e OUTPUT_DETAIL=detailed -e MEGALINTER_VOLUME_ROOT="." --rm -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v .:/tmp/lint 84d5825f0e277f834d6b5db15ffa392eb10a50cd97848a6fcd69449f463f4bac
And got expected results :
============================== slowest durations ===============================
1.74s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
0.71s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_success
0.11s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_help
0.10s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_version
0.02s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_format_fix
0.02s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_tap
0.02s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_sarif
(14 durations < 0.005s hidden. Use -vv to show these durations.)
=================== 4 passed, 3 skipped, 6 warnings in 6.63s ===================
Pytest exited 0
Successfully executed Pytest
So I think we should think about a better fix than this quick one (even if it works fine) ! WDTY ?
@nvuillam can you reply to @llaville to unlock this PR? I am also interested in this linter.
@bdovaz There is no more hurry now. I'll be slow to respond in next days because I'll have a slow internet connection !
I'm a little bit lost ^^ How can I help ? ^^
@nvuillam You can help, either :
- by replying to my comment (https://github.com/oxsecurity/megalinter/issues/3550#issuecomment-2119666471) on quick patch
- or suggest a new approach and better fix !
Because PHP-CS-Fixer run ok except for unit tests !
@llaville I'm not proud to say ok, but... ok :D The issue appears when multiple linters have the same beginning of name... I didn't find a clean way to solve that yet, so go with the workaround as I plan to release a new minor version this week-end :)
Will have to wait I return to my home with a better internet connection. I'm very limited now :(
@llaville do you think it would be ok this week-end when I may release a new version ? ^^
@nvuillam no sorry, make your release without it !
no soucy , do it when you can :)
@nvuillam I've finally a good new ! I've fixed my mobile internet connection, and I should be able to prepare a PR today
Great news :)
I'm on way to prepare a PR. Just testing PHP flavor rebuilt with current branch rebased with main
Consider the PR 3598 as a preview ! I don't like the quick fix https://github.com/oxsecurity/megalinter/commit/db504eddb0b0f73a49b5bb33f4271e391cb0da1b but at least unit tests PASSED (locally ... wait for CI results now)
At all ML team / PR reviewers 👍 I don't know why PR 3598 failed with https://github.com/oxsecurity/megalinter/actions/runs/9336179113/job/25696423707?pr=3598#step:11:3801
With same code when I build the PHP flavor and run locally
docker run -e TEST_CASE_RUN=true -e TEST_KEYWORDS="php_phpcsfixer" -e OUTPUT_FORMAT=text -e OUTPUT_DETAIL=detailed -e MEGALINTER_VOLUME_ROOT="." --rm -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v .:/tmp/lint <IMAGE_DOCKER_ID>
I got following results
Skipped setting git safe.directory DEFAULT_WORKSPACE: ...
Setting git safe.directory default: /github/workspace ...
Setting git safe.directory to /tmp/lint ...
[MegaLinter init] RUNNING TEST CASES
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/chardet-5.2.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/requests_oauthlib-2.0.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/zipp-3.19.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/python_dateutil-2.9.0.post0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/regex-2024.5.15-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/importlib_metadata-7.1.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/PyNaCl-1.5.0-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/python_gitlab-4.6.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/lark_parser-0.7.8-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/six-1.16.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/typing_extensions-4.12.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/GitPython-3.1.43-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/PyJWT-2.8.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/PyYAML-6.0.1-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/multiprocessing_logging-0.3.4-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/pytablewriter-1.2.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/gitdb-4.0.11-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/DataProperty-1.0.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/commentjson-0.9.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/smmap-5.0.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/urllib3-2.2.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/Deprecated-1.2.14-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/charset_normalizer-3.3.2-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/requests-2.32.3-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/tabledata-1.3.3-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/msrest-0.6.21-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/tcolorpy-0.1.6-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/cffi-1.17.0rc1-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/terminaltables-3.1.10-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/oauthlib-3.2.2-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/PyGithub-2.3.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/jsonpickle-3.0.4-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/pytz-2024.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/mbstrdecoder-1.1.3-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/pathvalidate-3.2.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/pycparser-2.22-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/typepy-1.3.2-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/redis-5.1.0b5-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/azure_devops-6.0.0b4-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/certifi-2024.6.2-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/isodate-0.6.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/idna-3.7-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/pychalk-2.0.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/requests_toolbelt-1.0.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/cryptography-42.0.7-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/wrapt-1.16.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/megalinter-0.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
DEPRECATION: Loading egg at /usr/local/lib/python3.12/site-packages/packaging-24.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
Collecting pytest-cov
Downloading pytest_cov-5.0.0-py3-none-any.whl.metadata (27 kB)
Collecting pytest-timeout
Downloading pytest_timeout-2.3.1-py3-none-any.whl.metadata (20 kB)
Collecting pytest-xdist
Downloading pytest_xdist-3.6.1-py3-none-any.whl.metadata (4.3 kB)
Collecting pytest>=4.6 (from pytest-cov)
Downloading pytest-8.2.1-py3-none-any.whl.metadata (7.6 kB)
Collecting coverage>=5.2.1 (from coverage[toml]>=5.2.1->pytest-cov)
Downloading coverage-7.5.3-cp312-cp312-musllinux_1_1_x86_64.whl.metadata (8.2 kB)
Collecting execnet>=2.1 (from pytest-xdist)
Downloading execnet-2.1.1-py3-none-any.whl.metadata (2.9 kB)
Collecting iniconfig (from pytest>=4.6->pytest-cov)
Downloading iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Requirement already satisfied: packaging in /usr/local/lib/python3.12/site-packages/packaging-24.0-py3.12.egg (from pytest>=4.6->pytest-cov) (24.0)
Collecting pluggy<2.0,>=1.5 (from pytest>=4.6->pytest-cov)
Downloading pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Downloading pytest_cov-5.0.0-py3-none-any.whl (21 kB)
Downloading pytest_timeout-2.3.1-py3-none-any.whl (14 kB)
Downloading pytest_xdist-3.6.1-py3-none-any.whl (46 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.1/46.1 kB 1.3 MB/s eta 0:00:00
Downloading coverage-7.5.3-cp312-cp312-musllinux_1_1_x86_64.whl (242 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 242.9/242.9 kB 2.6 MB/s eta 0:00:00
Downloading execnet-2.1.1-py3-none-any.whl (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.6/40.6 kB 1.2 MB/s eta 0:00:00
Downloading pytest-8.2.1-py3-none-any.whl (339 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 339.6/339.6 kB 4.2 MB/s eta 0:00:00
Downloading pluggy-1.5.0-py3-none-any.whl (20 kB)
Downloading iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Installing collected packages: pluggy, iniconfig, execnet, coverage, pytest, pytest-xdist, pytest-timeout, pytest-cov
Successfully installed coverage-7.5.3 execnet-2.1.1 iniconfig-2.0.0 pluggy-1.5.0 pytest-8.2.1 pytest-cov-5.0.0 pytest-timeout-2.3.1 pytest-xdist-3.6.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.2.1, pluggy-1.5.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /megalinter
plugins: cov-5.0.0, xdist-3.6.1, timeout-2.3.1
timeout: 300.0s
timeout method: signal
timeout func_only: False
created: 12/12 workers
12 workers [7 items]
scheduling tests via LoadScopeScheduling
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
[gw0] [ 14%] PASSED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_format_fix
[gw0] [ 28%] SKIPPED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_format_fix
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_help
[gw0] [ 42%] PASSED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_help
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_version
[gw0] [ 57%] PASSED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_version
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_sarif
[gw0] [ 71%] SKIPPED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_sarif
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_tap
[gw0] [ 85%] SKIPPED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_tap
megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_success
[gw0] [100%] PASSED megalinter/tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_success
=============================== warnings summary ===============================
tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
/usr/local/lib/python3.12/site-packages/lark_parser-0.7.8-py3.12.egg/lark/utils.py:171: DeprecationWarning: module 'sre_parse' is deprecated
import sre_parse
tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
/usr/local/lib/python3.12/site-packages/lark_parser-0.7.8-py3.12.egg/lark/utils.py:172: DeprecationWarning: module 'sre_constants' is deprecated
import sre_constants
tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
/usr/local/lib/python3.12/site-packages/azure_devops-6.0.0b4-py3.12.egg/azure/__init__.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
/usr/local/lib/python3.12/site-packages/azure_devops-6.0.0b4-py3.12.egg/azure/__init__.py:6: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('azure')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
/usr/local/lib/python3.12/site-packages/azure_devops-6.0.0b4-py3.12.egg/azure/devops/__init__.py:6: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('azure.devops')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py:2317: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('azure')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(parent)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================== slowest durations ===============================
4.58s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_failure
0.71s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_success
0.18s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_help
0.15s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_get_linter_version
0.03s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_format_fix
0.02s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_sarif
0.02s call tests/test_megalinter/linters/php_phpcsfixer_test.py::php_phpcsfixer_test::test_report_tap
(14 durations < 0.005s hidden. Use -vv to show these durations.)
================== 4 passed, 3 skipped, 6 warnings in 12.77s ===================
Pytest exited 0
Successfully executed Pytest
FYI: at all ML team. Thanks @nvuillam for packaging and fixing unit tests !
I've just tested the new version 7.12.0 (Docker PHP Flavor: oxsecurity/megalinter-php:v7)
----------------------------------------------------------------------------------------------------
- Image Creation Date: 2024-06-02T14:58:40Z
- Image Revision: 5199c6377b4cb7faff749a1971636f3343db9fe6
- Image Version: v7.12.0
----------------------------------------------------------------------------------------------------
All seems OK for me on SARIF reports and new PHP-CS-Fixer, by activated following configuration :
SARIF_REPORTER: true
SARIF_REPORTER_LINTERS:
- PHP_PHPCS
- PHP_PHPSTAN
- PHP_PHPLINT