Mark Pearl

Resharper has a CLI tool for doing code inspections called Resharper Command Line Tools

Getting warnings / info from a solution

Running the command with the following parameters…

inspectcode ConsoleApplication1.sln --output=results.txt

Would produce the following results.txt file

<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by JetBrains Inspect Code 2017.1.2 -->
<Report ToolsVersion="108.0.20170428.80723">
  <Information>
    <Solution>ConsoleApplication1.sln</Solution>
    <InspectionScope>
      <Element>Solution</Element>
    </InspectionScope>
  </Information>
  <IssueTypes>
    <IssueType Id="CSharpWarnings::CS1030" Category="Compiler Warnings" CategoryId="CompilerWarnings" Description="'#warning' directive" Severity="WARNING" WikiUrl="https://msdn.microsoft.com/en-us/library/ckcykyd4.aspx" />
    <IssueType Id="ClassNeverInstantiated.Global" Category="Potential Code Quality Issues" CategoryId="CodeSmell" SubCategory="Class is never instantiated" Description="Class is never instantiated: Non-private accessibility" Severity="SUGGESTION" Global="True" />
    <IssueType Id="NotAccessedVariable.Compiler" Category="Compiler Warnings" CategoryId="CompilerWarnings" Description="Non-accessed local variable" Severity="WARNING" />
    <IssueType Id="RedundantUsingDirective" Category="Redundancies in Code" CategoryId="CodeRedundancy" Description="Redundant using directive" Severity="WARNING" WikiUrl="https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantUsingDirective" />
    <IssueType Id="UnusedParameter.Local" Category="Redundancies in Symbol Declarations" CategoryId="DeclarationRedundancy" SubCategory="Unused parameter" Description="Unused parameter: Private accessibility" Severity="WARNING" />
  </IssueTypes>
  <Issues>
    <Project Name="ConsoleApplication1">
      <Issue TypeId="RedundantUsingDirective" File="ConsoleApplication1\Program.cs" Offset="0-13" Message="Using directive is not required by the code and can be safely removed" />
      <Issue TypeId="RedundantUsingDirective" File="ConsoleApplication1\Program.cs" Offset="15-48" Line="2" Message="Using directive is not required by the code and can be safely removed" />
      <Issue TypeId="RedundantUsingDirective" File="ConsoleApplication1\Program.cs" Offset="50-68" Line="3" Message="Using directive is not required by the code and can be safely removed" />
      <Issue TypeId="RedundantUsingDirective" File="ConsoleApplication1\Program.cs" Offset="70-88" Line="4" Message="Using directive is not required by the code and can be safely removed" />
      <Issue TypeId="RedundantUsingDirective" File="ConsoleApplication1\Program.cs" Offset="90-119" Line="5" Message="Using directive is not required by the code and can be safely removed" />
      <Issue TypeId="ClassNeverInstantiated.Global" File="ConsoleApplication1\Program.cs" Offset="167-174" Line="9" Message="Class 'Program' is never instantiated" />
      <Issue TypeId="UnusedParameter.Local" File="ConsoleApplication1\Program.cs" Offset="217-221" Line="11" Message="Parameter 'args' is never used" />
      <Issue TypeId="NotAccessedVariable.Compiler" File="ConsoleApplication1\Program.cs" Offset="255-262" Line="13" Message="Local variable 'number2' is only assigned but its value is never used" />
      <Issue TypeId="CSharpWarnings::CS1030" File="ConsoleApplication1\Program.cs" Offset="284-291" Line="14" Message=" blah" />
      <Issue TypeId="RedundantUsingDirective" File="ConsoleApplication1\Properties\AssemblyInfo.cs" Offset="26-64" Line="2" Message="Using directive is not required by the code and can be safely removed" />
    </Project>
  </Issues>
</Report>


blog comments powered by Disqus

Want to get my personal insights on what I learn as I learn it? Subscribe now!


/