Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does StyleCop output read "StyleCop cancelled"?

In VisualStudio 2012, creating a WPF solution, attempting to run stylecop on entire solution, the output reads

------ StyleCop 4.7 (build 4.7.59.0) started ------

Pass 1:   testProject - \App.xaml.cs
Pass 1:   testProject - \Modules\Administration\Models\DocumentClass.cs
Pass 1:   testProject - \Modules\Administration\Models\DocumentType.cs
Pass 1:   testProject - \Modules\Administration\Models\LetterGroup.cs
Pass 1:   testProject - \Modules\Administration\Models\LetterType.cs

------ StyleCop cancelled ------

Why do I get this message? Did the process complete? where do I find the results?

like image 879
barrypicker Avatar asked Apr 22 '16 20:04

barrypicker


People also ask

What happened to StyleCop in Visual Studio?

StyleCop is no longer a Visual Studio plugin, it can be used outside Visual Studio too. For example, here?s the output of our project when built using the command-line command ?dotnet build?: See how our build succeeded, but the stylecop warnings are listed?

How do I configure StyleCop?

Configuring StyleCop is done in two optional steps. First, you can use rule set files to configure which rules are checked and how strongly you feel about them. Second, you can add a stylecop.json file to your project to fine-tune some rules.

What is StyleCop JSON file?

Stylecop.json The stylecop.json file is a settings file to further configure StyleCop. The easiest way to add the file is to open a file that violates rule SA1633. This is the rule that requires a file header (e.g., a copyright notice).

Is StyleCop still available in 2019?

StyleCop used to be a Visual Studio plugin and a NuGet package. You can still use this in Visual Studio 2019, but the current recommended way to use StyleCop is to use the Roslyn-based analyzers.


2 Answers

StyleCop will be cancelled if the warnings are over 1000. Another problem is the ErrorList by default is showing the error for "Build Only"

Below is the step to make the warning appear: (*** Please note that The example below is using VS2017)

1) “StyleCop cancelled” with no reason states in the Output message: enter image description here

2) Open the [Error List] tab and you will see nothing if the [Show issue generated] combo-box is "Build Only" enter image description here

3) Change the [Show issue generated] combo-box to "Build + Intellisense": enter image description here

4) If you still see nothing, maybe the filter is on, click the "Clear All Filters" button to clear all filters: enter image description here

5) And you should be able to see all of the warnings now: enter image description here

6) You may want to reduce the warnings by removing the unwanted rules, right-click on the project and choose “Properties.” In the screen that just opened, select “Code Analysis”: enter image description here

6) By default, the “Microsoft Managed Recommended Rules” will be selected. Click on “Open” and you’ll see a long list of rules you can select or deselect: enter image description here

like image 182
Jason Avatar answered Oct 13 '22 18:10

Jason


Take a look at the "Error List" tab. I'm pretty sure you'll find that there are 1000 warnings. If that number is reached, StyleCop stops. And I'm not aware that you can change that number.

Fix the style violations or disable the rules you don't want/need to get below 1000. Then StyleCop will run to the end.

like image 26
Ingo Strauch Avatar answered Oct 13 '22 18:10

Ingo Strauch