Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

add bandit to pre-commit #424

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
default_language_version:
python: python3
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v4.0.1
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -17,8 +17,8 @@ repos:
- id: mixed-line-ending
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: 'https://github.com/pycqa/flake8'
rev: 4.0.1
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
args:
Expand All @@ -28,16 +28,16 @@ repos:
- flake8-comprehensions
- flake8-debugger
- flake8-string-format
- repo: 'https://github.com/psf/black'
rev: 22.3.0
- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
- repo: 'https://github.com/PyCQA/isort'
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: 'https://github.com/pre-commit/mirrors-mypy'
rev: v0.942
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.981
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -54,7 +54,11 @@ repos:
entry: pylint -v
language: system
types: [ python ]
# - repo: https://github.com/PyCQA/bandit
# rev: '1.7.0'
# hooks:
# - id: bandit
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
exclude: tests/
args:
- -iii # high level
- -lll # high confidense
2 changes: 1 addition & 1 deletion mlem/contrib/docker/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _new_whl(path):
with tempfile.TemporaryDirectory() as whl_dir:
subprocess.check_output(
f"pip wheel . --no-deps -w {whl_dir}",
shell=True,
shell=True, # nosec: B602
cwd=mlem_src_path,
)
whl_path = glob.glob(os.path.join(whl_dir, "*.whl"))[0]
Expand Down
4 changes: 3 additions & 1 deletion mlem/contrib/pip/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def build_whl(self, path, target, target_fs):
logger.debug("Building whl from %s...", path)
with tempfile.TemporaryDirectory() as whl_dir:
subprocess.check_output(
f"pip wheel . --no-deps -w {whl_dir}", shell=True, cwd=path
f"pip wheel . --no-deps -w {whl_dir}",
shell=True, # nosec: B602
cwd=path,
)
whl_path = glob.glob(os.path.join(whl_dir, "*.whl"))[0]
whl_name = os.path.basename(whl_path)
Expand Down
1 change: 1 addition & 0 deletions mlem/utils/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def generate(self, **additional):
j2 = Environment(
loader=FileSystemLoader([self.TEMPLATE_DIR] + self.templates_dir),
undefined=StrictUndefined,
autoescape=True,
)
template = j2.get_template(self.TEMPLATE_FILE)
args = self.prepare_dict()
Expand Down