diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 91dca89..fcb8ab4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,13 +28,10 @@ jobs: sudo apt-get install -y tree make wget curl cloc graphviz dot -V python -m pip install --upgrade pip - pip install --upgrade flake8 setuptools wheel twine - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi + pip install --upgrade setuptools wheel twine + pip install -r requirements.txt + pip install -r requirements-test.txt + pip install -r requirements-lint.txt - name: Basic lint with flake8 run: | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - flake8 ./plantumlcli --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Lint with flake8 - run: | - flake8 ./plantumlcli \ No newline at end of file + make flake diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index f884f3f..7b0f7ba 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -2,8 +2,6 @@ name: Repository Sync on: push: - schedule: - - cron: '0 1 * * *' jobs: sync: diff --git a/Makefile b/Makefile index 7b88336..e1ede51 100644 --- a/Makefile +++ b/Makefile @@ -46,3 +46,9 @@ docs: $(MAKE) -C "${DOC_DIR}" build pdocs: $(MAKE) -C "${DOC_DIR}" prod + +flake: + flake8 ./plantumlcli --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 ./plantumlcli --count --exit-zero \ + --max-complexity=10 --max-line-length=127 --statistics \ + --per-file-ignores="__init__.py:F401" diff --git a/plantumlcli/entry/cli.py b/plantumlcli/entry/cli.py index 940109a..b8a3074 100644 --- a/plantumlcli/entry/cli.py +++ b/plantumlcli/entry/cli.py @@ -72,7 +72,8 @@ def validate_concurrency(ctx: Context, param: Option, value: int): @click.option('-p', '--plantuml', envvar=PLANTUML_JAR_ENV, type=str, default=None, help=f'Path of plantuml jar file (will load from ${{{PLANTUML_JAR_ENV}}} when not given).') @click.option('-r', '--remote-host', envvar=PLANTUML_HOST_ENV, type=str, default=OFFICIAL_PLANTUML_HOST, - help=f'Remote host of the online plantuml editor (will load from ${{{PLANTUML_HOST_ENV}}} when not given).', + help=f'Remote host of the online plantuml editor ' + f'(will load from ${{{PLANTUML_HOST_ENV}}} when not given).', show_default=True) @click.option('-L', '--use-local', is_flag=True, help='Use local plantuml only.') @click.option('-R', '--use-remote', is_flag=True, help='Use remote plantuml only.') @@ -80,7 +81,7 @@ def validate_concurrency(ctx: Context, param: Option, value: int): @click.option('-u', '--url', is_flag=True, help='Print url of remote plantuml resource (ignore -L and -R).') @click.option('--homepage-url', is_flag=True, help='Print url of remote plantuml editor (ignore -L, -R and -u).') @click.option('-t', '--type', 'resource_type', default=PlantumlResourceType.PNG.name, - type=click.Choice(PlantumlResourceType.__members__.keys(), case_sensitive=False), + type=click.Choice(list(PlantumlResourceType.__members__.keys()), case_sensitive=False), help='Type of plantuml resource.', show_default=True) @click.option('-T', '--text', is_flag=True, help='Display text uml graph by stdout (ignore -t).') @click.option('-o', '--output', type=str, multiple=True, diff --git a/plantumlcli/entry/general.py b/plantumlcli/entry/general.py index 49a093e..a00c5d2 100644 --- a/plantumlcli/entry/general.py +++ b/plantumlcli/entry/general.py @@ -57,7 +57,7 @@ def print_check_info(check_type: PlantumlCheckType, pass -def print_text_graph(plantuml: Plantuml, sources: Tuple[str], concurrency: int): +def print_text_graph(plantuml: Plantuml, sources: Tuple[str], concurrency: int): # noqa """ Print text graph of source codes :param plantuml: plantuml object diff --git a/plantumlcli/utils/concurrent.py b/plantumlcli/utils/concurrent.py index dbc8080..a804224 100644 --- a/plantumlcli/utils/concurrent.py +++ b/plantumlcli/utils/concurrent.py @@ -12,10 +12,8 @@ def _default_final_error_process(errors: List[Tuple[int, _Ti, Exception]]): raise err -def linear_process(items: Iterable[_Ti], - process: Callable[[int, _Ti], _Tr], - post_process: Callable[[int, _Ti, _Tr], None], - concurrency: int = None, +def linear_process(items: Iterable[_Ti], process: Callable[[int, _Ti], _Tr], # noqa + post_process: Callable[[int, _Ti, _Tr], None], concurrency: int = None, skip_once_error: bool = True, final_error_process: Optional[Callable[[List[Tuple[int, _Ti, Exception]]], None]] = None): concurrency = concurrency or cpu_count()