Use of GlobalSuppressions.cs i StyleCop Runner in Azure Pipeline
up vote
0
down vote
favorite
I have a c# solution that adhere to our custom StyleCop rules as specified in stylecop.json
and GlobalSuppresions.cs
. Both are located in the solution root and linked each project via their .csproj
files.
I have an Azure DevOps pipeline set up to build the entire solution and also run StyleCop on it using the runner. However, although our stylecop.json
settings are respected by the runner, the GlobalSuppresions.cs
ones aren't. In the runner there is an option to specify a path for a settings file, but none for GlobalSuppresions.cs
.
The question is: Is there a way to make the runner understand GlobalSuppressions.cs
? Or is there a way to merge our rules into stylecop.json
?
c# azure azure-devops azure-pipelines stylecop
add a comment |
up vote
0
down vote
favorite
I have a c# solution that adhere to our custom StyleCop rules as specified in stylecop.json
and GlobalSuppresions.cs
. Both are located in the solution root and linked each project via their .csproj
files.
I have an Azure DevOps pipeline set up to build the entire solution and also run StyleCop on it using the runner. However, although our stylecop.json
settings are respected by the runner, the GlobalSuppresions.cs
ones aren't. In the runner there is an option to specify a path for a settings file, but none for GlobalSuppresions.cs
.
The question is: Is there a way to make the runner understand GlobalSuppressions.cs
? Or is there a way to merge our rules into stylecop.json
?
c# azure azure-devops azure-pipelines stylecop
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a c# solution that adhere to our custom StyleCop rules as specified in stylecop.json
and GlobalSuppresions.cs
. Both are located in the solution root and linked each project via their .csproj
files.
I have an Azure DevOps pipeline set up to build the entire solution and also run StyleCop on it using the runner. However, although our stylecop.json
settings are respected by the runner, the GlobalSuppresions.cs
ones aren't. In the runner there is an option to specify a path for a settings file, but none for GlobalSuppresions.cs
.
The question is: Is there a way to make the runner understand GlobalSuppressions.cs
? Or is there a way to merge our rules into stylecop.json
?
c# azure azure-devops azure-pipelines stylecop
I have a c# solution that adhere to our custom StyleCop rules as specified in stylecop.json
and GlobalSuppresions.cs
. Both are located in the solution root and linked each project via their .csproj
files.
I have an Azure DevOps pipeline set up to build the entire solution and also run StyleCop on it using the runner. However, although our stylecop.json
settings are respected by the runner, the GlobalSuppresions.cs
ones aren't. In the runner there is an option to specify a path for a settings file, but none for GlobalSuppresions.cs
.
The question is: Is there a way to make the runner understand GlobalSuppressions.cs
? Or is there a way to merge our rules into stylecop.json
?
c# azure azure-devops azure-pipelines stylecop
c# azure azure-devops azure-pipelines stylecop
asked Nov 22 at 11:06
pius
9811219
9811219
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
So... since I wrote the questions I've learned a couple of things.
In newer versions of Visual Studio the "Roslyn Analyzers" are supposed to be used. While the stylecop analyzers nuget package adhere to GlobalSuppressions.cs
, and automatically create such files when requested via code fixes, that is not the recommended approach. Instead rulesets should be used. Rulesets are different from stylecop settings files which come in a new and old version. The new version is the .json one.
Rulesets are understood by the compiler directly, so there is no longer a need for the Azure DevOps build task that we were using. I simply created a ruleset that matched what we had in GlobalSuppressions.cs
and started using that for development. For our release configuration, which is what we use on Azure DevOps I created a copy of the ruleset, but with all the rules we use set to Error rather than Warning.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
So... since I wrote the questions I've learned a couple of things.
In newer versions of Visual Studio the "Roslyn Analyzers" are supposed to be used. While the stylecop analyzers nuget package adhere to GlobalSuppressions.cs
, and automatically create such files when requested via code fixes, that is not the recommended approach. Instead rulesets should be used. Rulesets are different from stylecop settings files which come in a new and old version. The new version is the .json one.
Rulesets are understood by the compiler directly, so there is no longer a need for the Azure DevOps build task that we were using. I simply created a ruleset that matched what we had in GlobalSuppressions.cs
and started using that for development. For our release configuration, which is what we use on Azure DevOps I created a copy of the ruleset, but with all the rules we use set to Error rather than Warning.
add a comment |
up vote
0
down vote
So... since I wrote the questions I've learned a couple of things.
In newer versions of Visual Studio the "Roslyn Analyzers" are supposed to be used. While the stylecop analyzers nuget package adhere to GlobalSuppressions.cs
, and automatically create such files when requested via code fixes, that is not the recommended approach. Instead rulesets should be used. Rulesets are different from stylecop settings files which come in a new and old version. The new version is the .json one.
Rulesets are understood by the compiler directly, so there is no longer a need for the Azure DevOps build task that we were using. I simply created a ruleset that matched what we had in GlobalSuppressions.cs
and started using that for development. For our release configuration, which is what we use on Azure DevOps I created a copy of the ruleset, but with all the rules we use set to Error rather than Warning.
add a comment |
up vote
0
down vote
up vote
0
down vote
So... since I wrote the questions I've learned a couple of things.
In newer versions of Visual Studio the "Roslyn Analyzers" are supposed to be used. While the stylecop analyzers nuget package adhere to GlobalSuppressions.cs
, and automatically create such files when requested via code fixes, that is not the recommended approach. Instead rulesets should be used. Rulesets are different from stylecop settings files which come in a new and old version. The new version is the .json one.
Rulesets are understood by the compiler directly, so there is no longer a need for the Azure DevOps build task that we were using. I simply created a ruleset that matched what we had in GlobalSuppressions.cs
and started using that for development. For our release configuration, which is what we use on Azure DevOps I created a copy of the ruleset, but with all the rules we use set to Error rather than Warning.
So... since I wrote the questions I've learned a couple of things.
In newer versions of Visual Studio the "Roslyn Analyzers" are supposed to be used. While the stylecop analyzers nuget package adhere to GlobalSuppressions.cs
, and automatically create such files when requested via code fixes, that is not the recommended approach. Instead rulesets should be used. Rulesets are different from stylecop settings files which come in a new and old version. The new version is the .json one.
Rulesets are understood by the compiler directly, so there is no longer a need for the Azure DevOps build task that we were using. I simply created a ruleset that matched what we had in GlobalSuppressions.cs
and started using that for development. For our release configuration, which is what we use on Azure DevOps I created a copy of the ruleset, but with all the rules we use set to Error rather than Warning.
answered Nov 29 at 17:15
pius
9811219
9811219
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429592%2fuse-of-globalsuppressions-cs-i-stylecop-runner-in-azure-pipeline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown