Skip to content

Commit

Permalink
Add bandit to pre-commit (#94)
Browse files Browse the repository at this point in the history
* Added bandit to pre-commit hooks

* Testing requirements

* Testing building

* Restores bandit

* Add blank line

* Adds jinja2-time to requirements

* Adds missing dash

* Adds jinja2-time to template as well as higher level

* Fixes typo

* Testing

* Testing with jinja2_time

* Testing with jinja2-time

* Testing with both

* Adds jinja2_time to package

* Makes jinja2_time a dev package

* Testing

* Testing

* Removing extensions

* Tidies up a few things

---------

Co-authored-by: Milne <[email protected]>
  • Loading branch information
Jacobb164 and danmilne1 authored Sep 21, 2023
1 parent d57f84f commit e47aad3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"_extensions": ["jinja2_time.TimeExtension"],

"organisation_name": "Your public sector organisation name, for example Government Digital Service",
"repository_hosting_platform": ["GitHub", "GitLab"],
"organisation_handle": "Your GitHub/GitLab organisation name, for example ukgovdatascience",
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
bandit
cookiecutter
coverage
detect-secrets==1.0.3
#pytest-cookies
git+https://github.com/Jacobb164/pytest-cookies
govuk-tech-docs-sphinx-theme
jinja2-time
myst-parser
pre-commit
pytest
Expand Down
7 changes: 7 additions & 0 deletions {{ cookiecutter.repo_name }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ repos:
name: detect-secrets - Detect secrets in staged code
args: [ "--baseline", ".secrets.baseline" ]
exclude: .*/tests/.*|^\.cruft\.json$
- repo: https://github.com/PyCQA/bandit
rev: '1.7.5'
hooks:
- id: bandit
name: bandit - Checks for vulnerabilities
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
{% if cookiecutter.using_R == "Yes" %}
# R specific hooks: https://github.com/lorenzwalthert/precommit
- repo: https://github.com/lorenzwalthert/precommit
Expand Down
5 changes: 5 additions & 0 deletions {{ cookiecutter.repo_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ doctest_optionflags = "NORMALIZE_WHITESPACE"
testpaths = [
"./tests"
]

# `bandit' configurations
[tool.bandit]
exclude_dirs = ["tests", "docs"]
skips = []

0 comments on commit e47aad3

Please sign in to comment.