I have a project in PHPStorm, which contains a few libraries (Zend, Doctrine, ...) grouped under a library
folder.
When running the code inspection, I do want the PHP code in these folders to be analysed (so that PHPStorm will know how Zend_Form
is declared, for example).
However, I do not want the issues found in these folders to be reported, as they are out of my control.
The only workaround I've found so far is to mark the directories as "Test source", and uncheck the "Include test sources" box in the code inspection window. Needless to say that this is not the best solution!
You can also just right click on your folder and select Mark Directory As > Excluded . Excluded folders (shown as rootExcluded) are ones that IntelliJ IDEA "partially ignores".
If the project is a Web Site, Visual Studio excludes a file from the project by adding an extension ". exclude" to mark it as excluded. So all files will the extension ". exclude" will not be used in the project. ".
PyCharm allows you to exclude directories from consideration when searching and refactoring. You can exclude a directory by right-clicking on it and selecting Mark Directory as → Excluded.
Navigate to the file/folder you want to exclude. Right Click -> Resource -> Exclude from build.
If you just need to disable inspections on one or two files, you can disable it at the file level easily:
(Using PHPStorm 8.0.2)
Please refer to the Scopes feature. You can define a custom scope for just your code, without the library folder, then run inspections on this scope only.
In the Inspections settings it's also possible to add the scopes and enable/disable each inspection per scope.
If you need to completely exclude few files from any analyse (for example a compiled php file) like it not even exist, you can right click on file in source tree and select "Mark as Plain Text". This action totally remove any inspections on this file. With this I removed a lot of notifications about "source duplications" in Laravel 5.
If you need to activate it again - once more right click and "Mark as PHP".
This works nice for a few files. If you need to exclude whole directory with everything inside, use directory marking from settings or right click on directory and "Mark Directory As -> Excluded".
There is alternative solution. You can add «read-only» libraries to Include path
in Settings » PHP
section.
It is not the same with php.ini include_path
option, just referencing to some dirs as external, outside of your control. Exactly what you need.
As result
If you want to totally exclude a file or folder from completion and code help:
Right click the folder or file in your file browser (left handed) choose "Mark"-> "excluded"
That's what I wanted, I add that answer here because I found this question in Google when looking for an answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With