vimeo / psalm

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

Link mapping between container and host machine #6919

Open weirdan opened 2 years ago

weirdan commented 2 years ago

Thinking out loud here.

This can be handled either by Psalm itself emitting host paths or terminal emulator converting paths in links to their host counterparts. The latter is outside of our control and I have doubts of its universal support anytime soon. This leaves us with the need to implement it ourselves.

The mapping is both machine and project specific: Alice may have her projects in /home/alice/src/<ProjectName> while Bob keeps them in C:\Users\Bob\Documents\<CompanyName>\<ProjectName>. Some projects will have their container paths rooted in /var/www/, some may use another prefix like /home/web. This dictates the need for what I would call local project configuration. This deviates from single, committed to git, config file Psalm currently uses. Local mapping specification would have to be .gitignore-d. There are two options currently supported by Psalm:

Neither of the options require any additional development as they are already available.

As for the configuration format, I envision something like this:

<psalm>
  <directoryMapping>
     <directory from="<absolute prefix>" to="<absolute prefix"/>
  </directoryMapping>
</psalm>

With that said, it can totally be a separate feature we may add later.

Originally posted by @weirdan in https://github.com/vimeo/psalm/issues/6850#issuecomment-962669621

psalm-github-bot[bot] commented 2 years ago

Hey @weirdan, can you reproduce the issue on https://psalm.dev ?