Command line tools always run Full Cleanup

Answered

I'm trying to run "Command Line Tools" only for for c#=>Reformat code. I created custom profile in Resharper and run:

dotnet jb cleanupcode --profile="test" Sample.WebApi.csproj

I have info "Cleanup profile is specified. 'test' profile will be used to run cleanup" but even with this information I have full clean for each file - example below. I also tried to run --profile="Built-in: Reformat Code" or use custom settings saved from VS with only c#=>Reformat. Each time I have same result with full code clean.

<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Apply file layout
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Update file header
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Sort CSS properties
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - JavaScript decoration
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Reformat JavaScript
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Reformat HTML
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Reformat CSS
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Optimize 'using' directives and references
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Reformat C#
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Formatting
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Indenting
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Formatting
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Making blank lines
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Aligning in columns
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Indenting
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Formatting
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Making blank lines
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Aligning in columns
<Sample.WebApi>\Controllers\IB\v1\AnonymousController.cs - Applying syntax style

 

6 comments
Comment actions Permalink
Official comment

Hello Dominik Jeske,

Does it work properly when your targeting the whole solution? --profile="test" YourSolution.sln

Comment actions Permalink

Hello Dominik,

looks like you've hit a bug where code cleanup module is logged before profile check is performed. It should only affect logging, no real change should be performed by modules disabled in profile. You can check that for example by switching using directives, they should not be reordered back if you only have reformat in your profile. I've filed an issue to our issue tracker for this problem, you can vote for it to track progress https://youtrack.jetbrains.com/issue/RSRP-481209 

0
Comment actions Permalink

For me it is not working:

dotnet jb cleanupcode --profile="test" Solution1.sln

JetBrains Cleanup Code 2020.2.2

Running in 64-bit mode, .NET runtime 3.1.8 under Microsoft Windows NT 10.0.18363.0

Using toolset version 16.0 from "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"

Configuration: Debug, Platform: Any CPU

Cleanup profile is specified. 'test' profile will be used to run cleanup

<ConsoleApp1>\Program.cs

<ConsoleApp1>\Program.cs - Apply file layout

<ConsoleApp1>\Program.cs - Update file header

<ConsoleApp1>\Program.cs - Sort CSS properties

<ConsoleApp1>\Program.cs - JavaScript decoration

<ConsoleApp1>\Program.cs - Reformat JavaScript

<ConsoleApp1>\Program.cs - Reformat HTML

<ConsoleApp1>\Program.cs - Reformat CSS

<ConsoleApp1>\Program.cs - Optimize 'using' directives and references

<ConsoleApp1>\Program.cs - Reformat C#

<ConsoleApp1>\Program.cs - Formatting

<ConsoleApp1>\Program.cs - Indenting

<ConsoleApp1>\Program.cs - Formatting

<ConsoleApp1>\Program.cs - Making blank lines

<ConsoleApp1>\Program.cs - Aligning in columns

<ConsoleApp1>\Program.cs - Indenting

<ConsoleApp1>\Program.cs - Formatting

<ConsoleApp1>\Program.cs - Making blank lines

<ConsoleApp1>\Program.cs - Aligning in columns

<ConsoleApp1>\Program.cs - Applying syntax style

 

0
Comment actions Permalink

Hello Dominik Jeske

Could you check the behavior with ReSharper 2020.3 EAP7 (https://www.jetbrains.com/resharper/nextversion/)? The issue should be fixed in the upcoming version.

0
Comment actions Permalink

I’m little confused by user experience of those profiles – I tired to create and save global profile in Rider. One time it was no visible in tool, after some time I could use it, next I wanted to update it but each time I update and reopen it was not saved. When created new it was again not visible by a tool. I give up it is too complicated for me I think ;(

0
Comment actions Permalink

Dominik Jeske There is the web-help article explaining the settings layers in Rider: https://www.jetbrains.com/help/rider/Sharing_Configuration_Options.html#layers

Also please feel free to contact us at the forum or via a support ticket (you can create one by the Submit a Request button). We're here to help you!

0

Please sign in to leave a comment.