How do I inspect my code with exceptions based on file pattern
Answered
Hi,
I want to inspect my code using some patterns, but that GUI "custom scope" is not intuitve at all, I don't understand if it's a regex or what it is.
So what should I put in the "Exclude patter" field to exclude tests and maybe examples. I want to exclude all files that contain the substring "test" and maybe substring "example". But I really want to exclude "test" substring.
Thanks
Please sign in to leave a comment.
Hi Taw,
Creating a custom scope is the way to go. For more information on how to do it, see the following help pages:
In your case, the pattern will be:
Thanks a lot @..., now I have learn another synthax language to use JetBrains tools? :))))
I am glad that you give me an example to copy paste.:)
So I shouldn't press the Exclude button, because it's not needed, isn't it?
No problem Taw Moto
Pressing Include/Exclude buttons allows you to append the corresponding syntax to the pattern string per each item selected in the tree preview.
See example below. I selected the test_java.iml file, pressed Exclude, and a chunk of syntax was added to the pattern string automatically:
Oh, I see now, but this `Exclude` button only excludes one file, it does not excludes a pattern, so I still to add the pattern you mentioned.
Thanks a lot @... (btw, beautiful name, I never heard it before), you really helped me, the tutorial is awful:
https://www.jetbrains.com/help/idea/scope-language-syntax-reference.html
I also gave a feedback there that it's not helpful at all, only one example for the "exclude"?
file:*.js||file:*.coffee- include all JavaScript and CoffeeScript files. -> so it's an OR (||) operator but in fact means AND (&&). Wow...Btw, do you know by any chance if this pattern is saved if I update my IntelliJ product? Or if I export the settings and import them into a clean IntelliJ product? thanks
Happy to help Taw Moto. Thanks for the compliment.
Yes, correct.
The logical OR operator returns true if one or more operands is true.
I agree though, the tutorial probably needs some revamping. Leaving feedback was the right move.
Custom scope settings are stored in the .idea configuration directory inside each project in the form of a <component> record in the workspace.xml file:
Custom scopes are not part of the 'Export Settings' feature, but project configuration stays intact when you update the IDE, so the pattern will be saved.