Skip to content

Commit

Permalink
Merge branch 'master' into pkg_nature
Browse files Browse the repository at this point in the history
  • Loading branch information
melis-m committed Sep 22, 2019
2 parents caca88d + 6593347 commit e92ee19
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys

global _args
global _argst
global _parser


Expand Down
2 changes: 2 additions & 0 deletions core/check.py
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()
29 changes: 29 additions & 0 deletions core/checks/version_validity.py
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()

0 comments on commit e92ee19

Please sign in to comment.