Skip to content

Commit

Permalink
Fix linting errors (#2560)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Sep 25, 2024
1 parent d15aa54 commit ba34f69
Show file tree
Hide file tree
Showing 91 changed files with 88 additions and 97 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ indent_size = 2
# Code style defaults
csharp_using_directive_placement = outside_namespace:error
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
dotnet_sort_system_directives_first = true
dotnet_sort_system_directives_first = true:error
dotnet_style_readonly_field = true:suggestion
csharp_style_namespace_declarations = file_scoped:error
dotnet_diagnostic.IDE0005.severity = error

# License header
file_header_template = Copyright (c) Microsoft Corporation.\nLicensed under the MIT License.
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ jobs:
timeout-minutes: 5
run: Invoke-Build -Configuration Release -AssertStyle GitHubActions

- name: Lint .NET
shell: pwsh
timeout-minutes: 5
run: dotnet format --verify-no-changes

- name: Upload module
uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions PSRule.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32602.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Types", "src\PSRule.Types\PSRule.Types.csproj", "{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Badges", "src\PSRule.Badges\PSRule.Badges.csproj", "{309BED8B-4E60-4C42-A2B4-37A2E7EBEF3F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule", "src\PSRule\PSRule.csproj", "{0130215D-58EB-4887-B6FA-31ED02500569}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Benchmark", "src\PSRule.Benchmark\PSRule.Benchmark.csproj", "{3EC0912F-BFC7-4B53-A1A1-0BA993C6282E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Tests", "tests\PSRule.Tests\PSRule.Tests.csproj", "{D3488CE2-779F-4474-B38A-F894A4B689F7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Badges", "src\PSRule.Badges\PSRule.Badges.csproj", "{309BED8B-4E60-4C42-A2B4-37A2E7EBEF3F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.BuildTool", "src\PSRule.BuildTool\PSRule.BuildTool.csproj", "{20DDCC65-8A9A-4BDC-91EC-C3BE6F32E52E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.SDK", "src\PSRule.SDK\PSRule.SDK.csproj", "{07A84E67-1CA3-4766-B9EA-1FDD9DF6516F}"
Expand All @@ -22,8 +24,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
src\PSRule.Common.props = src\PSRule.Common.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.Types", "src\PSRule.Types\PSRule.Types.csproj", "{5FE4DB0B-63D1-4DDB-9762-9C0D29168BC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSRule.MSBuild", "src\PSRule.MSBuild\PSRule.MSBuild.csproj", "{872D2648-2F00-475E-84B5-F08BE07385B7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E0EA0CBA-96C5-4447-8B69-BC13EF0D7A4A}"
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule.Badges/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Runtime.CompilerServices;
Expand Down
4 changes: 2 additions & 2 deletions src/PSRule.CommandLine/Commands/ModuleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
using System.Diagnostics.CodeAnalysis;
using System.Management.Automation;
using Newtonsoft.Json;
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Packaging;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;
using NuGet.Versioning;
Expand All @@ -15,8 +17,6 @@
using PSRule.Data;
using PSRule.Pipeline.Dependencies;
using SemanticVersion = PSRule.Data.SemanticVersion;
using NuGet.Packaging;
using NuGet.Common;

namespace PSRule.CommandLine.Commands;

Expand Down
2 changes: 1 addition & 1 deletion src/PSRule.Types/Definitions/IResourceAnnotations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ namespace PSRule.Definitions;
///
/// </summary>
public interface IResourceAnnotations : IDictionary<string, object>
{
{
}
2 changes: 1 addition & 1 deletion src/PSRule.Types/Definitions/IResourceMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public interface IResourceMetadata
/// <summary>
/// Annotations on the resource.
/// </summary>
public IResourceAnnotations Annotations { get;}
public IResourceAnnotations Annotations { get; }
}
2 changes: 1 addition & 1 deletion src/PSRule.Types/Definitions/ResourceHelpInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Newtonsoft.Json;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule.Types/Definitions/ResourceIdKind.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
4 changes: 2 additions & 2 deletions src/PSRule.Types/Emitters/InternalFileStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Emitters;
Expand All @@ -8,4 +8,4 @@ internal class InternalFileStream
public InternalFileStream()
{
}
}
}
2 changes: 1 addition & 1 deletion src/PSRule.Types/Options/IOption.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Options;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule.Types/Options/IOptionContext.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Options;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule.Types/Runtime/NullLogger_T.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public bool IsEnabled(LogLevel logLevel)
/// <inheritdoc/>
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{

}
}
2 changes: 1 addition & 1 deletion src/PSRule/Annotations/CommentMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Diagnostics;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Commands/AssertAllOfCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Management.Automation;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Commands/AssertAnyOfCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Management.Automation;
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Commands/ExportConventionCommand.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Diagnostics.CodeAnalysis;
using System.Management.Automation;
using PSRule.Definitions;
using PSRule.Definitions.Conventions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Commands/InvokeConventionCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Management.Automation;
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Commands/InvokeRuleBlockCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System.Management.Automation;
using PSRule.Configuration;
using PSRule.Definitions;
using PSRule.Pipeline;
using PSRule.Resources;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Commands/LanguageKeywords.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Commands;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Commands/RuleLanguageNouns.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Commands;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Common/ListExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule;
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Common/LoggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Management.Automation;
using PSRule.Definitions;
using PSRule.Pipeline;
using PSRule.Resources;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Common/RuleOutcomeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Rules;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Configuration/OutputStyle.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Newtonsoft.Json;
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Configuration/PSRuleOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections;
using System.Diagnostics;
using System.Management.Automation;
using Newtonsoft.Json;
using PSRule.Converters.Yaml;
using PSRule.Definitions.Baselines;
using PSRule.Pipeline;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Data/IInputFileInfoCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Data;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Data/TargetIssueCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Data;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Data/TargetSourceCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Data;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/AnnotatedExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Baselines/BaselineFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Management.Automation;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Baselines/BaselineRef.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Pipeline;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Baselines/BaselineSpec.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Configuration;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Baselines/IBaselineV1Spec.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Configuration;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Conventions/ConventionFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Management.Automation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System.Diagnostics;
using PSRule.Configuration;
using PSRule.Resources;
using PSRule.Runtime;

Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Definitions/Expressions/Primitives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System.Diagnostics;
using PSRule.Pipeline;

namespace PSRule.Definitions.Expressions;

Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/IConditionResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/IDetailedRuleResultV2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Collections;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/IResourceFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/IResultDetailV2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/IResultReasonV2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/ISpecDescriptor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Annotations;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/ISuppressionInfoComparer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/ModuleConfigs/ModuleConfigV1Spec.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Configuration;
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Definitions/Resource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System.Diagnostics;
using System.Net.Http.Headers;
using PSRule.Pipeline;
using YamlDotNet.Serialization;

Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Rules/IRuleSpec.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Definitions.Expressions;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Rules/RuleV1Spec.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Definitions.Expressions;
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Definitions/Rules/RuleVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Diagnostics;
using System.Management.Automation;
using PSRule.Definitions.Expressions;
using PSRule.Pipeline;
using PSRule.Resources;
using PSRule.Runtime;

Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Selectors/ISelector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions.Selectors;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/Selectors/SelectorV1.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Pipeline;
Expand Down
2 changes: 1 addition & 1 deletion src/PSRule/Definitions/SpecAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Definitions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Definitions.Expressions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Definitions.Expressions;
Expand Down
Loading

0 comments on commit ba34f69

Please sign in to comment.