Skip to content

Commit

Permalink
Extend the linter to check the package name against its folder and nu…
Browse files Browse the repository at this point in the history
…spec file
  • Loading branch information
d35ha committed Jun 13, 2024
1 parent bf9450d commit 3629f6a
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 3629f6a

Please sign in to comment.