ReSharper InspectCode clarification on --include option
Hi!
I am trying to use the command line version of Resharper (version 2024.01.3) on pushed changes in Github, but I am having major troubles with how the relative paths are meant to work. My use case is I have a solution with very many projects in it, and therefore only want to run inspectcode
on the modified files pushed using --include
, and not the entire solution. I would like some clarification if possible how the paths are meant to be resolved as the documentation is not detailed enough. It just says “relative paths” in https://www.jetbrains.com/help/resharper/InspectCode.html#inspection-parameters.
From https://youtrack.jetbrains.com/issue/RSRP-487298/InspectCode.exe-include-only-changed-files comments we learn that the paths are relative to the solution file, but when trying that out it just doesn't seem to be true, so I wonder how it is supposed to be then? Example below.
I have the following folder structure.
├─── top folder
├─── all_projects folder
| ├─── all_tools.sln
├─── project1 folder
| ├─── project1.csproj
| ├─── project1.cs
└─── project2 folder
├─── project2.csproj
├─── project2.cs
All projects belong to the all_projects solution file. With this folder setup, I would expect calling jb inspectcode -o="Testie.txt" -f=Text --include="..\project1\project1.cs" “.\all_projects\all_projects.sln”
from the top folder with Powershell to work, but it just says: No files to inspect were found.
I read in https://youtrack.jetbrains.com/issue/RSRP-475755/CodeCleanup-fails-to-exclude-files-using-a-relative-path-to-a-peer-directory-.. that it was a bug that going up a level with ..
didn't work, but surely this must have been resolved by now?
Is there anyway I can debug where jb thinks the files are supposed to be or get some clarification on what is wrong here? To me, this is all according to specification.
Please sign in to leave a comment.
Hi Oscar Tillgren
As specified in the docs, it's an ant-style wildcard.
It doesn't support neither
..
nor.
You're right, it says it doesn't support
.
, I missed that.If
..
is not supported, does it mean that it is impossible to run the analyzer on the folder structure i have above if I only want to include eitherproject1.cs
orproject2.cs
? Or how would you invoke it?It's possible. Just dot use
..
prefix.Also, include/exclude specify analyzing files, not projects.
So, in your case it will be something like that
--include="**/project1/**.*" --include="**/all_projects/**.*"
The
project1.cs
andproject2.cs
are actual .cs files and not project names though, and lie under theproject1
andproject2
projects respectively. The naming could probably have been better for this example though, they might as well be calledtest1.cs
andtest2.cs
.Are the wildcards at the start in your example the correct way to “circumvent” the lack of support for
..
path operator? If so, I can try to create a solution around that, just as long as I know what to aim for.Ant wildcards are applicable to the absolute path. So,
**
here is to match any possible root of your solution.