Skip to content

Commit

Permalink
Update Bandit and Bumper configurations
Browse files Browse the repository at this point in the history
This commit refines the Bandit and Bumper tool configurations in the "pyproject.toml" file, moving specific settings for each tool into the respective tool sections. In the 'Bandit' section, the targets, exclusion directories, and skipped tests are specified. In the 'Bumper' section, the exclusion files, version files, repository, and report are clearly stated. Made corresponding changes to the GitHub workflow file, replacing hardcoded options with the settings defined in "pyproject.toml".

Signed-off-by: Steven K <steven@pointcircle.com>
  • Loading branch information
rh0dium committed Dec 28, 2023
1 parent b091dcd commit 0192d92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
pip install .[test]
- name: Bandit
run: bandit -r django_states -x django_states/tests -s B101 -f json -o report.json
run: bandit -c pyproject.toml -f json -o report.json .

- name: Show report
if: ${{ success() || failure() }}
Expand All @@ -105,7 +105,7 @@ jobs:
tests:
name: Python ${{ matrix.python-version }} / ${{ matrix.db }} / Django ${{ matrix.django-version}}
runs-on: ubuntu-latest
# continue-on-error: ${{ matrix.django-version == '~=4.2.0' }}
# continue-on-error: ${{ matrix.django-version == '~=5.0' }}
strategy:
max-parallel: 4
matrix:
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
DB_TYPE: ${{ matrix.db }}
GOOGLE_MAPS_CLIENT_ID: ${{ secrets.GOOGLE_MAPS_CLIENT_ID }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
run: export PYTHONPATH=`pwd` && coverage run demo_app/manage.py test --noinput --settings=demo_app.settings_test django_states.tests
run: export PYTHONPATH=`pwd` && coverage run

- name: "Upload Coverage Results for PY:${{ matrix.python-version }} DB:${{ matrix.db}} DJ:${{ matrix.django-version }}"
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -222,12 +222,9 @@ jobs:
id: release
env:
PYTHONWARNINGS: once::DeprecationWarning
TASK_ALWAYS_EAGER: 1
GITHUB_TOKEN: ${{ secrets.ORGANIZATIONAL_REPO_TOKEN }}
run: |
bumper.py --directory . --exclude=.github,demo_app \
--version_files django_states/__init__.py \
--repo=pivotal-energy-solutions/django-states2 > out.json
bumper -P
echo "bumped=$(jq '.bumped' out.json)" >> $GITHUB_OUTPUT
echo "bump_version=$(jq '.bump_version' out.json)" >> $GITHUB_OUTPUT
echo "bump_sha=$(jq '.bump_sha' out.json)" >> $GITHUB_OUTPUT
19 changes: 13 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ exclude = '''
| dist
)/
'''
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# in the root of the project.
/static/.py # exclude a file named foo.py in the root of the project (in addition to the defaults)
'''

[tool.bandit]
targets = ['django_states']
exclude_dirs = ["django_states/tests"]
skips = ["B101"]

[tool.coverage.run]
branch = true
command_line = "demo_app/manage.py test --noinput --settings=demo_app.settings_test django_states.tests"
omit = [
"*/demo_app/**",
"*/migrations/*",
Expand All @@ -104,4 +105,10 @@ precision = 1
skip_covered = true
skip_empty = true
ignore_errors = true
sort = "cover"
sort = "cover"

[tool.bumper]
exclude = [".idea", ".github", "demo_app"]
version_files = ["django_states/__init__.py"]
repo = "pivotal-energy-solutions/django-states2"
report = "out.json"

0 comments on commit 0192d92

Please sign in to comment.