From 051fe83cbd5a633e493a27762e4195dbd6954c59 Mon Sep 17 00:00:00 2001 From: R-Palazzo Date: Mon, 8 Apr 2024 10:59:24 +0100 Subject: [PATCH 1/4] add blank line --- .github/workflows/static_code_analysis.yml | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/static_code_analysis.yml diff --git a/.github/workflows/static_code_analysis.yml b/.github/workflows/static_code_analysis.yml new file mode 100644 index 00000000..bc92eeb8 --- /dev/null +++ b/.github/workflows/static_code_analysis.yml @@ -0,0 +1,33 @@ +name: Static Code Analysis + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + code-analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install bandit==1.7.7 + - name: Save code analysis + run: bandit -r . -x ./tests -f txt -o static_code_analysis.txt --exit-zero + - name: Create pull request + id: cpr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update static code analysis + title: Latest Code Analysis + body: "This is an auto-generated PR with the **latest** code analysis results." + branch: static-code-analysis + branch-suffix: short-commit-hash + base: main From 5c6b4aab995ba180efba10fa8d7ddf1ec74d32ba Mon Sep 17 00:00:00 2001 From: R-Palazzo Date: Mon, 8 Apr 2024 15:47:25 +0100 Subject: [PATCH 2/4] pyproject --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 434dc018..8432465c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,6 +126,7 @@ namespaces = false '*' = [ '* __pycache__', '*.py[co]', + 'static_code_analysis.txt', ] [tool.setuptools.dynamic] From cee23964d0f74c1a6c405c07488c372089660846 Mon Sep 17 00:00:00 2001 From: R-Palazzo Date: Mon, 8 Apr 2024 15:48:40 +0100 Subject: [PATCH 3/4] fix minimum version --- tasks.py | 2 +- tests/test_tasks.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tasks.py b/tasks.py index 26adfd76..909c0220 100644 --- a/tasks.py +++ b/tasks.py @@ -57,7 +57,7 @@ def _get_minimum_versions(dependencies, python_version): for dependency in dependencies: if '@' in dependency: name, url = dependency.split(' @ ') - min_versions[name] = f'{name} @ {url}' + min_versions[name] = f'{url}#egg={name}' continue req = Requirement(dependency) diff --git a/tests/test_tasks.py b/tests/test_tasks.py index c78986cf..d088673e 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -1,4 +1,5 @@ """Tests for the ``tasks.py`` file.""" + from tasks import _get_minimum_versions @@ -15,7 +16,7 @@ def test_get_minimum_versions(): "pandas>=1.2.0,<2;python_version<'3.10'", "pandas>=1.3.0,<2;python_version>='3.10'", 'humanfriendly>=8.2,<11', - 'pandas @ git+https://github.com/pandas-dev/pandas.git@master#egg=pandas' + 'pandas @ git+https://github.com/pandas-dev/pandas.git@master', ] # Run @@ -25,12 +26,12 @@ def test_get_minimum_versions(): # Assert expected_versions_39 = [ 'numpy==1.20.0', - 'pandas @ git+https://github.com/pandas-dev/pandas.git@master#egg=pandas', + 'git+https://github.com/pandas-dev/pandas.git@master#egg=pandas', 'humanfriendly==8.2', ] expected_versions_310 = [ 'numpy==1.23.3', - 'pandas @ git+https://github.com/pandas-dev/pandas.git@master#egg=pandas', + 'git+https://github.com/pandas-dev/pandas.git@master#egg=pandas', 'humanfriendly==8.2', ] From 0fb5971cdfa6410a50c8cb95df39adac22fb16bb Mon Sep 17 00:00:00 2001 From: R-Palazzo Date: Mon, 8 Apr 2024 17:32:27 +0100 Subject: [PATCH 4/4] use GH_ACCESS_TOKEN --- .github/workflows/static_code_analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static_code_analysis.yml b/.github/workflows/static_code_analysis.yml index bc92eeb8..72bc07f5 100644 --- a/.github/workflows/static_code_analysis.yml +++ b/.github/workflows/static_code_analysis.yml @@ -24,7 +24,7 @@ jobs: id: cpr uses: peter-evans/create-pull-request@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_ACCESS_TOKEN }} commit-message: Update static code analysis title: Latest Code Analysis body: "This is an auto-generated PR with the **latest** code analysis results."