Skip to content

Commit

Permalink
Forcefully enable rule in UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-mikula-sonarsource committed Dec 15, 2023
1 parent 0cbd276 commit b050b45
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 9 deletions.
26 changes: 20 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ max_line_length = 200

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
indent_size = 4

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
Expand Down Expand Up @@ -172,6 +172,16 @@ csharp_space_between_square_brackets = false
# Wrapping
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion

# ----------------------------------------------------------------------------------------------------------------------
# Naming conventions
Expand All @@ -185,9 +195,9 @@ csharp_preserve_single_line_blocks = true

# Naming rules

dotnet_naming_rule.interface_must_start_with_I.severity = warning
dotnet_naming_rule.interface_must_start_with_i.severity = warning
dotnet_naming_rule.interface_must_start_with_I.symbols = interface_types
dotnet_naming_rule.interface_must_start_with_I.style = I_style
dotnet_naming_rule.interface_must_start_with_i.style = I_style

dotnet_naming_rule.variables_must_be_camel_style.severity = warning
dotnet_naming_rule.variables_must_be_camel_style.symbols = parameter_types
Expand Down Expand Up @@ -227,9 +237,8 @@ dotnet_naming_style.I_style.capitalization = pascal_case
# Rules
# ----------------------------------------------------------------------------------------------------------------------

# CS7035: it expects the build number to fit in 16 bits, our build numbers are bigger https://github.com/dotnet/roslyn/issues/17024#issuecomment-1669503201
dotnet_diagnostic.CS7035.severity = none

dotnet_diagnostic.S1451.severity = warning # Force activation of license header check for UTs
dotnet_diagnostic.CS7035.severity = none # CS7035: it expects the build number to fit in 16 bits, our build numbers are bigger https://github.com/dotnet/roslyn/issues/17024#issuecomment-1669503201
dotnet_diagnostic.CA1822.severity = warning # Increase visibility for Member 'xxx' does not access instance data and can be marked as static
dotnet_diagnostic.CS8785.severity = error # Do not hide root cause for: Generator 'xxx' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'xxx' with message 'xxx'
dotnet_diagnostic.RS2008.severity = none # Enable analyzer release tracking - we don't use the release tracking analyzer
Expand Down Expand Up @@ -456,3 +465,8 @@ dotnet_diagnostic.SA1652.severity = none
dotnet_diagnostic.SX1101.severity = none
dotnet_diagnostic.SX1309.severity = none
dotnet_diagnostic.SX1309S.severity = none
dotnet_style_prefer_collection_expression = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
22 changes: 21 additions & 1 deletion analyzers/tests/SonarAnalyzer.UnitTest/Common/XUnitVersions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
namespace SonarAnalyzer.UnitTest.Common;
/*
* SonarAnalyzer for .NET
* Copyright (C) 2015-2023 SonarSource SA
* mailto: contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

namespace SonarAnalyzer.UnitTest.Common;

public static class XUnitVersions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
using System.Text;
/*
* SonarAnalyzer for .NET
* Copyright (C) 2015-2023 SonarSource SA
* mailto: contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis.Text;
using SonarAnalyzer.Protobuf;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
namespace SonarAnalyzer.UnitTest.TestFramework.Tests;
/*
* SonarAnalyzer for .NET
* Copyright (C) 2015-2023 SonarSource SA
* mailto: contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

namespace SonarAnalyzer.UnitTest.TestFramework.Tests;

[TestClass]
public class ProjectBuilderTest
Expand Down

0 comments on commit b050b45

Please sign in to comment.