Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
* release/0.2.0: (21 commits)
  (maint) Fix incorrect label used in config
  (chocolatey-community#58) Implement requirement rule CPMR0074
  (chocolatey-community#28) Add rule to disallow icon URL using GitHub links
  (chocolatey-community#37) Implement note rule CPMR0068
  (chocolatey-community#36) Implement note rule CPMR0067
  (maint) Set explicit PlatformTarget for console
  (maint) synced local '.github/ISSUE_TEMPLATE/' with remote '.github/ISSUE_TEMPLATE/'
  (chocolatey-community#38) Add rule for validating ID length
  (chocolatey-community#39) Add rule for validating underscore in ID
  (chocolatey-community#34) Implement note rule CPMR0061 - Id Contains "."
  (maint) synced local '.github/PULL_REQUEST_TEMPLATE.md' with remote '.github/PULL_REQUEST_TEMPLATE.md'
  (build) Update Chocolatey.Cake.Recipe to latest
  (chocolatey-community#35) Implement note rule CPMR0062
  (build) Update to latest Recipe package
  (maint) synced local '.github/ISSUE_TEMPLATE/' with remote '.github/ISSUE_TEMPLATE/'
  (chocolatey-community#32) Update Help URLs to short link
  (chocolatey-community#29) Add missing release notes to generated packages
  (maint) Update extension name in Readme
  (maint) synced local '.templates/' with remote '.github/GitReleaseManager/.templates/'
  (chocolatey-community#26) Use milestone for license URL replacement
  ...
  • Loading branch information
AdmiringWorm committed Dec 11, 2024
2 parents 8786128 + a99f0bd commit e88ef08
Show file tree
Hide file tree
Showing 118 changed files with 869 additions and 158 deletions.
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/zReportIssue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Please remove all comments before submitting.
-->
### Operating Systems Testing
<!-- If this is a code change, list the operating systems this has been tested on
- Windows Server 2008R2
- Windows 8.1
- Windows Server 2019
- Windows 10
...
-->

Expand All @@ -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
<!-- Make sure you have raised an issue for this pull request before
Expand Down
4 changes: 2 additions & 2 deletions .templates/default/issue-note.sbn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{
if issue_label == "Bug" || issue_label == "Bug Fix" || issue_label == "Bug Fixes"
}}- Fix - {{ issue.title }} - see [#{{ issue.number }}]({{ issue.html_url }}).
}}- Fix - {{ issue.title }} - see [#{{ issue.public_number }}]({{ issue.html_url }}).
{{ else
}}- {{ issue.title }} - see [#{{ issue.number }}]({{ issue.html_url }}).
}}- {{ issue.title }} - see [#{{ issue.public_number }}]({{ issue.html_url }}).
{{ end -}}
4 changes: 2 additions & 2 deletions .templates/default/release-info.sbn
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{
if issues.count > 0
if commits.count > 0
}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) being closed.
}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?{{ milestone.query_string }}) being closed.
{{ else
}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) closed.
}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?{{ milestone.query_string }}) closed.
{{ end
else if commits.count > 0
}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}).
Expand Down
2 changes: 1 addition & 1 deletion GitReleaseManager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ issue-labels-include:
- Dependency Change
issue-labels-exclude:
- Internal Refactoring
- BuildAutomation
- Build Automation
- NO RELEASE NOTES
issue-labels-alias:
- name: Documentation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chocolatey CCR Extension
# Chocolatey Community Validation Extension

This repository deals with how the implementation of validating rules valid for the Chocolatey Community Repository are implemented.
This project is meant to be published as a Chocolatey CLI extension that users can install to validate their packages does not violate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The implemented rules will run when creating a package, and when pushing a packa

- Only metadata/nuspec rules are currently supported.
</description>
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
<releaseNotes>https://github.com/chocolatey-community/chocolatey-community-validation/releases/tags/$version$</releaseNotes>

<dependencies>
<!-- We only specify the minimum version, as even breaking changes in Chocolatey CLI is unlikely to relate to the usages in this package -->
Expand Down
2 changes: 1 addition & 1 deletion recipe.cake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<OutputType>Exe</OutputType>
<Configurations>Debug;Release;DebugOfficial;ReleaseOfficial</Configurations>
<DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SolutionVersion.cs" Link="SolutionVersion.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
Original file line number Diff line number Diff line change
@@ -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
}
]
Original file line number Diff line number Diff line change
@@ -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
}
]
Original file line number Diff line number Diff line change
@@ -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
}
]
Original file line number Diff line number Diff line change
@@ -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
}
]
Original file line number Diff line number Diff line change
@@ -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<AuthorMatchesMaintainerRule>
{
[Test]
public async Task ShouldFlagRuleWhenAuthorAndMaintainerIsSame()
{
const string testContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns=""http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"">
<metadata>
<id>short-copyright</id>
<title>[Deprecated] Test PKG</title>
<version>1.0.0</version>
<authors>Package-Author</authors>
<owners>Package-Author</owners>
<packageSourceUrl>https://test-url.com/</packageSourceUrl>
</metadata>
<files />
</package>";

await VerifyNuspec(testContent);
}
[Test]
public async Task ShouldFlagRuleWhenAuthorAndMaintainerUsesDifferentCase()
{
const string testContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns=""http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"">
<metadata>
<id>short-copyright</id>
<title>[Deprecated] Test PKG</title>
<version>1.0.0</version>
<authors>Package-Author</authors>
<owners>package-author</owners>
<packageSourceUrl>https://test-url.com/</packageSourceUrl>
</metadata>
<files />
</package>";

await VerifyNuspec(testContent);
}

[Test]
public async Task ShouldFlagRuleWhenMultipleSameAuthorsAndMaintainers()
{
const string testContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns=""http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"">
<metadata>
<id>short-copyright</id>
<title>[Deprecated] Test PKG</title>
<version>1.0.0</version>
<authors>Package-Author Package-Maintainer</authors>
<owners>Package-Author Package-Maintainer</owners>
<packageSourceUrl>https://test-url.com/</packageSourceUrl>
</metadata>
<files />
</package>";

await VerifyNuspec(testContent);
}

[TestCaseSource(nameof(EmptyTestValues))]
public async Task ShouldNotFlagOnEmptyValues(string value)
{
const string testContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns=""http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"">
<metadata>
<id>short-copyright</id>
<title>[Deprecated] Test PKG</title>
<version>1.0.0</version>
<authors>{0}</authors>
<owners>{0}</owners>
<packageSourceUrl>https://test-url.com/</packageSourceUrl>
</metadata>
<files />
</package>";

await VerifyEmptyResults(testContent.FormatWith(value));
}

[Test]
public async Task ShouldNotFlagWhenDifferentMaintanerCountThanAuthors()
{
const string testContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns=""http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"">
<metadata>
<id>short-copyright</id>
<title>[Deprecated] Test PKG</title>
<version>1.0.0</version>
<authors>Package-Author</authors>
<owners>Package-Author Package-Maintainer</owners>
<packageSourceUrl>https://test-url.com/</packageSourceUrl>
</metadata>
<files />
</package>";

await VerifyEmptyResults(testContent);
}
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit e88ef08

Please sign in to comment.