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

Commit

Permalink
Migrated latest modules from 15.0. Fixed Precommit and linters and fo…
Browse files Browse the repository at this point in the history
…rmatters according to 17.0

Signed-off-by: Lalith Kota <[email protected]>
  • Loading branch information
lalithkota committed Mar 25, 2024
1 parent a53761b commit 3d78fa6
Show file tree
Hide file tree
Showing 60 changed files with 438 additions and 404 deletions.
18 changes: 10 additions & 8 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.14.1
_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_check_license: false
github_ci_extra_env: {}
github_enable_codecov: false
github_enable_codecov: true
github_enable_makepot: true
github_enable_stale_action: false
github_enforce_dev_status_compatibility: true
github_enforce_dev_status_compatibility: false
include_wkhtmltopdf: false
odoo_version: 15.0
odoo_test_flavor: Both
odoo_version: 17.0
org_name: OpenG2P
org_slug: OpenG2P
rebel_module_groups: []
repo_description: This repo is contains modules used by OpenG2P for Security
repo_name: OpenG2P Security
repo_slug: openg2p-security
repo_website: https://github.com/OpenG2P/openg2p-security
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 @@ -9,7 +9,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.

21 changes: 0 additions & 21 deletions .github/workflows/build.yml

This file was deleted.

9 changes: 3 additions & 6 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ name: pre-commit

on:
pull_request:
branches:
- "15.0*"
push:
branches:
- "15.0"
- "15.0-ocabot-*"

jobs:
pre-commit:
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
49 changes: 37 additions & 12 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: [email protected]
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-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
BRANCH_NAME=$(echo ${{ 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<<EOF"$'\n'"$matrix"$'\n'EOF >> $GITHUB_OUTPUT
test:
needs: matrix_prep
runs-on: ubuntu-latest
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.

87 changes: 38 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,57 @@ 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-security
- --if-source-changed
- --keep-source-digest
- 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 +102,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.1.8
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=15.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
Loading

0 comments on commit 3d78fa6

Please sign in to comment.