-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pkg_nature
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
import os | ||
import sys | ||
|
||
global _args | ||
global _argst | ||
global _parser | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import core.checks.executable as exe | ||
import core.checks.syntax_check as stx | ||
import core.checks.kind as kind | ||
import core.checks.version_validity as version | ||
|
||
|
||
def check_package(pkg): | ||
exe.ExecCheck().run() | ||
stx.DescriptionCheck(pkg).run() | ||
kind.KindCheck(pkg).run() | ||
version.VersionValidityCheck(pkg).run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import core.log as log | ||
import core.checks.base as base | ||
import semver | ||
|
||
|
||
class VersionValidityCheck(base.CheckWithManifest): | ||
def __init__(self, pkg): | ||
super().__init__(pkg, [pkg.manifest['version']]) | ||
|
||
def validate(self, version): | ||
try: | ||
semver.valid(version, loose=False) | ||
return True | ||
except AttributeError: | ||
return False | ||
|
||
def show(self, version): | ||
log.e(f"The version isn't semver compliant") | ||
|
||
def diff(self, version): | ||
log.w("No fix can be done automatically") | ||
return False | ||
|
||
def fix(self, version): | ||
log.w("No fix can be done automatically") | ||
|
||
def run(self): | ||
log.s("Checking package version") | ||
super().run() |