Skip to content

Commit

Permalink
Merge pull request #1089 from d35ha/linter-check-package-name
Browse files Browse the repository at this point in the history
Check the package name against its folder and nuspec file
  • Loading branch information
emtuls authored Jun 13, 2024
2 parents 24c47d7 + 3629f6a commit 17ed8ee
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit 17ed8ee

Please sign in to comment.