From 9297b655545d0bd3fb0d569ed5ed3bf1c4b30610 Mon Sep 17 00:00:00 2001 From: Lanto Razafindrabe Date: Mon, 29 Apr 2024 17:46:34 +0300 Subject: [PATCH 1/2] TA#65109 [ADD] Pre commit --- .flake8 | 12 +++++++++++ .github/workflows/pre-commit.yml | 36 ++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 30 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .flake8 create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..15d225b --- /dev/null +++ b/.flake8 @@ -0,0 +1,12 @@ +[flake8] +max-line-length = 88 +max-complexity = 16 +# B = bugbear +# B9 = bugbear opinionated (incl line length) +select = C,E,F,W,B,B9 +# E203: whitespace before ':' (black behaviour) +# E501: flake8 line length (covered by bugbear B950) +# W503: line break before binary operator (black behaviour) +ignore = E203,E501,W503,F821 +per-file-ignores= + __init__.py:F401 \ No newline at end of file diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..2894822 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,36 @@ +name: pre-commit + +on: + pull_request: + branches: + - "14.0*" + push: + branches: + - "14.0" + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: "3.11" + - name: Get python version + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure --color=always + - name: Check that all files generated by pre-commit are in git + run: | + newfiles="$(git ls-files --others --exclude-from=.gitignore)" + if [ "$newfiles" != "" ] ; then + echo "Please check-in the following files:" + echo "$newfiles" + exit 1 + fi \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..004b714 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +exclude: | + (?x) + # NOT INSTALLABLE ADDONS + # END NOT INSTALLABLE ADDONS + # Files and folders generated by bots, to avoid loops + ^setup/|/static/description/index\.html$| + # We don't want to mess with tool-generated files + .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| + # Maybe reactivate this when all README files include prettier ignore tags? + ^README\.md$| + # Library files can have extraneous formatting (even minimized) + /static/(src/)?lib/| + # Repos using Sphinx to generate docs don't need prettying + ^docs/_templates/.*\.html$| + # Don't bother non-technical authors with formatting issues in docs + readme/.*\.(rst|md)$| + # Ignore build and dist directories in addons + /build/|/dist/| + # You don't usually want a bot to modify your legal texts + (LICENSE.*|COPYING.*) +default_language_version: + python: python3 + node: "14.13.0" +repos: + - repo: https://github.com/PyCQA/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + name: flake8 + additional_dependencies: ["flake8-bugbear==20.1.4"] \ No newline at end of file From b5c41e73ea4bf25cb417f895924e91ebdad6c84e Mon Sep 17 00:00:00 2001 From: Lanto Razafindrabe Date: Mon, 29 Apr 2024 17:50:29 +0300 Subject: [PATCH 2/2] TA#65109 [IMP] Code quality --- rma_groupby_parent_affiliate/__manifest__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rma_groupby_parent_affiliate/__manifest__.py b/rma_groupby_parent_affiliate/__manifest__.py index d1950f2..cede424 100644 --- a/rma_groupby_parent_affiliate/__manifest__.py +++ b/rma_groupby_parent_affiliate/__manifest__.py @@ -10,7 +10,10 @@ "license": "AGPL-3", "category": "RMA", "depends": ["rma", "partner_affiliate_extended"], - "summary": "Add the possibility to group by parent affiliate on Return Merchandise Authorization (RMA).", + "summary": """ + Add the possibility to group by parent affiliate on + Return Merchandise Authorization (RMA). + """, "data": [ "views/rma_views.xml", ],