Failing to tune jb inspectcode with team-shared settings

I'm running jb inspectcode on my simple solution. The tool is complaining that I should use var keyword for simple types but this is something I don't wish. I've configured a team-shared setting to be explicit:

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String>
    <s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
    <s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
    <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FBuiltInTypes/@EntryIndexedValue">ERROR</s:String>
    <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">ERROR</s:String>
    <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FElsewhere/@EntryIndexedValue">ERROR</s:String></wpf:ResourceDictionary>

With the above settings I am expecting to see errors where var is used as we should be using explicit types for everything.

I am running jb like so:

jb.exe inspectcode --format=xml --output=result.xml --absolute-paths NullableTest.sln --include=Program.cs --severity=HINT --build --settings=NullableTest.sln.DotSettings

but I am still getting this:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by JetBrains Inspect Code 2024.1.3 -->
<Report ToolsVersion="241.0.20240607.153524">
 <Information>
   <Solution>C:\Git\personal\NullableTest\NullableTest.sln</Solution>
   <InspectionScope>
     <Element>Solution</Element>
   </InspectionScope>
 </Information>
 <IssueTypes>
   <IssueType Id="SuggestVarOrType_BuiltInTypes" Category="Syntax Style" CategoryId="CodeStyleIssues" SubCategory="Use preferred 'var' style" Description="Use preferred 'var' style: For built-in types" Severity="ERROR" WikiUrl="https://www.jetbrains.com/resharperplatform/help?Keyword=SuggestVarOrType_BuiltInTypes" />
   <IssueType Id="SuggestVarOrType_SimpleTypes" Category="Syntax Style" CategoryId="CodeStyleIssues" SubCategory="Use preferred 'var' style" Description="Use preferred 'var' style: When type is simple" Severity="ERROR" WikiUrl="https://www.jetbrains.com/resharperplatform/help?Keyword=SuggestVarOrType_SimpleTypes" />
 </IssueTypes>
 <Issues>
   <Project Name="NullableTest">
     <Issue TypeId="SuggestVarOrType_SimpleTypes" File="C:\Git\personal\NullableTest\Program.cs" Offset="92-100" Line="6" Message="Use 'var' (simple types)" />
     <Issue TypeId="SuggestVarOrType_BuiltInTypes" File="C:\Git\personal\NullableTest\Program.cs" Offset="135-138" Line="7" Message="Use 'var' (built-in types)" />
   </Project>
 </Issues>
</Report>

There is no other settings file in this folder or any above it.

How can I tune the rules jb inspectcode is reporting? Rider is correctly applying the rules as configured above so in this case there is a conflict between jb and Rider 💥

0
3 comments

Daniel Lidström Can you provide your test solution, please?

0

Slava Trenogin Thank you for your quick response. I was trying to extract this into a minimal reproducible sample but now everything seems to be working. I'm not sure why it wasn't working before. Sorry for the noise, then. I love ReSharper analysis and jb but getting it just right (and shared with team) is a bit of an effort! Have a nice day 🌞

0

Please sign in to leave a comment.