Reputation: 105449
Official documentation of PhpStorm
states that:
All the settings files in the .idea directory should be put under version control except the workspace.xml, which stores your local preferences. The workspace.xml file should be marked as ignored by VCS.
Can you please tell me what is the reason for this?
Upvotes: 2
Views: 748
Reputation: 111
I've been proponent of keeping repo's lean for a decade or so, but this is increasingly hard to justify in teams with less experienced devs.
From maintainers perspective, it is pretty annoying to receive merge request with hundred line diffs because dev did not adhere to project coding style and has Editor/IDE configured to use tab instead of a space for indentation. Now every file dev touches produces useless changes in repo. This is partially mitigated by .editorconfig but then again, there is that time when IDE is not configured to read .editorconfig, or it lacks the support for this standard.
There are million other things that IDEs do besides indentation style, since we are talking PhpStorm here: like trailing comas, multiline array structure, line width even arrangement of methods within a class - and many more items that produce useless diffs. Blissfully ignorant devs have all this configured to run on file save.
Note that I am not talking about catching these issues, catching is easy via merge request review or pipeline linting. Problem is new devs onboarding experience and time it takes for maintainer to get dev up to speed. And yes for most things in php world we can slap in a nice .phpcs.xml
file and call it a day, but then again local env needs to be configured properly to do this type of linting.
Based on this experience, I think it's a better approach to have common-language-specific IDE configuration tracked in the repo. New dev just needs to open the project and everything is configured properly by a maintainer.
Problem here obviously is that IDEs are guilty of not keeping their config files clean of env specific paths. But in case of PhpStorm I think it has come a long way in this regard.
So to answer your question. Yes, sometimes it makes sense to keep it in VCS, sometimes it doesn't. While general rules are great for the most part, they fail in gray areas.
Upvotes: 1
Reputation: 10467
This is more of an opinion rather than answer, but you shouldn't put any of your workspace-related files into the repository. Every developer has his own configurations, application and server stack and I don't need to know that you're using NetBeans (.nbproject directory) and you don't need to know that I'm using PHPStorm (.idea). Repository should contain only project-related files, eg.:
and so on.
Upvotes: 5