diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe7b14b1ef251e3e87e9eafe6d5f0a259bcad52e..008f958b8ac61f6209c21adfc24891bad6e69b74 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,6 @@ variables: cache: paths: - .cache/pip - - venv/ stages: - test @@ -31,6 +30,36 @@ secret_detection: - source venv/bin/activate - pip install "." +pyright: + stage: static analysis + needs: [flake8] + before_script: + - *python + - pip install pyright + script: + - pyright src/ --outputjson > report_raw.json + after_script: + - cat report_raw.json + artifacts: + paths: + - report_raw.json + +code-quality: + stage: static analysis + needs: + - job: pyright + artifacts: true + image: node:21 + before_script: + - npm i -g pyright-to-gitlab-ci + script: + - pyright-to-gitlab-ci --src report_raw.json --output report.json --base_path . + artifacts: + paths: + - report.json + reports: + codequality: report.json + pylint: stage: static analysis script: @@ -63,22 +92,6 @@ mypy: - mypy src/scientific_plots - mypy src/ -pyright: - stage: static analysis - needs: [flake8] - image: node:21 - before_script: - - npm i -g pyright - - npm i -g pyright-to-gitlab-ci - script: - - pyright src/ --outputjson > report_raw.json || true - - cat report_raw.json - - pyright-to-gitlab-ci --src report_raw.json --output report.json --base_path . - artifacts: - paths: - - report.json - reports: - codequality: report.json python-tests: stage: testing diff --git a/src/scientific_plots/utilities.py b/src/scientific_plots/utilities.py index 79a1d7f39752f0dd0e428f20148b040942f984a5..9faa8b3de6f0c03f0a681cfbf6a9daaab9d441ef 100644 --- a/src/scientific_plots/utilities.py +++ b/src/scientific_plots/utilities.py @@ -12,7 +12,8 @@ from subprocess import Popen, PIPE from sys import __stdout__ from os import mkdir from os.path import dirname, exists -from typing import Iterable, Optional, List, Callable, TypeVar, Union, Any +from typing import ( + Iterable, Optional, List, Callable, TypeVar, Union, Any, Tuple) from pathlib import Path from collections import OrderedDict @@ -84,10 +85,10 @@ def filter_function(x: str) -> bool: return True -def filter_argv(X: list[str]) -> list[str]: +def filter_argv(X: List[str]) -> List[str]: """removes unessecery entries from argv which have been generated by abaqus""" - Y: list[str] = list(X) + Y: List[str] = list(X) for i, x in enumerate(X): if not filter_function(x): del Y[i] @@ -96,7 +97,7 @@ def filter_argv(X: list[str]) -> list[str]: return Y -def dumb_plot(X: list[float], Y: list[float], +def dumb_plot(X: List[float], Y: List[float], title: str = "title", log: bool = False) -> None: """plot X and Y using dumb gnuplot""" try: @@ -124,12 +125,12 @@ def dumb_plot(X: list[float], Y: list[float], def read_file(filename: Union[str, Path], header: int = 0, - type_: type = float) -> tuple[list[float], ...]: + type_: type = float) -> Tuple[List[float], ...]: """read a file with given filename into a python-tuple. Skip n='header' lines in the beginning of the document""" # reads a given file and returns lists - lists: list[list[float]] = [] + lists: List[List[float]] = [] with open(filename, "r", encoding="utf-8") as input_file: for i, line in enumerate(input_file): if i < header: