-
Notifications
You must be signed in to change notification settings - Fork 696
Description
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:
- Commit
psalm.xml.distand .gitignorepsalm.xml. Developers working on a project would have to copypsalm.xml.disttopsalm.xmland add their path mapping there. Pros: easy to understand, familiar approach used by many tools. Cons: developers would have to update theirpsalm.xmlwhen upstreampsalm.xml.distchanges. - Commit
psalm.xmlthat uses XInclude to include file containing path mapping. The<xi:include>would have to have<xi:fallback>element to prevent errors in CI (where local project mapping file is absent). The mapping file would have to be .gitignored. Pros: developers don't need to update their config. Cons: setup is a bit more complicated.
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 #6850 (comment)