vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

Run psalm with relative config path #3992

Open vv12131415 opened 4 years ago

vv12131415 commented 4 years ago

I'm trying to move all the baselines and config files of static analysis tools to separate folder. Because of this my folder structure looks like this

src/
vendor/
static-analysis/
    phpstan/
        phpstan.neon
        phpstan-baseline.neon
    psalm/
        psalm.xml
        psalm-baseline.xml

this way I'm not bloating project root directory and I can export-ignore folder.

The problem is, when I run

./vendor/bin/psalm  --config=static-analysis/psalm/psalm.xml

I get an error that looks like this

Cannot locate ./vendor/bin/psalm

this is because cwd changes from the root of the project to the place, where config is set

vv12131415 commented 4 years ago

@psalm-github-bot nope

vv12131415 commented 4 years ago

for the context of the problem you can go here https://github.com/sonata-project/SonataAdminBundle/pull/6288#issuecomment-674423078

githoober commented 4 years ago

@vladyslavstartsev Also see https://github.com/vimeo/psalm/issues/3717

orklah commented 3 years ago

Wouldn't this be solved with https://psalm.dev/docs/running_psalm/configuration/#resolvefromconfigfile ?