fix: misc fixes, use bandit by nandgator · Pull Request #238 · python-validators/validators · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
52 changes: 52 additions & 0 deletions .github/workflows/bandit.yml
77 changes: 0 additions & 77 deletions .github/workflows/codeql.yml

This file was deleted.

15 changes: 14 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ classifiers = [
python = "^3.9"

[tool.poetry.group.dev.dependencies]
bandit = "^1.7.4"
black = "^23.1.0"
flake8 = "^6.0.0"
flake8-docstrings = "^1.7.0"
Expand All @@ -39,6 +38,9 @@ setuptools = "^67.2.0"
[tool.poetry.group.tests.dependencies]
pytest = "^7.2.2"

[tool.poetry.group.sast.dependencies]
bandit = { extras = ["toml"], version = "^1.7.4" }

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.4.2"
mkdocs-material = "^9.1.1"
Expand All @@ -56,6 +58,9 @@ build-backend = "poetry.core.masonry.api"
line-length = 100
target-version = ['py39', 'py310', 'py311']

[tool.bandit]
exclude_dirs = [".github", ".pytest_cache", ".tox", ".vscode", "tests", "docs"]

[tool.tox]
legacy_tox_ini = '''
[tox]
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests."""
25 changes: 15 additions & 10 deletions validators/hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@validator
def md5(value: str):
def md5(value: str, /):
"""Return whether or not given value is a valid MD5 hash.

Examples:
Expand All @@ -19,7 +19,8 @@ def md5(value: str):
# Output: ValidationFailure(func=md5, args={'value': '900zz11'})

Args:
value: MD5 string to validate.
value:
MD5 string to validate.

Returns:
(Literal[True]):
Expand All @@ -33,7 +34,7 @@ def md5(value: str):


@validator
def sha1(value: str):
def sha1(value: str, /):
"""Return whether or not given value is a valid SHA1 hash.

Examples:
Expand All @@ -43,7 +44,8 @@ def sha1(value: str):
# Output: ValidationFailure(func=sha1, args={'value': '900zz11'})

Args:
value: SHA1 string to validate.
value:
SHA1 string to validate.

Returns:
(Literal[True]):
Expand All @@ -57,7 +59,7 @@ def sha1(value: str):


@validator
def sha224(value: str):
def sha224(value: str, /):
"""Return whether or not given value is a valid SHA224 hash.

Examples:
Expand All @@ -67,7 +69,8 @@ def sha224(value: str):
# Output: ValidationFailure(func=sha224, args={'value': '900zz11'})

Args:
value: SHA224 string to validate.
value:
SHA224 string to validate.

Returns:
(Literal[True]):
Expand All @@ -81,7 +84,7 @@ def sha224(value: str):


@validator
def sha256(value: str):
def sha256(value: str, /):
"""Return whether or not given value is a valid SHA256 hash.

Examples:
Expand All @@ -94,7 +97,8 @@ def sha256(value: str):
# Output: ValidationFailure(func=sha256, args={'value': '900zz11'})

Args:
value: SHA256 string to validate.
value:
SHA256 string to validate.

Returns:
(Literal[True]):
Expand All @@ -108,7 +112,7 @@ def sha256(value: str):


@validator
def sha512(value: str):
def sha512(value: str, /):
"""Return whether or not given value is a valid SHA512 hash.

Examples:
Expand All @@ -122,7 +126,8 @@ def sha512(value: str):
# Output: ValidationFailure(func=sha512, args={'value': '900zz11'})

Args:
value: SHA512 string to validate.
value:
SHA512 string to validate.

Returns:
(Literal[True]):
Expand Down
5 changes: 3 additions & 2 deletions validators/iban.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _mod_check(value: str):


@validator
def iban(value: str):
def iban(value: str, /):
"""Return whether or not given value is a valid IBAN code.

Examples:
Expand All @@ -31,7 +31,8 @@ def iban(value: str):
# Output: ValidationFailure(func=iban, ...)

Args:
value: IBAN string to validate.
value:
IBAN string to validate.

Returns:
(Literal[True]):
Expand Down
4 changes: 2 additions & 2 deletions validators/mac_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@validator
def mac_address(value: str):
def mac_address(value: str, /):
"""Return whether or not given value is a valid MAC address.

This validator is based on [WTForms MacAddress validator][1].
Expand All @@ -24,7 +24,7 @@ def mac_address(value: str):

Args:
value:
A string to validate.
MAC address string to validate.

Returns:
(Literal[True]):
Expand Down
4 changes: 2 additions & 2 deletions validators/slug.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@validator
def slug(value: str):
def slug(value: str, /):
"""Validate whether or not given value is valid slug.

Valid slug can contain only lowercase alphanumeric characters and hyphens.
Expand All @@ -23,7 +23,7 @@ def slug(value: str):

Args:
value:
A string to validate.
Slug string to validate.

Returns:
(Literal[True]):
Expand Down
4 changes: 2 additions & 2 deletions validators/uuid.py