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 12, 2024
1 parent bf9450d commit 6351a0f
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))
pid = dom.getElementsByTagName("id")[0].firstChild.nodeValue

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

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

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


Expand Down

0 comments on commit 6351a0f

Please sign in to comment.