-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong behaviour of PSALM inside docker #3449
Comments
@nvuillam it occurs to me that the problem may come from the fact that I use the psalm.xml config file to include/exclude files and Megalinter sends "other files" (computed by Megalinter with its filters) directly through the command line and this may be creating a behavior that makes it ignore the files I pass it in the config file? And if so, how can I "trick" Megalinter not to pass any file through the command line and just use the config file? Or is this use case not possible at Megalinter core level and it is necessary to create a specific variable for this linter? |
@bdovaz what about using If you think it should be a standard behaviour, what about implementing "on the fly" filter in a PsalmLinter.py ? |
@nvuillam have you read my second comment? Read it first please. And check the repro project if you can. |
@bdovaz sorry I read too fast :) If you don't want to use the list of files, you can call the linter in project mode by defining |
@nvuillam still errors, something is happening that prevents it from working in the same way as running it from outside the container... Can you give me a hand? I'm running out of ideas... The zip that I attach in the first post is very easy to run |
@nvuillam I don't use it either nor do I have much idea but I use it "thanks to a nextcloud app".... Anyway I thought you were at least going to download the repro project that I've bothered to create and that is easy to run and check 😅 |
@bdovaz I did :D Then I saw it requires PHP,composer.... and I'm already drowning in my tasks so I prefer to pass the relay ^^ |
Hello, First this "issue" is not related to Psalm. Checks it now ! With this ---
LOG_LEVEL: DEBUG
ENABLE_LINTERS:
- PHP_PSALM
- PHP_PHPLINT
PHP_PSALM_CLI_LINT_MODE: project
PHP_PSALM_ARGUMENTS: --no-cache
PHP_PHPLINT_CLI_LINT_MODE: project
PHP_PHPLINT_ARGUMENTS: "--no-cache -vvv" With this path: .
jobs: 5
extensions:
- php
exclude:
- vendor
warning: false NB: I've specified to exclude
Now, when I run the command : I got these chunks of report (not fully listed here : too big)
Conclusion: The PHPLint parse only one file into I think it's a false true issue ! WDTY about this checks ? |
|
Here are operations I did :
original ML report when FILTER_REGEX_EXCLUDE is defined in .mega-linter.yml
ML report when FILTER_REGEX_EXCLUDE is NOT defined in .mega-linter.yml
Both runs are executed on project mode and Psalm gave an OK result. Hope my second explain are more clear. PS: I've tried with PHPLint v9 that I know well (I'm author of this version) to compare behaviours. |
@llaville are you sure that's all you've done?
Because the only different thing you have done different from my repro project is to change that instead of running the default image it runs the specific php flavor (which I have also tried) and I still get 2 errors. |
Yes of course. You've probably forgotten what is contents of the zip file you've provided. I'll let you check, especially the And if you don't see what I means I'll recommend to read official doc : https://psalm.dev/docs/running_psalm/configuration/#extrafiles If you remove this section <extraFiles>
<directory name="app/vendor"/>
<ignoreFiles>
<directory name="app/vendor/psalm"/>
</ignoreFiles>
</extraFiles> Of course I get the same two errors as you ! |
@llaville obviously I was telling you because I have not touched the xml file of the zip file, I followed the same 2 steps (unzip and run docker with php flavor like you) that you mentioned but in my case I get those 2 errors and I do not understand why. I've tried it on 2 different computers although in theory the advantage of Docker is precisely the portability and that is why it should work the same as you but for some reason it does not. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
@llaville I still have this problem, can you attach in a zip file the repro project that works? I'm going crazy about why it works for you and not for me, we must have something different. Thanks! |
@bdovaz Hello. I'm sorry to tell you, but I've re-try again with MegaLinter 7.11.1, and got always the same results. Here are what I've done, step by step :
wget https://github.com/oxsecurity/megalinter/files/14839056/reproProject.zip
unzip reproProject.zip -d reproProject/
cd reproProject
sudo rm -rf megalinter-reports/ && time docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:rw -v $(pwd):/tmp/lint:rw oxsecurity/megalinter-php:v7 And got results
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
is the problem still here with latest release ? |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Describe the bug
If I run it locally, it works correctly but through Megalinter it only works if I don't ignore the vendor folder.
To Reproduce
test_local.ps1
script and check that there are no issues.test_docker.ps1
and check that there are errors..mega-linter.yml
file and comment theFILTER_REGEX_EXCLUDE
line.test_docker.ps1
and check that there are no issues.I obviously don't want to analyze the scripts in the vendor folder (they are from third party libraries) but I do want to include them with the psalm.xml file so that it resolves the dependencies of my code correctly.
reproProject.zip
The text was updated successfully, but these errors were encountered: