From 65279c2471cd9e945c41a8f31f869b15885ed79e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 1 Sep 2021 15:52:16 +0530 Subject: [PATCH] ci: add strict config for flake8 --- .github/helper/.flake8_strict | 72 +++++++++++++++++++ .../workflows/{semgrep.yml => linters.yml} | 15 +++- .pre-commit-config.yaml | 6 +- 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 .github/helper/.flake8_strict rename .github/workflows/{semgrep.yml => linters.yml} (56%) diff --git a/.github/helper/.flake8_strict b/.github/helper/.flake8_strict new file mode 100644 index 0000000000..c17871dfa9 --- /dev/null +++ b/.github/helper/.flake8_strict @@ -0,0 +1,72 @@ +[flake8] +ignore = + B007, + B950, + E101, + E111, + E114, + E116, + E117, + E121, + E122, + E123, + E124, + E125, + E126, + E127, + E128, + E131, + E201, + E202, + E203, + E211, + E221, + E222, + E223, + E224, + E225, + E226, + E228, + E231, + E241, + E242, + E251, + E261, + E262, + E265, + E266, + E271, + E272, + E273, + E274, + E301, + E302, + E303, + E305, + E306, + E401, + E402, + E501, + E502, + E701, + E702, + E703, + E741, + F401, + F403, + W191, + W291, + W292, + W293, + W391, + W503, + W504, + E711, + E129, + F841, + E713, + E712, + + +max-line-length = 200 +exclude=.github/helper/semgrep_rules,test_*.py diff --git a/.github/workflows/semgrep.yml b/.github/workflows/linters.yml similarity index 56% rename from .github/workflows/semgrep.yml rename to .github/workflows/linters.yml index e27b406df0..c2363397c4 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/linters.yml @@ -1,11 +1,12 @@ -name: Semgrep +name: Linters on: pull_request: { } jobs: - semgrep: - name: Frappe Linter + + linters: + name: linters runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,3 +17,11 @@ jobs: config: >- r/python.lang.correctness .github/helper/semgrep_rules + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install and Run Pre-commit + uses: pre-commit/action@v2.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0721d43c07..df15b687c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,9 +9,7 @@ repos: hooks: - id: trailing-whitespace files: "erpnext.*" - - id: end-of-file-fixer - files: "erpnext.*" - exclude: ".*json$|.*txt$" + exclude: ".*json$|.*txt$|.*csv|.*md" - id: check-yaml - id: no-commit-to-branch args: ['--branch', 'develop'] @@ -22,7 +20,7 @@ repos: rev: 3.9.2 hooks: - id: flake8 - additional_dependencies: [flake8-isort] + args: ['--config', '.github/helper/.flake8_strict'] exclude: ".*setup.py$" ci: