Skip to content

Commit

Permalink
setup.py: add a lint command
Browse files Browse the repository at this point in the history
Add a command to perform coding style checks.

Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
Andrea Righi committed Jun 19, 2023
1 parent fae8a0d commit 30b39f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ disable = invalid-name,
too-many-statements,
redefined-outer-name,
# End of default disables
similarities,
too-many-branches,
too-many-return-statements,
too-few-public-methods,
Expand Down
22 changes: 21 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,31 @@
import os
import sys
import subprocess
from setuptools import setup
from glob import glob
from setuptools import setup, Command
from setuptools.command.build_py import build_py
from setuptools.command.egg_info import egg_info
from virtme_ng.version import VERSION


class LintCommand(Command):
description = "Run coding style checks"
user_options = []

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
for cmd in ("flake8", "pylint"):
command = [cmd]
for pattern in ("*.py", "virtme/*.py", "virtme/*/*.py", "virtme_ng/*.py"):
command += glob(pattern)
subprocess.call(command)


class BuildPy(build_py):
def run(self):
subprocess.check_call(
Expand Down Expand Up @@ -65,6 +84,7 @@ def run(self):
cmdclass={
"build_py": BuildPy,
"egg_info": EggInfo,
"lint": LintCommand,
},
data_files=[("/etc", ["cfg/virtme-ng.conf"])],
scripts=[
Expand Down

0 comments on commit 30b39f0

Please sign in to comment.