Skip to content

Commit

Permalink
🔒 Add bandit checks to pre-commit (#1710)
Browse files Browse the repository at this point in the history
Add bandit checks to pre-commit

Signed-off-by: Samet Akcay <[email protected]>
  • Loading branch information
samet-akcay authored Feb 8, 2024
1 parent 4683e06 commit 28e4282
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ repos:
additional_dependencies: [types-PyYAML]
exclude: "tests"

# add bandit for security checks
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]

# notebooks.
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ max-complexity = 15
[tool.ruff.pydocstyle]
convention = "google"


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# MYPY CONFIGURATION. #
[tool.mypy]
Expand All @@ -152,6 +153,12 @@ follow_imports = "skip"
follow_imports_for_stubs = true


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# BANDIT CONFIGURATION #
[tool.bandit]
skips = ["B101"]


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PYTEST CONFIGURATION #
[tool.pytest.ini_options]
Expand Down
4 changes: 2 additions & 2 deletions src/anomalib/callbacks/nncf/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ def on_train_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule) -> No
self.nncf_ctrl.export_model(onnx_path)

optimize_command = ["mo", "--input_model", onnx_path, "--output_dir", self.export_dir]
# TODO(samet-akcay): Check if mo can be donw via python API
# TODO(samet-akcay): Check if mo can be done via python API
# CVS-122665
subprocess.run(optimize_command, check=True) # noqa: S603
subprocess.run(optimize_command, check=True) # noqa: S603 # nosec B603

0 comments on commit 28e4282

Please sign in to comment.