diff --git a/.github/ISSUE_TEMPLATE/zReportIssue.yml b/.github/ISSUE_TEMPLATE/zReportIssue.yml index 89b0691..74b05ec 100644 --- a/.github/ISSUE_TEMPLATE/zReportIssue.yml +++ b/.github/ISSUE_TEMPLATE/zReportIssue.yml @@ -21,6 +21,8 @@ body: label: Checklist description: Before continuing, make sure you have done the following. options: + - label: I confirm there are no unresolved issues reported on the [Chocolatey Status page](https://status.chocolatey.org). + required: true - label: I have verified this is the correct repository for opening this issue. required: true - label: I have verified no other issues exist related to my problem. @@ -52,9 +54,9 @@ body: attributes: label: How Did You Get This To Happen? description: | - Please include a complete set of reproducible steps that another user or maintainer of the repository can follow to get the same behavior that you are seeing. + Please include a complete set of _reproducible steps_ that another user or maintainer of the repository can follow to get the same behavior that you are seeing. _Reproducible steps_ should allow _anybody_ who is unfamiliar with your issue or environment to be able to reproduce your issue. This may include code, scripts or other environment configuration. - **NOTE: We may be unable to troubleshoot/respond to issues without reproducible steps. If you do not complete this section, there is a high chance your issue may be closed.** + **NOTE: We are unlikely to be able to troubleshoot or respond to issues without _reproducible steps_. If you do not complete this section with _reproducible steps_, the issue will be closed.** placeholder: | 1. I ran this command `choco source list` 2. No sources were displayed diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e75161c..88a9845 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -36,8 +36,8 @@ Please remove all comments before submitting. --> ### Operating Systems Testing @@ -56,7 +56,7 @@ Please remove all comments before submitting. * [ ] Documentation has been updated. * [ ] Tests to cover my changes, have been added. * [ ] All new and existing tests passed? -* [ ] PowerShell code changes: PowerShell v2 compatibility checked? +* [ ] PowerShell code changes: PowerShell v3 compatibility checked? ## Related Issue + https://github.com/chocolatey-community/chocolatey-community-validation/releases/tags/$version$ diff --git a/recipe.cake b/recipe.cake index 1ecff61..76cf4a9 100644 --- a/recipe.cake +++ b/recipe.cake @@ -1,4 +1,4 @@ -#load nuget:?package=Chocolatey.Cake.Recipe&version=0.26.0 +#load nuget:?package=Chocolatey.Cake.Recipe&version=0.28.4 /////////////////////////////////////////////////////////////////////////////// // RECIPE SCRIPT diff --git a/src/Chocolatey.Community.Validation.Console/Chocolatey.Community.Validation.Console.csproj b/src/Chocolatey.Community.Validation.Console/Chocolatey.Community.Validation.Console.csproj index 4f11601..2c4c371 100644 --- a/src/Chocolatey.Community.Validation.Console/Chocolatey.Community.Validation.Console.csproj +++ b/src/Chocolatey.Community.Validation.Console/Chocolatey.Community.Validation.Console.csproj @@ -12,6 +12,7 @@ Exe Debug;Release;DebugOfficial;ReleaseOfficial True + AnyCPU diff --git a/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrations.verified.txt b/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrations.verified.txt index 4a7a3b6..77493a0 100644 --- a/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrations.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrations.verified.txt @@ -2,9 +2,11 @@ RegisteredServices: { chocolatey.infrastructure.rules.IMetadataRule: [ Chocolatey.Community.Validation.Rules.AnyElementRules, + Chocolatey.Community.Validation.Rules.AuthorMatchesMaintainerRule, Chocolatey.Community.Validation.Rules.CopyrightElementRules, Chocolatey.Community.Validation.Rules.DependenciesElementRules, Chocolatey.Community.Validation.Rules.DescriptionElementRules, + Chocolatey.Community.Validation.Rules.IconUrlElementRules, Chocolatey.Community.Validation.Rules.IdElementRules, Chocolatey.Community.Validation.Rules.NuspecContainsEmailsRule, Chocolatey.Community.Validation.Rules.ProjectUrlElementRules, diff --git a/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrationsInLegacyMethod.verified.txt b/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrationsInLegacyMethod.verified.txt index 4a7a3b6..77493a0 100644 --- a/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrationsInLegacyMethod.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Registration/ChocolateyCCRRegistrationModuleTests.ShouldHaveAddedExpectedRegistrationsInLegacyMethod.verified.txt @@ -2,9 +2,11 @@ RegisteredServices: { chocolatey.infrastructure.rules.IMetadataRule: [ Chocolatey.Community.Validation.Rules.AnyElementRules, + Chocolatey.Community.Validation.Rules.AuthorMatchesMaintainerRule, Chocolatey.Community.Validation.Rules.CopyrightElementRules, Chocolatey.Community.Validation.Rules.DependenciesElementRules, Chocolatey.Community.Validation.Rules.DescriptionElementRules, + Chocolatey.Community.Validation.Rules.IconUrlElementRules, Chocolatey.Community.Validation.Rules.IdElementRules, Chocolatey.Community.Validation.Rules.NuspecContainsEmailsRule, Chocolatey.Community.Validation.Rules.ProjectUrlElementRules, diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldFlagAllElementsInADefaultTemplate.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldFlagAllElementsInADefaultTemplate.verified.txt index 31414e3..cf26fb2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldFlagAllElementsInADefaultTemplate.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldFlagAllElementsInADefaultTemplate.verified.txt @@ -1,48 +1,48 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'version' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'owners' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'authors' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'iconUrl' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'tags' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'summary' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'description' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019, + HelpUrl: https://ch0.co/rules/cpmr0019, Id: CPMR0019, Message: The element 'releaseNotes' contained a templated value. Templated values should not be present in the Metadata file., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index cd70297..f5756ab 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AnyElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,6 +3,6 @@ Severity: Error, Id: CPMR0019, Summary: Templated values should not be present in Metadata file., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0019 + HelpUrl: https://ch0.co/rules/cpmr0019 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenAuthorAndMaintainerIsSame.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenAuthorAndMaintainerIsSame.verified.txt new file mode 100644 index 0000000..7f121e9 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenAuthorAndMaintainerIsSame.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0068, + Id: CPMR0068, + Message: The package maintainer field (owners) matches the software author field (authors) in the nuspec., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenAuthorAndMaintainerUsesDifferentCase.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenAuthorAndMaintainerUsesDifferentCase.verified.txt new file mode 100644 index 0000000..7f121e9 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenAuthorAndMaintainerUsesDifferentCase.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0068, + Id: CPMR0068, + Message: The package maintainer field (owners) matches the software author field (authors) in the nuspec., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenMultipleSameAuthorsAndMaintainers.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenMultipleSameAuthorsAndMaintainers.verified.txt new file mode 100644 index 0000000..7f121e9 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldFlagRuleWhenMultipleSameAuthorsAndMaintainers.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0068, + Id: CPMR0068, + Message: The package maintainer field (owners) matches the software author field (authors) in the nuspec., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt new file mode 100644 index 0000000..3d77216 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -0,0 +1,8 @@ +[ + { + Severity: Note, + Id: CPMR0068, + Summary: The package maintainer field (owners) matches the software author field (authors) in the nuspec., + HelpUrl: https://ch0.co/rules/cpmr0068 + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.cs b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.cs new file mode 100644 index 0000000..bad7bd6 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/AuthorMatchesMaintainerRuleTests.cs @@ -0,0 +1,110 @@ +namespace Chocolatey.Community.Validation.Tests.Rules +{ + using System.Threading.Tasks; + using chocolatey; + using Chocolatey.Community.Validation.Rules; + using NUnit.Framework; + + [Category("Notes")] + public class AuthorMatchesMaintainerRuleTests : RuleTestBase + { + [Test] + public async Task ShouldFlagRuleWhenAuthorAndMaintainerIsSame() + { + const string testContent = @" + + + + short-copyright + [Deprecated] Test PKG + 1.0.0 + Package-Author + Package-Author + https://test-url.com/ + + +"; + + await VerifyNuspec(testContent); + } + [Test] + public async Task ShouldFlagRuleWhenAuthorAndMaintainerUsesDifferentCase() + { + const string testContent = @" + + + + short-copyright + [Deprecated] Test PKG + 1.0.0 + Package-Author + package-author + https://test-url.com/ + + +"; + + await VerifyNuspec(testContent); + } + + [Test] + public async Task ShouldFlagRuleWhenMultipleSameAuthorsAndMaintainers() + { + const string testContent = @" + + + + short-copyright + [Deprecated] Test PKG + 1.0.0 + Package-Author Package-Maintainer + Package-Author Package-Maintainer + https://test-url.com/ + + +"; + + await VerifyNuspec(testContent); + } + + [TestCaseSource(nameof(EmptyTestValues))] + public async Task ShouldNotFlagOnEmptyValues(string value) + { + const string testContent = @" + + + + short-copyright + [Deprecated] Test PKG + 1.0.0 + {0} + {0} + https://test-url.com/ + + +"; + + await VerifyEmptyResults(testContent.FormatWith(value)); + } + + [Test] + public async Task ShouldNotFlagWhenDifferentMaintanerCountThanAuthors() + { + const string testContent = @" + + + + short-copyright + [Deprecated] Test PKG + 1.0.0 + Package-Author + Package-Author Package-Maintainer + https://test-url.com/ + + +"; + + await VerifyEmptyResults(testContent); + } + } +} diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= .verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= .verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= .verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= .verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= uba .verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= uba .verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= uba .verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright= uba .verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=-- -.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=-- -.verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=-- -.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=-- -.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=.verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=a.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=a.verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=a.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=a.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=abc.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=abc.verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=abc.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=abc.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=null.verified.txt index d5f834a..3b645d3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=null.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldFlagWhenCopyrightIsBelow4Characters_copyright=null.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001, + HelpUrl: https://ch0.co/rules/cpmr0001, Id: CPMR0001, Message: Copyright Character Count Below 4 characters, Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index 22c500b..6ebcdad 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/CopyrightElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,6 +3,6 @@ Severity: Error, Id: CPMR0001, Summary: Copyright Character Count Below 4 characters, - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0001 + HelpUrl: https://ch0.co/rules/cpmr0001 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=2.0.0.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=2.0.0.verified.txt new file mode 100644 index 0000000..f003ca5 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=2.0.0.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0062, + Id: CPMR0062, + Message: A dependency on Chocolatey CLI was found. Ensure that you use functionality that requires the specified version range of Chocolatey CLI., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[,2.0.0).verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[,2.0.0).verified.txt new file mode 100644 index 0000000..f003ca5 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[,2.0.0).verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0062, + Id: CPMR0062, + Message: A dependency on Chocolatey CLI was found. Ensure that you use functionality that requires the specified version range of Chocolatey CLI., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[2.0.0, 3.0.0).verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[2.0.0, 3.0.0).verified.txt new file mode 100644 index 0000000..f003ca5 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[2.0.0, 3.0.0).verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0062, + Id: CPMR0062, + Message: A dependency on Chocolatey CLI was found. Ensure that you use functionality that requires the specified version range of Chocolatey CLI., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[2.0.0,].verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[2.0.0,].verified.txt new file mode 100644 index 0000000..f003ca5 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=[2.0.0,].verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0062, + Id: CPMR0062, + Message: A dependency on Chocolatey CLI was found. Ensure that you use functionality that requires the specified version range of Chocolatey CLI., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=null.verified.txt new file mode 100644 index 0000000..e8e78b9 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=chocolatey_version=null.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0062, + Id: CPMR0062, + Message: An open ended dependency on Chocolatey CLI was found. Ensure this was not added by a mistake., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=test-package.hook_version=1.0.0.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=test-package.hook_version=1.0.0.verified.txt new file mode 100644 index 0000000..229f83c --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=test-package.hook_version=1.0.0.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0074, + Id: CPMR0074, + Message: Package has dependency on test-package.hook package. Hook packages should not be defined as a dependency., + Severity: Error + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=test-package.hook_version=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=test-package.hook_version=null.verified.txt new file mode 100644 index 0000000..229f83c --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagDependency_id=test-package.hook_version=null.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0074, + Id: CPMR0074, + Message: Package has dependency on test-package.hook package. Hook packages should not be defined as a dependency., + Severity: Error + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWhileMissingDependenciesElement.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWhileMissingDependenciesElement.verified.txt index bbd7839..187b242 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWhileMissingDependenciesElement.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWhileMissingDependenciesElement.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0017, + HelpUrl: https://ch0.co/rules/cpmr0017, Id: CPMR0017, Message: A dependency is required for deprecated packages., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesListed.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesListed.verified.txt index bbd7839..187b242 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesListed.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesListed.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0017, + HelpUrl: https://ch0.co/rules/cpmr0017, Id: CPMR0017, Message: A dependency is required for deprecated packages., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesThatIsSelfClosed.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesThatIsSelfClosed.verified.txt index bbd7839..187b242 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesThatIsSelfClosed.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesThatIsSelfClosed.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0017, + HelpUrl: https://ch0.co/rules/cpmr0017, Id: CPMR0017, Message: A dependency is required for deprecated packages., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index 50e015f..1ba2050 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,6 +3,18 @@ Severity: Error, Id: CPMR0017, Summary: Deprecated packages must have a dependency., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0017 + HelpUrl: https://ch0.co/rules/cpmr0017 + }, + { + Severity: Note, + Id: CPMR0062, + Summary: A dependency on Chocolatey CLI has been added., + HelpUrl: https://ch0.co/rules/cpmr0062 + }, + { + Severity: Error, + Id: CPMR0074, + Summary: Package has dependency on .hook package., + HelpUrl: https://ch0.co/rules/cpmr0074 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.cs b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.cs index 5e81822..38e6b43 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.cs +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DependenciesElementRulesTests.cs @@ -8,6 +8,20 @@ namespace Chocolatey.Community.Validation.Tests.Rules [Category("Requirements")] public class DependenciesElementRulesTests : RuleTestBase { + [TestCase("chocolatey", null)] + [TestCase("chocolatey", "2.0.0")] + [TestCase("chocolatey", "[,2.0.0)")] + [TestCase("chocolatey", "[2.0.0, 3.0.0)")] + [TestCase("chocolatey", "[2.0.0,]")] + [TestCase("test-package.hook", null)] + [TestCase("test-package.hook", "1.0.0")] + public async Task ShouldFlagDependency(string id, string version) + { + var testContent = GetTestContent("Test Package", (id, version)); + + await VerifyNuspec(testContent); + } + [Test] public async Task ShouldFlagWhenTitleContainsDeprecatedWhileMissingDependenciesElement() { @@ -55,6 +69,14 @@ public async Task ShouldFlagWhenTitleContainsDeprecatedWithoutDependenciesThatIs await VerifyNuspec(testContent); } + [Test] + public async Task ShouldNotFlagDependencyNotUsingCorrectHookExtension() + { + var testContent = GetTestContent("Test Package", ("test-package-hook", null)); + + await VerifyEmptyResults(testContent); + } + [Test] public async Task ShouldNotFlagWhenTitleDoesNotContainDeprecatedNotice() { diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=######Heading 6.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=######Heading 6.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=######Heading 6.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=######Heading 6.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#####Heading 5.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#####Heading 5.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#####Heading 5.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#####Heading 5.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=####Heading 4.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=####Heading 4.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=####Heading 4.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=####Heading 4.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=###Heading 3.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=###Heading 3.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=###Heading 3.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=###Heading 3.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=##Heading 2.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=##Heading 2.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=##Heading 2.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=##Heading 2.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#Heading 1.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#Heading 1.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#Heading 1.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=#Heading 1.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---######Heading 6.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---######Heading 6.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---######Heading 6.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---######Heading 6.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#####Heading 5.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#####Heading 5.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#####Heading 5.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#####Heading 5.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---####Heading 4.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---####Heading 4.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---####Heading 4.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---####Heading 4.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---###Heading 3.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---###Heading 3.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---###Heading 3.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---###Heading 3.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---##Heading 2.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---##Heading 2.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---##Heading 2.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---##Heading 2.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#Heading 1.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#Heading 1.verified.txt index bc482cf..2fadcb7 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#Heading 1.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionContainsInvalidMarkdownHeaders_description=---#Heading 1.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030, + HelpUrl: https://ch0.co/rules/cpmr0030, Id: CPMR0030, Message: The description of the package contains invalid Markdown Headings., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionElementIsNotPresent.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionElementIsNotPresent.verified.txt index 8ea788f..6dbd7c2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionElementIsNotPresent.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionElementIsNotPresent.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0002, + HelpUrl: https://ch0.co/rules/cpmr0002, Id: CPMR0002, Message: A description of the package is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionHasMoreThan4000Characters.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionHasMoreThan4000Characters.verified.txt index 401d59a..13e6a31 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionHasMoreThan4000Characters.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionHasMoreThan4000Characters.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0026, + HelpUrl: https://ch0.co/rules/cpmr0026, Id: CPMR0026, Message: The description has a length of 4,060 characters. A description can not have a length of above 4,000 characters., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value= .verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value= .verified.txt index 8ea788f..6dbd7c2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value= .verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value= .verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0002, + HelpUrl: https://ch0.co/rules/cpmr0002, Id: CPMR0002, Message: A description of the package is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=-- -.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=-- -.verified.txt index 8ea788f..6dbd7c2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=-- -.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=-- -.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0002, + HelpUrl: https://ch0.co/rules/cpmr0002, Id: CPMR0002, Message: A description of the package is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=.verified.txt index 8ea788f..6dbd7c2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0002, + HelpUrl: https://ch0.co/rules/cpmr0002, Id: CPMR0002, Message: A description of the package is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=null.verified.txt index 8ea788f..6dbd7c2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=null.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsEmpty_value=null.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0002, + HelpUrl: https://ch0.co/rules/cpmr0002, Id: CPMR0002, Message: A description of the package is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsExactly30Characters.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsExactly30Characters.verified.txt index ed6b44b..2f65be3 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsExactly30Characters.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsExactly30Characters.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0032, + HelpUrl: https://ch0.co/rules/cpmr0032, Id: CPMR0032, Message: The description has a length of 30 characters. A description should be sufficient to explain the software., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30Characters.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30Characters.verified.txt index 1796b08..99c36c0 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30Characters.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30Characters.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0032, + HelpUrl: https://ch0.co/rules/cpmr0032, Id: CPMR0032, Message: The description has a length of 22 characters. A description should be sufficient to explain the software., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30CharactersAfterTrimming.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30CharactersAfterTrimming.verified.txt index faa51ba..7b1c98f 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30CharactersAfterTrimming.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldFlagWhenDescriptionIsLessThan30CharactersAfterTrimming.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0032, + HelpUrl: https://ch0.co/rules/cpmr0032, Id: CPMR0032, Message: The description has a length of 21 characters. A description should be sufficient to explain the software., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index bdb57fe..8b9aadc 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/DescriptionElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,24 +3,24 @@ Severity: Error, Id: CPMR0002, Summary: A description of the package is either missing or empty., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0002 + HelpUrl: https://ch0.co/rules/cpmr0002 }, { Severity: Error, Id: CPMR0026, Summary: A description can not have a length of above 4,000 characters., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0026 + HelpUrl: https://ch0.co/rules/cpmr0026 }, { Severity: Error, Id: CPMR0030, Summary: The description of the package contains invalid Markdown Headings., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0030 + HelpUrl: https://ch0.co/rules/cpmr0030 }, { Severity: Error, Id: CPMR0032, Summary: The description is not sufficient to explain the software., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0032 + HelpUrl: https://ch0.co/rules/cpmr0032 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldFlagUrlsUsingGitHubLinks.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldFlagUrlsUsingGitHubLinks.verified.txt new file mode 100644 index 0000000..dd891b5 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldFlagUrlsUsingGitHubLinks.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0076, + Id: CPMR0076, + Message: Icon URL uses a URL that is a GitHub raw URL., + Severity: Error + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldFlagUrlsUsingRawGitLinks.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldFlagUrlsUsingRawGitLinks.verified.txt new file mode 100644 index 0000000..565c6d4 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldFlagUrlsUsingRawGitLinks.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0076, + Id: CPMR0076, + Message: Icon URL uses a URL that is a RawGit URL., + Severity: Error + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldReturnAvailableRulesForImplementation.verified.txt new file mode 100644 index 0000000..16656d7 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -0,0 +1,8 @@ +[ + { + Severity: Error, + Id: CPMR0076, + Summary: Icon URL uses a URL that is a GitHub raw URL., + HelpUrl: https://ch0.co/rules/cpmr0076 + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.cs b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.cs new file mode 100644 index 0000000..aa47a00 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IconUrlElementRulesTest.cs @@ -0,0 +1,77 @@ +namespace Chocolatey.Community.Validation.Tests.Rules +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using Chocolatey.Community.Validation.Rules; + using NUnit.Framework; + using VerifyNUnit; + + public class IconUrlElementRulesTest : RuleTestBase + { + [TestCase(nameof(InvalidUrlValues))] + public async Task ShouldNotFlagInvalidUrls(string value) + { + var testContent = GetTestContent(value); + + await VerifyEmptyResults(testContent); + } + + [TestCaseSource(nameof(EmptyTestValues))] + public async Task ShouldNotFlagEmptyValues(string value) + { + var testContent = GetTestContent(value); + + await VerifyEmptyResults(testContent); + } + + [TestCase("https://github.com/chocolatey-community/chocolatey-packages/blob/master/icons/7zip.svg")] + [TestCase("https://github.com/chocolatey-community/chocolatey-packages/raw/refs/heads/master/icons/filezilla.svg")] + [TestCase("https://raw.githubusercontent.com/chocolatey-community/chocolatey-packages/refs/heads/master/icons/1password4.png")] + public async Task ShouldFlagUrlsUsingGitHubLinks(string value) + { + var testContent = GetTestContent(value); + + var results = GetRuleResults(testContent, Encoding.UTF8); + + await Verifier.Verify(results) + // We ignore the parameter value, as it will result in + // failure due to long paths not being supported. + .IgnoreParametersForVerified(nameof(value)) + .DisableRequireUniquePrefix(); + } + + [Test] + public async Task ShouldFlagUrlsUsingRawGitLinks() + { + var testContent = GetTestContent("https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/049a3a3d/icons/winff.png"); + + await VerifyNuspec(testContent); + } + + private static string GetTestContent(string? iconUrl) + { + const string format = @" + + + + short-copyright + 1.0.0 + Author + {0} + https://test-url.com/ + tag-1 tag-2 tag-3 + + + + + +"; + + return string.Format(CultureInfo.InvariantCulture, format, iconUrl); + } + } +} diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=IAmALongeAlpha.CharacterThatMatches_Multiple_Rules.config.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=IAmALongeAlpha.CharacterThatMatches_Multiple_Rules.config.verified.txt new file mode 100644 index 0000000..f16df6e --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=IAmALongeAlpha.CharacterThatMatches_Multiple_Rules.config.verified.txt @@ -0,0 +1,32 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0024, + Id: CPMR0024, + Message: Package ID includes a prerelease version name., + Severity: Error + }, + { + HelpUrl: https://ch0.co/rules/cpmr0029, + Id: CPMR0029, + Message: Package ID ends with the reserved suffix `.config`., + Severity: Error + }, + { + HelpUrl: https://ch0.co/rules/cpmr0070, + Id: CPMR0070, + Message: Package ID contains underscores (_). Normally a Package ID is separated by dashes (-)., + Severity: Note + }, + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + }, + { + HelpUrl: https://ch0.co/rules/cpmr0069, + Id: CPMR0069, + Message: Package ID contains 50 characters without being separated by a dash (-)., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=beta-test.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=beta-test.verified.txt index 29c9a83..19f24cf 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=beta-test.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=beta-test.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024, + HelpUrl: https://ch0.co/rules/cpmr0024, Id: CPMR0024, Message: Package ID includes a prerelease version name., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=different.something.commandline.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=different.something.commandline.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=different.something.commandline.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=i-haveasectionlongerthan20-characters.install.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=i-haveasectionlongerthan20-characters.install.verified.txt new file mode 100644 index 0000000..6140b1c --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=i-haveasectionlongerthan20-characters.install.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0069, + Id: CPMR0069, + Message: Package ID contains 37 characters with one or more parts being more than 20 characters., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=iamaverylongidentifierthatismorethan20characters.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=iamaverylongidentifierthatismorethan20characters.verified.txt new file mode 100644 index 0000000..bfc0d74 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=iamaverylongidentifierthatismorethan20characters.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0069, + Id: CPMR0069, + Message: Package ID contains 48 characters without being separated by a dash (-)., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my prerelease.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my prerelease.verified.txt index 29c9a83..19f24cf 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my prerelease.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my prerelease.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024, + HelpUrl: https://ch0.co/rules/cpmr0024, Id: CPMR0024, Message: Package ID includes a prerelease version name., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my-package.CONFIG.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my-package.CONFIG.verified.txt index 3bd308d..1cd2476 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my-package.CONFIG.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=my-package.CONFIG.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0029, + HelpUrl: https://ch0.co/rules/cpmr0029, Id: CPMR0029, Message: Package ID ends with the reserved suffix `.config`., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=pkg.config.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=pkg.config.verified.txt index 3bd308d..1cd2476 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=pkg.config.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=pkg.config.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0029, + HelpUrl: https://ch0.co/rules/cpmr0029, Id: CPMR0029, Message: Package ID ends with the reserved suffix `.config`., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=prerelease.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=prerelease.verified.txt index 29c9a83..19f24cf 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=prerelease.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=prerelease.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024, + HelpUrl: https://ch0.co/rules/cpmr0024, Id: CPMR0024, Message: Package ID includes a prerelease version name., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.extension.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.extension.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.extension.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.install.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.install.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.install.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.portable.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.portable.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.portable.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.powershell.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.powershell.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.powershell.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.template.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.template.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.template.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.verified.txt new file mode 100644 index 0000000..afc51d2 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=something.other.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0061, + Id: CPMR0061, + Message: Package ID contains dots (.), that is not part of the accepted suffixes., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=test-ALPha.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=test-ALPha.verified.txt index 29c9a83..19f24cf 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=test-ALPha.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=test-ALPha.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024, + HelpUrl: https://ch0.co/rules/cpmr0024, Id: CPMR0024, Message: Package ID includes a prerelease version name., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testBETA.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testBETA.verified.txt index 29c9a83..19f24cf 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testBETA.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testBETA.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024, + HelpUrl: https://ch0.co/rules/cpmr0024, Id: CPMR0024, Message: Package ID includes a prerelease version name., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testalpha.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testalpha.verified.txt index 29c9a83..19f24cf 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testalpha.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=testalpha.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024, + HelpUrl: https://ch0.co/rules/cpmr0024, Id: CPMR0024, Message: Package ID includes a prerelease version name., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=with_underscores.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=with_underscores.verified.txt new file mode 100644 index 0000000..984c201 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldFlagIdentifier_id=with_underscores.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0070, + Id: CPMR0070, + Message: Package ID contains underscores (_). Normally a Package ID is separated by dashes (-)., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index ea56981..8eb3d6b 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,12 +3,30 @@ Severity: Error, Id: CPMR0024, Summary: Package ID includes a prerelease version name., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0024 + HelpUrl: https://ch0.co/rules/cpmr0024 }, { Severity: Error, Id: CPMR0029, Summary: Package ID ends with the reserved suffix `.config`., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0029 + HelpUrl: https://ch0.co/rules/cpmr0029 + }, + { + Severity: Note, + Id: CPMR0061, + Summary: Package ID contains dots (.), that is not part of the accepted suffixes., + HelpUrl: https://ch0.co/rules/cpmr0061 + }, + { + Severity: Note, + Id: CPMR0070, + Summary: Package ID contains underscores (_). Normally a Package ID is separated by dashes (-)., + HelpUrl: https://ch0.co/rules/cpmr0070 + }, + { + Severity: Note, + Id: CPMR0069, + Summary: Package ID contains too many characters without being separated by a dash (-)., + HelpUrl: https://ch0.co/rules/cpmr0069 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.cs b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.cs index 47da506..87519b5 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.cs +++ b/src/Chocolatey.Community.Validation.Tests/Rules/IdElementRulesTests.cs @@ -7,6 +7,24 @@ namespace Chocolatey.Community.Validation.Tests.Rules public class IdElementRulesTests : RuleTestBase { + [TestCase(null)] + [TestCase("")] + [TestCase("some-id")] + [TestCase("something.portable")] + [TestCase("something.commandline")] + [TestCase("something.powershell")] + [TestCase("something.install")] + [TestCase("something.template")] + [TestCase("something.extension")] + [TestCase("iamalongidentifier.extension")] + [TestCase("i-am-a-long-identifier-separated-by-dashes")] + public async Task ShouldNotFlagIdentifier(string id) + { + var testContent = GetTestContent(id); + + await VerifyEmptyResults(testContent); + } + [TestCase("testalpha")] [TestCase("test-ALPha")] [TestCase("testBETA")] @@ -15,6 +33,17 @@ public class IdElementRulesTests : RuleTestBase [TestCase("my prerelease")] [TestCase("my-package.CONFIG")] [TestCase("pkg.config")] + [TestCase("something.other")] + [TestCase("something.other.portable")] + [TestCase("different.something.commandline")] + [TestCase("something.other.powershell")] + [TestCase("something.other.install")] + [TestCase("something.other.template")] + [TestCase("something.other.extension")] + [TestCase("with_underscores")] + [TestCase("iamaverylongidentifierthatismorethan20characters")] + [TestCase("i-haveasectionlongerthan20-characters.install")] + [TestCase("IAmALongeAlpha.CharacterThatMatches_Multiple_Rules.config")] public async Task ShouldFlagIdentifier(string id) { var testContent = GetTestContent(id); @@ -22,22 +51,6 @@ public async Task ShouldFlagIdentifier(string id) await VerifyNuspec(testContent); } - [Test] - public async Task ShouldNotFlagIdentifierWithoutPrereleaseName() - { - var testContent = GetTestContent("some-id"); - - await VerifyEmptyResults(testContent); - } - - [Test] - public async Task ShouldNotFlagAnEmptyIdentifier() - { - var testContent = GetTestContent(string.Empty); - - await VerifyEmptyResults(testContent); - } - private static string GetTestContent(string? id) { const string format = @" diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=False.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=False.verified.txt index 28917d1..bb41780 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=False.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=False.verified.txt @@ -1,132 +1,132 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'id' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'version' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'packageSourceUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'owners' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'title' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'authors' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'projectUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'iconUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'copyright' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'licenseUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'projectSourceUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'docsUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'mailingListUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'bugTrackerUrl' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'tags' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'summary' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'description' contains 3 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'releaseNotes' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'language' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'provides' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'conflicts' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'replaces' contains 1 email(s). Emails should not be present in the Metadata file., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=True.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=True.verified.txt index 4692ad3..62856f2 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=True.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagAllEmailsInNuspec_outputEmails=True.verified.txt @@ -1,132 +1,132 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'id' contained the emails 'bobbbbb@te.st'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'version' contained the emails 'abc@def.gh'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'packageSourceUrl' contained the emails 'package-source@test.com'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'owners' contained the emails 'owner@my-email.com'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'title' contained the emails 'Bob@test.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'authors' contained the emails 'bob@bob.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'projectUrl' contained the emails 'project@test.nz'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'iconUrl' contained the emails 'icon@bob.com'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'copyright' contained the emails 'bob@bob.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'licenseUrl' contained the emails 'bob@test.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'projectSourceUrl' contained the emails 'pkg-source@test.no'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'docsUrl' contained the emails 'bob@bob2.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'mailingListUrl' contained the emails 'bob@bob.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'bugTrackerUrl' contained the emails 'bob@bob.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'tags' contained the emails 'bobby@bob.no'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'summary' contained the emails 'BOB@test.com'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'description' contained the emails 'bob@bob.co.uk, lezy@workplace.com, someone@worker.no'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'releaseNotes' contained the emails 'awesome@user.com'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'language' contained the emails 'bob@bob.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'provides' contained the emails 'provides@test.com'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'conflicts' contained the emails 'bob+label@bob.co.uk'. Emails should not be present in the Metadata file., Severity: Error }, { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: The element 'replaces' contained the emails 'bobby@bobtastic.ca'. Emails should not be present in the Metadata file., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagEmailUsedOutsideOfMetadataFields.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagEmailUsedOutsideOfMetadataFields.verified.txt index ab016be..d1a3ce4 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagEmailUsedOutsideOfMetadataFields.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldFlagEmailUsedOutsideOfMetadataFields.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020, + HelpUrl: https://ch0.co/rules/cpmr0020, Id: CPMR0020, Message: An Email Address should not be used in Metadata file., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt index 23083af..1eb1d3f 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/NuspecContainsEmailsRuleTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,6 +3,6 @@ Severity: Error, Id: CPMR0020, Summary: An Email Address should not be used in Metadata file., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0020 + HelpUrl: https://ch0.co/rules/cpmr0020 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlElementIsNotPresent.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlElementIsNotPresent.verified.txt index d245344..2ce5462 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlElementIsNotPresent.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlElementIsNotPresent.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0009, + HelpUrl: https://ch0.co/rules/cpmr0009, Id: CPMR0009, Message: A project URL for the software is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value= .verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value= .verified.txt index d245344..2ce5462 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value= .verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value= .verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0009, + HelpUrl: https://ch0.co/rules/cpmr0009, Id: CPMR0009, Message: A project URL for the software is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=-- -.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=-- -.verified.txt index d245344..2ce5462 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=-- -.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=-- -.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0009, + HelpUrl: https://ch0.co/rules/cpmr0009, Id: CPMR0009, Message: A project URL for the software is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=.verified.txt index d245344..2ce5462 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0009, + HelpUrl: https://ch0.co/rules/cpmr0009, Id: CPMR0009, Message: A project URL for the software is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=null.verified.txt index d245344..2ce5462 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=null.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldFlagWhenProjectUrlIsEmpty_value=null.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0009, + HelpUrl: https://ch0.co/rules/cpmr0009, Id: CPMR0009, Message: A project URL for the software is either missing or empty., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index 54bfb86..771ff60 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/ProjectUrlElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,6 +3,6 @@ Severity: Error, Id: CPMR0009, Summary: A project URL for the software is either missing or empty., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0009 + HelpUrl: https://ch0.co/rules/cpmr0009 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndLicenseUrlIsMissing.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndLicenseUrlIsMissing.verified.txt index 3e1524b..bcc6eda 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndLicenseUrlIsMissing.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndLicenseUrlIsMissing.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0007, + HelpUrl: https://ch0.co/rules/cpmr0007, Id: CPMR0007, Message: The license URL is absent, despite the requirement for license acceptance., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value= .verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value= .verified.txt index 3e1524b..bcc6eda 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value= .verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value= .verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0007, + HelpUrl: https://ch0.co/rules/cpmr0007, Id: CPMR0007, Message: The license URL is absent, despite the requirement for license acceptance., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=.verified.txt index 3e1524b..bcc6eda 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0007, + HelpUrl: https://ch0.co/rules/cpmr0007, Id: CPMR0007, Message: The license URL is absent, despite the requirement for license acceptance., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=null.verified.txt index 3e1524b..bcc6eda 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=null.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldFlagWhenLicenseAcceptanceIsTrueAndNoLicenseUrl_value=null.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0007, + HelpUrl: https://ch0.co/rules/cpmr0007, Id: CPMR0007, Message: The license URL is absent, despite the requirement for license acceptance., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index 1ea0e59..7544334 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/RequireLicenceAcceptanceElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,6 +3,6 @@ Severity: Error, Id: CPMR0007, Summary: The license URL is absent, despite the requirement for license acceptance., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0007 + HelpUrl: https://ch0.co/rules/cpmr0007 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=,taggie.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=,taggie.verified.txt index 78ba220..199f6fb 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=,taggie.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=,taggie.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0014, + HelpUrl: https://ch0.co/rules/cpmr0014, Id: CPMR0014, Message: The tags have been separated by a comma; they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=NOTSILENT.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=NOTSILENT.verified.txt new file mode 100644 index 0000000..b0fb776 --- /dev/null +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=NOTSILENT.verified.txt @@ -0,0 +1,8 @@ +[ + { + HelpUrl: https://ch0.co/rules/cpmr0067, + Id: CPMR0067, + Message: The tag 'notSilent' is being used., + Severity: Note + } +] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=tag1, tag2 tag3.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=tag1, tag2 tag3.verified.txt index 78ba220..199f6fb 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=tag1, tag2 tag3.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=tag1, tag2 tag3.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0014, + HelpUrl: https://ch0.co/rules/cpmr0014, Id: CPMR0014, Message: The tags have been separated by a comma; they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=taggie,.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=taggie,.verified.txt index 78ba220..199f6fb 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=taggie,.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagCommaSeparatedTags_tags=taggie,.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0014, + HelpUrl: https://ch0.co/rules/cpmr0014, Id: CPMR0014, Message: The tags have been separated by a comma; they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags= .verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags= .verified.txt index 8afce26..2a9acaa 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags= .verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags= .verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0023, + HelpUrl: https://ch0.co/rules/cpmr0023, Id: CPMR0023, Message: Packages require at least one tag, and they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=-- -.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=-- -.verified.txt index 8afce26..2a9acaa 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=-- -.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=-- -.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0023, + HelpUrl: https://ch0.co/rules/cpmr0023, Id: CPMR0023, Message: Packages require at least one tag, and they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=.verified.txt index 8afce26..2a9acaa 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0023, + HelpUrl: https://ch0.co/rules/cpmr0023, Id: CPMR0023, Message: Packages require at least one tag, and they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=null.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=null.verified.txt index 8afce26..2a9acaa 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=null.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagEmptyTags_tags=null.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0023, + HelpUrl: https://ch0.co/rules/cpmr0023, Id: CPMR0023, Message: Packages require at least one tag, and they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagMissingTagsElement.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagMissingTagsElement.verified.txt index 8afce26..2a9acaa 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagMissingTagsElement.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldFlagMissingTagsElement.verified.txt @@ -1,6 +1,6 @@ [ { - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0023, + HelpUrl: https://ch0.co/rules/cpmr0023, Id: CPMR0023, Message: Packages require at least one tag, and they must be separated by a space., Severity: Error diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt index 868d935..44f1bd5 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.ShouldReturnAvailableRulesForImplementation.verified.txt @@ -3,12 +3,18 @@ Severity: Error, Id: CPMR0014, Summary: The tags have been separated by a comma; they must be separated by a space., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0014 + HelpUrl: https://ch0.co/rules/cpmr0014 }, { Severity: Error, Id: CPMR0023, Summary: Packages require at least one tag, and they must be separated by a space., - HelpUrl: https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/cpmr0023 + HelpUrl: https://ch0.co/rules/cpmr0023 + }, + { + Severity: Note, + Id: CPMR0067, + Summary: The tag 'notSilent' is being used., + HelpUrl: https://ch0.co/rules/cpmr0067 } ] \ No newline at end of file diff --git a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.cs b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.cs index e4cc194..a25992d 100644 --- a/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.cs +++ b/src/Chocolatey.Community.Validation.Tests/Rules/TagsElementRulesTests.cs @@ -5,12 +5,14 @@ namespace Chocolatey.Community.Validation.Tests.Rules using Chocolatey.Community.Validation.Rules; using NUnit.Framework; - [Category("Requirements")] public class TagsElementRulesTests : RuleTestBase { - [TestCase(",taggie")] - [TestCase("taggie,")] - [TestCase("tag1, tag2 tag3")] + [TestCase(",taggie", Category = "Requirements")] + [TestCase("taggie,", Category = "Requirements")] + [TestCase("tag1, tag2 tag3", Category = "Requirements")] + [TestCase("notSilent", Category = "Notes")] + [TestCase("notsilent", Category = "Notes")] + [TestCase("NOTSILENT", Category = "Notes")] public async Task ShouldFlagCommaSeparatedTags(string tags) { var testContent = GetTestContent(tags); @@ -18,6 +20,7 @@ public async Task ShouldFlagCommaSeparatedTags(string tags) await VerifyNuspec(testContent); } + [Category("Requirements")] [TestCaseSource(nameof(EmptyTestValues))] public async Task ShouldFlagEmptyTags(string tags) { @@ -27,6 +30,7 @@ public async Task ShouldFlagEmptyTags(string tags) } [Test] + [Category("Requirements")] public async Task ShouldFlagMissingTagsElement() { const string testContent = @" @@ -48,6 +52,7 @@ public async Task ShouldFlagMissingTagsElement() } [Test] + [Category("Requirements")] public async Task ShouldNotFlagTagsNotContainingAComma() { var testContent = GetTestContent("awesome-tag with space separated"); @@ -56,6 +61,7 @@ public async Task ShouldNotFlagTagsNotContainingAComma() } [Test] + [Category("Requirements")] public async Task ShouldNotFlagWhenTagsIsNotEmpty() { var testContent = GetTestContent("some awesome tags"); diff --git a/src/Chocolatey.Community.Validation/PublicAPI.Unshipped.txt b/src/Chocolatey.Community.Validation/PublicAPI.Unshipped.txt index 68cd5a9..8aaad14 100644 --- a/src/Chocolatey.Community.Validation/PublicAPI.Unshipped.txt +++ b/src/Chocolatey.Community.Validation/PublicAPI.Unshipped.txt @@ -6,6 +6,8 @@ Chocolatey.Community.Validation.Registration.ChocolateyCCRRegistrationModule.Reg Chocolatey.Community.Validation.Registration.ChocolateyCCRRegistrationModule.register_dependencies(chocolatey.infrastructure.app.registration.IContainerRegistrator! registrator, chocolatey.infrastructure.app.configuration.ChocolateyConfiguration? configuration) -> void Chocolatey.Community.Validation.Rules.AnyElementRules Chocolatey.Community.Validation.Rules.AnyElementRules.AnyElementRules() -> void +Chocolatey.Community.Validation.Rules.AuthorMatchesMaintainerRule +Chocolatey.Community.Validation.Rules.AuthorMatchesMaintainerRule.AuthorMatchesMaintainerRule() -> void Chocolatey.Community.Validation.Rules.CCRMetadataRuleBase Chocolatey.Community.Validation.Rules.CCRMetadataRuleBase.CCRMetadataRuleBase() -> void Chocolatey.Community.Validation.Rules.CopyrightElementRules @@ -14,6 +16,8 @@ Chocolatey.Community.Validation.Rules.DependenciesElementRules Chocolatey.Community.Validation.Rules.DependenciesElementRules.DependenciesElementRules() -> void Chocolatey.Community.Validation.Rules.DescriptionElementRules Chocolatey.Community.Validation.Rules.DescriptionElementRules.DescriptionElementRules() -> void +Chocolatey.Community.Validation.Rules.IconUrlElementRules +Chocolatey.Community.Validation.Rules.IconUrlElementRules.IconUrlElementRules() -> void Chocolatey.Community.Validation.Rules.IdElementRules Chocolatey.Community.Validation.Rules.IdElementRules.IdElementRules() -> void Chocolatey.Community.Validation.Rules.NuspecContainsEmailsRule @@ -29,9 +33,11 @@ Chocolatey.Community.Validation.Validations.CommunityRepositoryPushValidation.Co Chocolatey.Community.Validation.Validations.CommunityRepositoryPushValidation.Validate(chocolatey.infrastructure.app.configuration.ChocolateyConfiguration! config) -> System.Collections.Generic.ICollection! Chocolatey.Community.Validation.Validations.CommunityRepositoryPushValidation.validate(chocolatey.infrastructure.app.configuration.ChocolateyConfiguration! config) -> System.Collections.Generic.ICollection! override Chocolatey.Community.Validation.Rules.AnyElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! +override Chocolatey.Community.Validation.Rules.AuthorMatchesMaintainerRule.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! override Chocolatey.Community.Validation.Rules.CopyrightElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! override Chocolatey.Community.Validation.Rules.DependenciesElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! override Chocolatey.Community.Validation.Rules.DescriptionElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! +override Chocolatey.Community.Validation.Rules.IconUrlElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! override Chocolatey.Community.Validation.Rules.IdElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! override Chocolatey.Community.Validation.Rules.NuspecContainsEmailsRule.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! override Chocolatey.Community.Validation.Rules.RequireLicenseAcceptanceElementRules.Validate(NuGet.Packaging.NuspecReader! reader) -> System.Collections.Generic.IEnumerable! diff --git a/src/Chocolatey.Community.Validation/Rules/AuthorMatchesMaintainerRule.cs b/src/Chocolatey.Community.Validation/Rules/AuthorMatchesMaintainerRule.cs new file mode 100644 index 0000000..6e817cb --- /dev/null +++ b/src/Chocolatey.Community.Validation/Rules/AuthorMatchesMaintainerRule.cs @@ -0,0 +1,59 @@ +namespace Chocolatey.Community.Validation.Rules +{ + using System; + using System.Collections.Generic; + using System.Linq; + using chocolatey.infrastructure.rules; + + public sealed class AuthorMatchesMaintainerRule : CCRMetadataRuleBase + { + private const string RuleId = "CPMR0068"; + + public override IEnumerable Validate(global::NuGet.Packaging.NuspecReader reader) + { + if (reader is null) + { + throw new ArgumentNullException(nameof(reader)); + } + + var owners = GetNormalized(reader.GetOwners()).ToArray(); + var authors = GetNormalized(reader.GetAuthors()).ToArray(); + + if (owners.Length != authors.Length || owners.Length == 0) + { + yield break; + } + + for (var i = 0; i < owners.Length; i++) + { + if (string.Compare(owners[i], authors[i], StringComparison.OrdinalIgnoreCase) != 0) + { + yield break; + } + } + + yield return GetRule(RuleId); + } + + protected internal override IEnumerable<(RuleType severity, string? id, string summary)> GetRulesInformation() + { + yield return (RuleType.Note, RuleId, "The package maintainer field (owners) matches the software author field (authors) in the nuspec."); + } + + private static IEnumerable GetNormalized(string content) + { + if (string.IsNullOrWhiteSpace(content)) + { + yield break; + } + + foreach (var owner in content.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)) + { + if (!string.IsNullOrWhiteSpace(owner)) + { + yield return owner; + } + } + } + } +} diff --git a/src/Chocolatey.Community.Validation/Rules/CCRMetadataRuleBase.cs b/src/Chocolatey.Community.Validation/Rules/CCRMetadataRuleBase.cs index d765de9..02f1a60 100644 --- a/src/Chocolatey.Community.Validation/Rules/CCRMetadataRuleBase.cs +++ b/src/Chocolatey.Community.Validation/Rules/CCRMetadataRuleBase.cs @@ -18,7 +18,7 @@ protected sealed override IEnumerable GetRules() } else { - var helpUrl = $"https://docs.chocolatey.org/en-us/community-repository/moderation/package-validator/rules/{id!.ToLowerInvariant()}"; + var helpUrl = $"https://ch0.co/rules/{id!.ToLowerInvariant()}"; yield return new ImmutableRule(severity, id, summary, helpUrl); } } diff --git a/src/Chocolatey.Community.Validation/Rules/DependenciesElementRules.cs b/src/Chocolatey.Community.Validation/Rules/DependenciesElementRules.cs index af812cd..1757a01 100644 --- a/src/Chocolatey.Community.Validation/Rules/DependenciesElementRules.cs +++ b/src/Chocolatey.Community.Validation/Rules/DependenciesElementRules.cs @@ -11,6 +11,8 @@ namespace Chocolatey.Community.Validation.Rules public sealed class DependenciesElementRules : CCRMetadataRuleBase { private const string DeprecatedNoDependencyRuleId = "CPMR0017"; + private const string ChocolateyDependencyRuleId = "CPMR0062"; + private const string HookDependencyRuleId = "CPMR0074"; public override IEnumerable Validate(global::NuGet.Packaging.NuspecReader reader) { @@ -26,11 +28,29 @@ public override IEnumerable Validate(global::NuGet.Packaging.NuspecR { yield return GetRule(DeprecatedNoDependencyRuleId, "A dependency is required for deprecated packages."); } + + foreach (var dependency in dependencies) + { + if (dependency.Id.Equals("chocolatey", StringComparison.OrdinalIgnoreCase)) + { + var message = dependency.VersionRange.HasLowerBound || dependency.VersionRange.HasUpperBound ? + "A dependency on Chocolatey CLI was found. Ensure that you use functionality that requires the specified version range of Chocolatey CLI." : + "An open ended dependency on Chocolatey CLI was found. Ensure this was not added by a mistake."; + + yield return GetRule(ChocolateyDependencyRuleId, message); + } + else if (dependency.Id.EndsWith(".hook", StringComparison.OrdinalIgnoreCase)) + { + yield return GetRule(HookDependencyRuleId, $"Package has dependency on {dependency.Id} package. Hook packages should not be defined as a dependency."); + } + } } protected internal override IEnumerable<(RuleType severity, string? id, string summary)> GetRulesInformation() { yield return (RuleType.Error, DeprecatedNoDependencyRuleId, "Deprecated packages must have a dependency."); + yield return (RuleType.Note, ChocolateyDependencyRuleId, "A dependency on Chocolatey CLI has been added."); + yield return (RuleType.Error, HookDependencyRuleId, "Package has dependency on .hook package."); } } } diff --git a/src/Chocolatey.Community.Validation/Rules/IconUrlElementRules.cs b/src/Chocolatey.Community.Validation/Rules/IconUrlElementRules.cs new file mode 100644 index 0000000..d295eec --- /dev/null +++ b/src/Chocolatey.Community.Validation/Rules/IconUrlElementRules.cs @@ -0,0 +1,57 @@ +namespace Chocolatey.Community.Validation.Rules +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using chocolatey; + using chocolatey.infrastructure.rules; + + public sealed class IconUrlElementRules : CCRMetadataRuleBase + { + private const string RawUrlRuleId = "CPMR0076"; + + public override IEnumerable Validate(global::NuGet.Packaging.NuspecReader reader) + { + if (reader is null) + { + throw new ArgumentNullException(nameof(reader)); + } + + var iconUrl = reader.GetIconUrl(); + + if (!Uri.TryCreate(iconUrl, UriKind.Absolute, out var iconUri)) + { + yield break; + } + + if (IsGitHubIconUrl(iconUri)) + { + yield return GetRule(RawUrlRuleId); + } + else if (iconUri.Host.IsEqualTo("cdn.rawgit.com") || iconUri.Host.IsEqualTo("rawgit.com")) + { + yield return GetRule(RawUrlRuleId, "Icon URL uses a URL that is a RawGit URL."); + } + } + + private bool IsGitHubIconUrl(Uri iconUri) + { + var hosts = new[] + { + "raw.githubusercontent.com", + "githubusercontent.com", + "github.com", + "gist.github.com" + }; + + return hosts.Contains(iconUri.Host.ToLowerInvariant()); + } + + protected internal override IEnumerable<(RuleType severity, string? id, string summary)> GetRulesInformation() + { + yield return (RuleType.Error, RawUrlRuleId, "Icon URL uses a URL that is a GitHub raw URL."); + } + } +} diff --git a/src/Chocolatey.Community.Validation/Rules/IdElementRules.cs b/src/Chocolatey.Community.Validation/Rules/IdElementRules.cs index b47b454..0abebed 100644 --- a/src/Chocolatey.Community.Validation/Rules/IdElementRules.cs +++ b/src/Chocolatey.Community.Validation/Rules/IdElementRules.cs @@ -7,8 +7,11 @@ namespace Chocolatey.Community.Validation.Rules public sealed class IdElementRules : CCRMetadataRuleBase { - private const string PreReleaseRuleId = "CPMR0024"; private const string ConfigRuleId = "CPMR0029"; + private const string DotsInIdentifierRuleId = "CPMR0061"; + private const string PreReleaseRuleId = "CPMR0024"; + private const string UnderscoreRuleId = "CPMR0070"; + private const string TooLongRuleId = "CPMR0069"; public override IEnumerable Validate(global::NuGet.Packaging.NuspecReader reader) { @@ -35,12 +38,68 @@ public override IEnumerable Validate(global::NuGet.Packaging.NuspecR { yield return GetRule(ConfigRuleId); } + + if (id.IndexOf('_') >= 0) + { + yield return GetRule(UnderscoreRuleId); + } + + var subId = GetSubIdentifier(id); + + if (subId.IndexOf('.') > -1) + { + yield return GetRule(DotsInIdentifierRuleId); + } + + if (subId.Length >= 20 && subId.IndexOf('-') >= 0) + { + foreach (var partId in subId.Split('-')) + { + if (partId.Length >= 20) + { + yield return GetRule(TooLongRuleId, "Package ID contains {0} characters with one or more parts being more than 20 characters.".FormatWith(subId.Length)); + break; + } + } + } + else if (subId.Length >= 20) + { + yield return GetRule(TooLongRuleId, "Package ID contains {0} characters without being separated by a dash (-).".FormatWith(subId.Length)); + } } protected internal override IEnumerable<(RuleType severity, string? id, string summary)> GetRulesInformation() { yield return (RuleType.Error, PreReleaseRuleId, "Package ID includes a prerelease version name."); yield return (RuleType.Error, ConfigRuleId, "Package ID ends with the reserved suffix `.config`."); + yield return (RuleType.Note, DotsInIdentifierRuleId, "Package ID contains dots (.), that is not part of the accepted suffixes."); + yield return (RuleType.Note, UnderscoreRuleId, "Package ID contains underscores (_). Normally a Package ID is separated by dashes (-)."); + yield return (RuleType.Note, TooLongRuleId, "Package ID contains too many characters without being separated by a dash (-)."); + } + + private static string GetSubIdentifier(string id) + { + var possibleSuffixes = new[] + { + ".portable", + ".commandline", + ".install", + ".extension", + ".template", + ".powershell", + // This is not an accepted suffix, but an existing rule aready handle this. So we ignore it. + ".config" + }; + + foreach (var suffix in possibleSuffixes) + { + if (id.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)) + { + return id.Substring(0, id.Length - suffix.Length); + } + } + + return id; } } } diff --git a/src/Chocolatey.Community.Validation/Rules/TagsElementRules.cs b/src/Chocolatey.Community.Validation/Rules/TagsElementRules.cs index 7c433fe..ef88876 100644 --- a/src/Chocolatey.Community.Validation/Rules/TagsElementRules.cs +++ b/src/Chocolatey.Community.Validation/Rules/TagsElementRules.cs @@ -9,6 +9,7 @@ public sealed class TagsElementRules : CCRMetadataRuleBase { private const string CommaRuleId = "CPMR0014"; private const string EmptyRuleId = "CPMR0023"; + private const string NotSilentRuleId = "CPMR0067"; public override IEnumerable Validate(global::NuGet.Packaging.NuspecReader reader) { @@ -27,12 +28,18 @@ public override IEnumerable Validate(global::NuGet.Packaging.NuspecR { yield return GetRule(CommaRuleId); } + + if (tags.IndexOf("notSilent", StringComparison.OrdinalIgnoreCase) >= 0) + { + yield return GetRule(NotSilentRuleId); + } } protected internal override IEnumerable<(RuleType severity, string? id, string summary)> GetRulesInformation() { yield return (RuleType.Error, CommaRuleId, "The tags have been separated by a comma; they must be separated by a space."); yield return (RuleType.Error, EmptyRuleId, "Packages require at least one tag, and they must be separated by a space."); + yield return (RuleType.Note, NotSilentRuleId, "The tag 'notSilent' is being used."); } } }