Use of GlobalSuppressions.cs i StyleCop Runner in Azure Pipeline
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 |
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 |
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 '18 at 11:06
piuspius
1,0261319
1,0261319
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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 |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 |
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 |
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 '18 at 17:15
piuspius
1,0261319
1,0261319
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.
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