diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index dca291e..5832a6d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -61,4 +61,4 @@ body: - type: markdown attributes: value: > - Thanks for helping us improve the library! \ No newline at end of file + Thanks for helping us improve the library! diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 00b9a38..8b943b2 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -31,4 +31,4 @@ body: - type: markdown attributes: value: > - Thanks for contributing 🎉 \ No newline at end of file + Thanks for contributing 🎉 diff --git a/.github/collect_env.py b/.github/collect_env.py index 69d812e..e6cf618 100644 --- a/.github/collect_env.py +++ b/.github/collect_env.py @@ -151,12 +151,6 @@ def replace_bools(dct, true="Yes", false="No"): dct[key] = false return dct - def maybe_start_on_next_line(string): - # If `string` is multiline, prepend a \n to it. - if string is not None and len(string.split("\n")) > 1: - return "\n{}\n".format(string) - return string - mutable_dict = envinfo._asdict() # Replace True with Yes, False with No diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 35151c5..5600d23 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -24,7 +24,7 @@ jobs: run: | pip install flake8 flake8 --version - flake8 ./ + flake8 isort: runs-on: ${{ matrix.os }} @@ -83,3 +83,22 @@ jobs: pip install black black --version black --check --diff . + + bandit: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python: [3.8] + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + architecture: x64 + - name: Run bandit + run: | + pip install bandit[toml] + bandit --version + bandit -r . -c pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b615adc --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-yaml + - id: check-toml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + - repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + - repo: https://github.com/PyCQA/autoflake + rev: v1.7.7 + hooks: + - id: autoflake diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7982f5..7171fb1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ As a contributor, you will only have to ensure coverage of your code by adding a ### Feature requests & bug report -Whether you encountered a problem, or you have a feature suggestion, your input has value and can be used by contributors to reference it in their developments. For this purpose, we advise you to use Github [issues](https://github.com/frgfm/validate-python-headers/issues). +Whether you encountered a problem, or you have a feature suggestion, your input has value and can be used by contributors to reference it in their developments. For this purpose, we advise you to use Github [issues](https://github.com/frgfm/validate-python-headers/issues). First, check whether the topic wasn't already covered in an open / closed issue. If not, feel free to open a new one! When doing so, use issue templates whenever possible and provide enough information for other contributors to jump in. diff --git a/Makefile b/Makefile index b13ae8a..05f1e3b 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,17 @@ # this target runs checks on all files quality: isort . -c - flake8 ./ + flake8 mypy black --check . + bandit -r . -c pyproject.toml + autoflake -r . # this target runs checks on all files and potentially modifies some of them style: isort . black . + autoflake --in-place -r . # Build the docker image build: diff --git a/README.md b/README.md index 02d47fa..43ba39d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # Header validator for your Python files
@@ -62,7 +65,7 @@ with:
Any sort of contribution is greatly appreciated!
-You can find a short guide in [`CONTRIBUTING`](CONTRIBUTING) to help grow this project!
+You can find a short guide in [`CONTRIBUTING`](CONTRIBUTING.md) to help grow this project!
diff --git a/entrypoint.sh b/entrypoint.sh
index 05e5b41..df82394 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,4 +1,4 @@
#!/bin/sh -l
set -eax
-python /validate_headers.py "${1}" "${2}" $3 --folders $4 --ignore-files $5 --ignore-folders $6
+python /validate_headers.py "${1}" "${2}" "${3}" --folders "${4}" --ignore-files "${5}" --ignore-folders "${6}"
diff --git a/pyproject.toml b/pyproject.toml
index b7ecdfc..728ef96 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -18,3 +18,12 @@ known_third_party = []
[tool.black]
line-length = 120
target-version = ['py38']
+
+[tool.autoflake]
+remove-unused-variables = true
+remove-all-unused-imports = true
+ignore-init-module-imports = true
+
+[tool.bandit]
+exclude_dirs = [".github/collect_env.py"]
+skips = ["B101"]
diff --git a/src/supported-licenses.json b/src/supported-licenses.json
index a8fba9c..5baa228 100644
--- a/src/supported-licenses.json
+++ b/src/supported-licenses.json
@@ -6152,4 +6152,4 @@
}
],
"releaseDate": "2022-05-08"
-}
\ No newline at end of file
+}