diff --git a/package.cmd b/package.cmd new file mode 100644 index 00000000..fc5bed76 --- /dev/null +++ b/package.cmd @@ -0,0 +1,4 @@ +CALL .\build /p:Configuration=Release + +SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe +%CACHED_NUGET% pack src\nuget\Octokit.CodeFormatter.nuspec -NoPackageAnalysis \ No newline at end of file diff --git a/src/Microsoft.DotNet.CodeFormatting/FormattingEngineImplementation.cs b/src/Microsoft.DotNet.CodeFormatting/FormattingEngineImplementation.cs index 7e279ab7..557e49c3 100644 --- a/src/Microsoft.DotNet.CodeFormatting/FormattingEngineImplementation.cs +++ b/src/Microsoft.DotNet.CodeFormatting/FormattingEngineImplementation.cs @@ -103,6 +103,7 @@ private IEnumerable GetOrderedRules(IEnumerable !r.Metadata.Skip) .OrderBy(r => r.Metadata.Order) .Where(r => r.Metadata.FormattingLevel <= FormattingLevel) .Select(r => r.Value) diff --git a/src/Microsoft.DotNet.CodeFormatting/IRuleMetadata.cs b/src/Microsoft.DotNet.CodeFormatting/IRuleMetadata.cs index 6b8ef5e4..4595690b 100644 --- a/src/Microsoft.DotNet.CodeFormatting/IRuleMetadata.cs +++ b/src/Microsoft.DotNet.CodeFormatting/IRuleMetadata.cs @@ -12,5 +12,8 @@ public interface IRuleMetadata [DefaultValue(FormattingLevel.Simple)] FormattingLevel FormattingLevel { get; } + + [DefaultValue(false)] + bool Skip { get; } } } diff --git a/src/Microsoft.DotNet.CodeFormatting/RuleAttribute.cs b/src/Microsoft.DotNet.CodeFormatting/RuleAttribute.cs index 8045b57f..cad3dd0d 100644 --- a/src/Microsoft.DotNet.CodeFormatting/RuleAttribute.cs +++ b/src/Microsoft.DotNet.CodeFormatting/RuleAttribute.cs @@ -26,6 +26,9 @@ public SyntaxRuleAttribute(int order) [DefaultValue(FormattingLevel.Simple)] public FormattingLevel FormattingLevel { get; set; } + + [DefaultValue(false)] + public bool Skip { get; set; } } [MetadataAttribute] @@ -43,6 +46,9 @@ public LocalSemanticRuleAttribute(int order) [DefaultValue(FormattingLevel.Simple)] public FormattingLevel FormattingLevel { get; set; } + + [DefaultValue(false)] + public bool Skip { get; set; } } [MetadataAttribute] @@ -60,5 +66,8 @@ public GlobalSemanticRuleAttribute(int order) [DefaultValue(FormattingLevel.Simple)] public FormattingLevel FormattingLevel { get; set; } + + [DefaultValue(false)] + public bool Skip { get; set; } } } diff --git a/src/Microsoft.DotNet.CodeFormatting/Rules/ExplicitVisibilityRule.cs b/src/Microsoft.DotNet.CodeFormatting/Rules/ExplicitVisibilityRule.cs index 9cd83a4c..37ab2e0e 100644 --- a/src/Microsoft.DotNet.CodeFormatting/Rules/ExplicitVisibilityRule.cs +++ b/src/Microsoft.DotNet.CodeFormatting/Rules/ExplicitVisibilityRule.cs @@ -14,7 +14,7 @@ namespace Microsoft.DotNet.CodeFormatting.Rules { - [LocalSemanticRule(LocalSemanticRuleOrder.ExplicitVisibilityRule)] + [LocalSemanticRule(LocalSemanticRuleOrder.ExplicitVisibilityRule, Skip = true)] internal sealed partial class ExplicitVisibilityRule : ILocalSemanticFormattingRule { public bool SupportsLanguage(string languageName) diff --git a/src/Microsoft.DotNet.CodeFormatting/Rules/NewLineAboveRule.cs b/src/Microsoft.DotNet.CodeFormatting/Rules/NewLineAboveRule.cs index 5a901453..5429ec47 100644 --- a/src/Microsoft.DotNet.CodeFormatting/Rules/NewLineAboveRule.cs +++ b/src/Microsoft.DotNet.CodeFormatting/Rules/NewLineAboveRule.cs @@ -18,7 +18,7 @@ namespace Microsoft.DotNet.CodeFormatting.Rules /// /// Ensure there is a blank line above the first using and namespace in the file. /// - [SyntaxRule(SyntaxRuleOrder.NewLineAboveFormattingRule)] + [SyntaxRule(SyntaxRuleOrder.NewLineAboveFormattingRule, Skip = true)] internal sealed class NewLineAboveRule : CSharpOnlyFormattingRule, ISyntaxFormattingRule { public SyntaxNode Process(SyntaxNode syntaxRoot, string languageName) diff --git a/src/Microsoft.DotNet.CodeFormatting/Rules/PrivateFieldNamingRule.cs b/src/Microsoft.DotNet.CodeFormatting/Rules/PrivateFieldNamingRule.cs index a642d681..39b90896 100644 --- a/src/Microsoft.DotNet.CodeFormatting/Rules/PrivateFieldNamingRule.cs +++ b/src/Microsoft.DotNet.CodeFormatting/Rules/PrivateFieldNamingRule.cs @@ -15,7 +15,7 @@ namespace Microsoft.DotNet.CodeFormatting.Rules { - [GlobalSemanticRule(GlobalSemanticRuleOrder.PrivateFieldNamingRule)] + [GlobalSemanticRule(GlobalSemanticRuleOrder.PrivateFieldNamingRule, Skip = true)] internal partial class PrivateFieldNamingRule : IGlobalSemanticFormattingRule { #region CommonRule diff --git a/src/nuget/Octokit.CodeFormatter.nuspec b/src/nuget/Octokit.CodeFormatter.nuspec new file mode 100644 index 00000000..2a7ee6a9 --- /dev/null +++ b/src/nuget/Octokit.CodeFormatter.nuspec @@ -0,0 +1,42 @@ + + + + Octokit.CodeFormatter + 1.0.0-preview + Octokit's CodeFormatter + Brendan Forster + Microsoft + A fork of the CodeFormatter tool which enforces a subset of the coding guidelines. + Copyright © Microsoft Corporation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file