Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the package name against its folder and nuspec file #1089

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/test/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,26 @@ def check(self, path):
return True


class PackageIdNotMatchingFolderOrNuspecName(Lint):
name = "package ID doesn't match package folder name or nuspec file name"
recommendation = "make sure the package ID is the same as the package folder name and the nuspec file name"

def check(self, path):
dom = minidom.parse(str(path))
pkg_id = dom.getElementsByTagName("id")[0].firstChild.data

nuspec = path.parts[-1]
folder = path.parts[-2]

return not (pkg_id == folder == nuspec[:-len(".nuspec")])

NUSPEC_LINTS = (
IncludesRequiredFieldsOnly(),
VersionFormatIncorrect(),
DoesNotListDependencyCommonVm(),
DependencyContainsUppercaseChar(),
VersionNotUpdated(),
PackageIdNotMatchingFolderOrNuspecName(),
)


Expand Down
Loading