InspectCode Command-Line Tool doesn't seem to use plugin; detected errors between command line and VS inspections are different

I'm trying to use Resharper CLI in a PowerShell script for a CI build. The idea is to stop the build if any nullpointerexceptions might occur.

I'm using https://resharper-plugins.jetbrains.com/packages/ReSharper.ImplicitNullability/ with Pessimistic value analysis. I set the Inspection Severity of related null warnings to Error.

I'm trying to test a proof-of-concept, and I get different errors when I run inspection on the command line and in VS. The VS inspection gives me warnings according to the ImplicitNullability plugin. The output of the command line tool gives me exceptions as if the plugin was not there.

I tried:

  • copying the .nupkg file from ImplicitNullability into the same folder as inspectcode.exe
  • adding -x="ImplicitNullability" and -x="ReSharper.ImplicitNullability" to the command
  • Unloading and reloading my projects
  • Cleaning and rebuilding the solution

Here's a screenshot of the errors when I run inspection in VS:

Here's a screenshot of the errors when I run from command line:

and my PowerShell script:

$inspectcode = "C:\Users\ztian\Documents\JetBrains.ReSharper.CommandLineTools.2018.2.1\InspectCode.exe"
$slnFile = "C:\Users\ztian\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1.sln"
$severity = "ERROR"
$outputFile = ".\inspectcode-output.xml"

# run analysis
& $inspectcode --swea -x="ImplicitNullability" -o="$outputFile" -s="$severity" $slnFile

# parse anlysis output for errors
[xml]$xml = Get-Content $outputFile
if ($xml.Report.Issues.HasChildNodes)
{
  throw "inspectcode.exe found issues with severity level $severity; see $outputFile for details"
}
else
{
  echo "inspectcode.exe found no issues with severity level $severity"
}

 

Why is the command line tool not considering the plugin?

0
2 comments

Hello Ztian!

 

Thank you for contacting us.

Could you please try clearing caches for InspectCode tool in %localappdata%/JetBrains/Transient and then run inspectcode once more.

Thank you.

0
Avatar
Permanently deleted user

I deleted all folder from %localappdata%/JetBrains/Transient and tried again; no difference. According to various websites, support for extensions got removed with CLT 9.0.

Currently I can get correct reporting by using CLT 2018.1.4 with ImplicitNullability 4.5.1.12340181 (matching the parts of the version numbers "18.1" and "181", respectively, as discussed here: https://github.com/ulrichb/ImplicitNullability/issues/19)

0

Please sign in to leave a comment.