How to include sub-directory of path excluded from code inspection?
I added a website's files to a solution. I've excluded the website's directory from code inspection (via Settings > Editor > Inspection Settings | “Elements to Skip”). This is working as anticipated.
What I'd like to be able to do is add a specific subdirectory of the website to code inspection while keeping the rest of the website excluded. As in, if “SomeWebsite” is the root of the website, I want to add “SomeWebsite/SomeFolderA/SomeFolderB/” to inspection.
In the .DotSettings file for the solution, the website is listed as explicitly excluded via an entry like this: <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=…/@EntryIndexedValue">ExplicitlyExcluded</s:String>
I know I can go to a file within the directory I want to include, then click on the “OFF” in the top right of the file to enable code inspection for that file, which adds the following entry to the .DotSettings file: <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=…/@EntryIndexedValue">ForceIncluded</s:String>
In both the above examples the “…” are replaced with a GUID corresponding to the directory/file.
My thought process was that I could add an entry for the subdirectory to the “Elements to Skip”, then edit the .DotSettings file and replace the ExplicitlyExcluded
for the new entry with ForceIncluded
. However, doing this does not work.
In essence, the functionality I'm looking for is akin to how in a .gitignore you can specify “SomeWebsite” for git to ignore, then specify “!SomeWebsite/SomeFolderA/SomeFolderB” to override the ignore.
Is there another way to go about this? Or is this a feature Rider lacks?
Please sign in to leave a comment.
How about using EditorConfig to manage the inspection properties? It's easier to manage and share the configurations.
If you still want to use DotSettings, you need to input and manage all the file paths manually, it doesn't support adding excluded subfolders back.
The “Element to Skip” in Rider settings accepts wildcard pattern paths. The default file masks are good in most of the scenarios, like exclude “node_modules” folder by default. You may share more details about your frontend project type so I can help to check if we have a better solution for you.