From 4c47dd31b430b6ec1460823c0be5c96deec0ab83 Mon Sep 17 00:00:00 2001 From: Vishnu Challa Date: Wed, 18 Dec 2024 10:11:14 -0500 Subject: [PATCH] Fix liniting errors and update lint workflow Signed-off-by: Vishnu Challa --- .github/workflows/builders.yaml | 4 ---- .github/workflows/pylint.yaml | 12 ++++++------ .github/workflows/tests.yaml | 3 +-- orion.py | 2 +- pkg/config.py | 3 +-- requirements.txt | 1 + 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/builders.yaml b/.github/workflows/builders.yaml index 4e64167..dedef4f 100644 --- a/.github/workflows/builders.yaml +++ b/.github/workflows/builders.yaml @@ -2,10 +2,6 @@ name: Builders on: workflow_call: workflow_dispatch: - pull_request_target: - branches: - - master - - main jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/pylint.yaml b/.github/workflows/pylint.yaml index 267f7eb..e37837e 100644 --- a/.github/workflows/pylint.yaml +++ b/.github/workflows/pylint.yaml @@ -2,10 +2,6 @@ name: Pylint on: workflow_call: workflow_dispatch: - pull_request_target: - branches: - - master - - main jobs: lint: runs-on: ubuntu-latest @@ -13,7 +9,12 @@ jobs: matrix: python-version: ["3.11"] steps: - - uses: actions/checkout@v3 + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 @@ -23,7 +24,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint pip install -r requirements.txt - name: Analysing the code with pylint diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 15f31f5..87597d5 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -20,7 +20,7 @@ jobs: file-install: false - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 ref: ${{ github.event.pull_request.head.sha }} @@ -34,7 +34,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint pip install -r requirements.txt pip install . diff --git a/orion.py b/orion.py index d9a21b9..3690213 100644 --- a/orion.py +++ b/orion.py @@ -124,7 +124,7 @@ def cmd_analysis(**kwargs): logger_instance = SingletonLogger(debug=level, name="Orion") logger_instance.info("🏹 Starting Orion in command-line mode") if len(kwargs["ack"]) > 1 : - kwargs["ackMap"] = load_ack(kwargs["ack"]) + kwargs["ackMap"] = load_ack(kwargs["ack"]) kwargs["configMap"] = load_config(kwargs["config"]) output, regression_flag = run(**kwargs) if output is None: diff --git a/pkg/config.py b/pkg/config.py index de8a17d..69c4791 100644 --- a/pkg/config.py +++ b/pkg/config.py @@ -55,6 +55,7 @@ def load_config(config: str, parameters: Dict= None) -> Dict[str, Any]: return rendered_config def load_ack(ack: str) -> Dict[str,Any]: + "Loads acknowledgment file content." logger_instance = SingletonLogger.getLogger("Orion") try: with open(ack, "r", encoding="utf-8") as template_file: @@ -67,8 +68,6 @@ def load_ack(ack: str) -> Dict[str,Any]: logger_instance.error("An error occurred: %s", e) sys.exit(1) - required_parameters = get_template_variables(template_content) - rendered_config = yaml.safe_load(template_content) return rendered_config diff --git a/requirements.txt b/requirements.txt index c36cce9..4e3031d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,3 +18,4 @@ python-multipart==0.0.9 scikit-learn==1.5.0 scipy==1.12.0 uvicorn==0.28.0 +pylint==3.3.2