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

Commit

Permalink
Fixed pre commit and other configs acc to 17.0
Browse files Browse the repository at this point in the history
Signed-off-by: Lalith Kota <kotalalith@gmail.com>
  • Loading branch information
lalithkota committed Mar 30, 2024
1 parent 37356d5 commit 491199e
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 152 deletions.
19 changes: 11 additions & 8 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.11.0
_commit: v1.20
_src_path: https://github.com/OCA/oca-addons-repo-template.git
additional_ruff_rules: []
ci: GitHub
dependency_installation_mode: PIP
convert_readme_fragments_to_markdown: false
generate_requirements_txt: true
github_check_license: true
github_enable_codecov: false
github_enable_makepot: false
github_enable_stale_action: false
github_check_license: false
github_ci_extra_env: {}
github_enable_codecov: true
github_enable_makepot: true
github_enable_stale_action: true
github_enforce_dev_status_compatibility: false
include_wkhtmltopdf: false
odoo_test_flavor: Both
odoo_version: 17.0
org_name: OpenG2P
org_slug: OpenG2P
Expand All @@ -18,6 +21,6 @@ repo_description: This repo contains openg2p documents related modules.
repo_name: OpenG2P Documents
repo_slug: openg2p-documents
repo_website: https://github.com/OpenG2P/openg2p-documents
travis_apt_packages: []
travis_apt_sources: []
use_pyproject_toml: true
use_ruff: true

2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ parserOptions:

overrides:
- files:
- "**/*.esm.js"
- "**/*.js"
parserOptions:
sourceType: module
Expand All @@ -23,6 +22,7 @@ globals:
odoo: readonly
openerp: readonly
owl: readonly
luxon: readonly

# Styling is handled by Prettier, so we only need to enable AST rules;
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
Expand Down
12 changes: 0 additions & 12 deletions .flake8

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: pre-commit

on: push
on:
pull_request:
push:

jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- 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
Expand Down
51 changes: 38 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ on:
pull_request:
branches:
- "15.0*"
- "17.0*"
push:
branches:
- "15.0*"
- "15.0-ocabot-*"
- "17.0*"
env:
OCA_GIT_USER_NAME: openg2p
OCA_GIT_USER_EMAIL: bot@openg2p.org
jobs:
unreleased-deps:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: |
for reqfile in requirements.txt test-requirements.txt ; do
if [ -f ${reqfile} ] ; then
Expand All @@ -29,32 +30,55 @@ jobs:
fi
fi
done
matrix_prep:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
BRANCH_NAME=$(echo ${{ github.base_ref || github.ref }} | sed -e 's,.*/\(.*\),\1,')
if [[ $BRANCH_NAME = 15.0* ]] ; then
matrix='{"include": [{
"container": "ghcr.io/oca/oca-ci/py3.8-odoo15.0:latest",
"makepot": "true",
"name": "test with Odoo 15"
},{
"container": "ghcr.io/oca/oca-ci/py3.8-ocb15.0:latest",
"name": "test with OCB 15"
}]}'
elif [[ $BRANCH_NAME = 17.0* ]] ; then
matrix='{"include": [{
"container": "ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest",
"makepot": "true",
"name": "test with Odoo 17"
},{
"container": "ghcr.io/oca/oca-ci/py3.10-ocb17.0:latest",
"name": "test with OCB 17"
}]}'
fi
echo "matrix=$matrix" | tr -d '\n' >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: matrix_prep
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
name: ${{ matrix.name }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.8-odoo15.0:latest
makepot: "true"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.8-ocb15.0:latest
name: test with OCB
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
services:
postgres:
image: postgres:9.6
image: postgres:12.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install addons and dependencies
Expand All @@ -69,6 +93,7 @@ jobs:
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- uses: codecov/codecov-action@v1
- name: Update .pot files
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'openg2p' }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*.py[cod]
/.venv
/.pytest_cache
/.ruff_cache

# C extensions
*.so
Expand Down
13 changes: 0 additions & 13 deletions .isort.cfg

This file was deleted.

88 changes: 39 additions & 49 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ exclude: |
/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.18.0"
node: "16.17.0"
repos:
- repo: local
hooks:
Expand All @@ -27,49 +31,58 @@ repos:
entry: found forbidden files; remove them
language: fail
files: "\\.rej$"
- id: en-po-files
name: en.po files cannot exist
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/sbidoul/whool
rev: v0.5
hooks:
- id: whool-init
- repo: https://github.com/oca/maintainer-tools
rev: dfba427ba03900b69e0a7f2c65890dc48921d36a
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
args: ["https://openg2p.org"]
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
- id: oca-gen-addon-readme
args:
- --expand-star-imports
- --ignore-init-module-imports
- --in-place
- --remove-all-unused-imports
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/psf/black
rev: 22.3.0
- --addons-dir=.
- --branch=17.0-develop
- --org-name=OpenG2P
- --repo-name=openg2p-documents
- --if-source-changed
- --keep-source-digest
- id: oca-gen-addons-table
- id: oca-gen-external-dependencies
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.25
hooks:
- id: black
- id: oca-checks-odoo-module
- id: oca-checks-po
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.4.1
rev: v2.7.1
hooks:
- id: prettier
name: prettier (with plugin-xml)
additional_dependencies:
- "prettier@2.4.1"
- "@prettier/plugin-xml@1.1.0"
- "prettier@2.7.1"
- "@prettier/plugin-xml@2.2.0"
args:
- --plugin=@prettier/plugin-xml
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.32.0
rev: v8.24.0
hooks:
- id: eslint
verbose: true
args:
- --color
- --fix
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
Expand All @@ -90,37 +103,14 @@ repos:
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
hooks:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: isort except __init__.py
args:
- --settings=.
exclude: /__init__\.py$
- repo: https://github.com/acsone/setuptools-odoo
rev: 3.0.3
hooks:
- id: setuptools-odoo-make-default
- id: setuptools-odoo-get-requirements
args:
- --output
- requirements.txt
- --header
- "# generated from manifests external_dependencies"
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==21.9.2"]
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: 7.0.2
rev: v9.0.4
hooks:
- id: pylint_odoo
name: pylint with optional checks
Expand Down
13 changes: 7 additions & 6 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ load-plugins=pylint_odoo
score=n

[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors=OpenG2P
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,Other OSI approved licence
valid_odoo_versions=17.0
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=OpenG2P
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,Other OSI approved licence
valid-odoo-versions=17.0

[MESSAGES CONTROL]
disable=all
Expand Down Expand Up @@ -98,6 +98,7 @@ enable=anomalous-backslash-in-string,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
create-user-wo-reset-password,
Expand Down
15 changes: 8 additions & 7 deletions .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ load-plugins=pylint_odoo
score=n

[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors=OpenG2P
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,Other OSI approved licence
valid_odoo_versions=17.0
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=OpenG2P
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,Other OSI approved licence
valid-odoo-versions=17.0

[MESSAGES CONTROL]
disable=all
Expand Down Expand Up @@ -89,7 +89,8 @@ enable=anomalous-backslash-in-string,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute
xml-deprecated-tree-attribute,
external-request-timeout

[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
Expand Down
Loading

0 comments on commit 491199e

Please sign in to comment.