Skip to content

Commit

Permalink
Fixed pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
krcb197 committed Aug 10, 2022
1 parent b7300c6 commit 434389b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
3 changes: 0 additions & 3 deletions src/peakrdl_cheader/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"""
import os
from pathlib import Path
from shutil import copyfile
from typing import List
from glob import glob

import jinja2 as jj

Expand Down Expand Up @@ -209,4 +207,3 @@ def create_empty_package(package_path:str) -> None:
Path(package_path).mkdir(parents=True, exist_ok=True)
Path(os.path.join(package_path, 'reg_model')).mkdir(parents=True, exist_ok=True)
Path(os.path.join(package_path, 'tests')).mkdir(parents=True, exist_ok=True)

60 changes: 0 additions & 60 deletions src/peakrdl_cheader/peakcheader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@

#!/usr/bin/env python3
import argparse
import os
import subprocess
import unittest.loader
from typing import List, Optional

import coverage # type: ignore

from systemrdl import RDLCompiler # type: ignore
from systemrdl.node import Node, AddrmapNode # type: ignore
from peakrdl.ipxact import IPXACTImporter # type: ignore
Expand Down Expand Up @@ -40,21 +35,9 @@ def build_command_line_parser() -> argparse.ArgumentParser:
'global addrmap)')
parser.add_argument('--verbose', '-v', action='count', default=0,
help='set logging verbosity')
parser.add_argument('--autoformat', action='store_true',
help='use autopep8 on generated code')
parser.add_argument('--ipxact', dest='ipxact', nargs='*',
type=str)

checker = parser.add_argument_group('post-generate checks')
checker.add_argument('--lint', action='store_true',
help='run pylint on the generated python')
checker.add_argument('--test', action='store_true',
help='run unittests for the created')
checker.add_argument('--coverage', action='store_true',
help='run a coverage report on the unittests')
checker.add_argument('--html_coverage_out',
help='output director (default: %(default)s)')

return parser


Expand Down Expand Up @@ -108,22 +91,6 @@ def generate(root:Node, outdir:str) -> List[str]:

return modules

def run_lint(root, outdir):
"""
Run the lint checks using pylint on a directory
Args:
root: name of the generated package (directory)
outdir: location where the package has been written
Returns:
"""
subprocess.run(['pylint', '--rcfile',
os.path.join('tests','pylint.rc'),
os.path.join(outdir, root)],
check=False)

def main_function():
"""
Main function for the Command Line tool, this needs to be separated out so that it can be
Expand All @@ -148,32 +115,5 @@ def main_function():
print('***************************************************************')
generate(spec, args.outdir)

if args.lint:
print('***************************************************************')
print('* Lint Checks *')
print('***************************************************************')
run_lint(outdir=args.outdir, root=spec.inst_name)
if args.test:
print('***************************************************************')
print('* Unit Test Run *')
print('***************************************************************')
if args.coverage:
cov = coverage.Coverage(
include=[f'*\\{spec.inst_name}\\reg_model\\*.py',
f'*\\{spec.inst_name}\\tests\\*.py'])
cov.start()
tests = unittest.TestLoader().discover(
start_dir=os.path.join(args.outdir, spec.inst_name, 'tests'),
top_level_dir=args.outdir)
runner = unittest.TextTestRunner()
runner.run(tests)

if args.coverage:
cov.stop()

if args.html_coverage_out is not None:
cov.html_report(directory=args.html_coverage_out)


if __name__ == '__main__':
main_function()

0 comments on commit 434389b

Please sign in to comment.