Skip to content

Commit 7952538

Browse files
authored
Add Bandit (#282)
* Add Security/Bandit section in CONTRIBUTING.md * GitHub Actions for bandit via pre-commit
1 parent b455e15 commit 7952538

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.github/workflows/pre-commit.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: pre-commit/action@v2.0.0

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/PyCQA/bandit
5+
rev: '1.7.0'
6+
hooks:
7+
- id: bandit
8+
pass_filenames: false
9+
args: ["-r", "dpctl", "-lll"]

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Run before each commit: `clang-format -style=file -i dpctl-capi/include/*.h dpct
1515

1616
### Python code style
1717

18-
1918
We use [black](https://black.readthedocs.io/en/stable/) code formatter.
2019

2120
- Revision: `20.8b1` or branch `stable`.
@@ -88,6 +87,18 @@ Every Python and Cython file should only include the following license header:
8887
```
8988
The copyright year should be updated every calendar year.
9089

90+
## Security
91+
92+
### Bandit
93+
94+
We use [Bandit](https://github.com/PyCQA/bandit) to find common security issues in Python code.
95+
96+
Install: `pip install bandit`
97+
98+
- Revision: `1.7.0`
99+
100+
Run before each commit: `bandit -r dpctl -lll`
101+
91102
## Code Coverage
92103

93104
Implement python, cython and c++ file coverage using `coverage` and `llvm-cov` packages on Linux.

0 commit comments

Comments
 (0)