diff --git a/.copier-answers.yml b/.copier-answers.yml index 35c39c73..259ced78 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,12 +1,13 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.1.1 +_commit: v1.3.5 _src_path: https://github.com/OCA/oca-addons-repo-template.git +ci: GitHub dependency_installation_mode: PIP generate_requirements_txt: false include_wkhtmltopdf: true odoo_version: 14.0 rebel_module_groups: [] -repo_description: "TODO: add repo description." +repo_description: Return Merchandise Authorization for Odoo repo_name: stock-rma repo_slug: https://github.com/ForgeFlow/stock-rma travis_apt_packages: [] diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881b..d4cc423c 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,10 +1,17 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: ecmaVersion: 2017 +overrides: + - files: + - "**/*.esm.js" + parserOptions: + sourceType: module + # Globals available in Odoo that shouldn't produce errorings globals: _: readonly @@ -14,7 +21,7 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: readonly + owl: 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 diff --git a/.flake8 b/.flake8 index 44ed868f..e397e8ed 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -max-line-length = 80 +max-line-length = 88 max-complexity = 16 # B = bugbear # B9 = bugbear opinionated (incl line length) @@ -8,3 +8,5 @@ select = C,E,F,W,B,B9 # E501: flake8 line length (covered by bugbear B950) # W503: line break before binary operator (black behaviour) ignore = E203,E501,W503 +per-file-ignores= + __init__.py:F401 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 335381cb..4cb928ee 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -2,7 +2,11 @@ name: pre-commit on: pull_request: + branches: + - "14.0" push: + branches: + - "14.0" jobs: pre-commit: @@ -10,4 +14,8 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 + with: + # The pylint-odoo version we use here does not support python 3.10 + # https://github.com/OCA/oca-addons-repo-template/issues/80 + python-version: "3.9" - uses: pre-commit/action@v2.0.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..dc92cb84 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: test Odoo addons + +on: + pull_request: + branches: + - "14.0" + push: + branches: + - "14.0" + +jobs: + test: + runs-on: ubuntu-latest + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + include: + - container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest + makepot: "true" + - container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest + services: + postgres: + image: postgres:9.6 + env: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoo + POSTGRES_DB: odoo + ports: + - 5432:5432 + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - name: Install addons and dependencies + run: oca_install_addons + - name: Initialize test db + 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.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }} + if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }} diff --git a/.isort.cfg b/.isort.cfg index 7683badf..0ec187ef 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -10,3 +10,4 @@ known_odoo=odoo known_odoo_addons=odoo.addons sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER default_section=THIRDPARTY +ensure_newline_before_comments = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e3369604..5d875636 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | # 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$| + .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) @@ -38,7 +38,13 @@ repos: rev: v1.4 hooks: - id: autoflake - args: ["-i", "--ignore-init-module-imports"] + 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: 20.8b1 hooks: @@ -47,12 +53,13 @@ repos: rev: v2.1.2 hooks: - id: prettier - name: prettier + plugin-xml + name: prettier (with plugin-xml) additional_dependencies: - "prettier@2.1.2" - "@prettier/plugin-xml@0.12.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.8.1 hooks: @@ -87,6 +94,7 @@ repos: rev: v2.7.2 hooks: - id: pyupgrade + args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort rev: 5.5.1 hooks: @@ -103,13 +111,7 @@ repos: rev: 3.8.3 hooks: - id: flake8 - name: flake8 except __init__.py - exclude: /__init__\.py$ - additional_dependencies: ["flake8-bugbear==20.1.4"] - - id: flake8 - name: flake8 only __init__.py - args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py - files: /__init__\.py$ + name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - repo: https://github.com/PyCQA/pylint rev: pylint-2.5.3 diff --git a/.travis.yml b/.t2d.yml similarity index 84% rename from .travis.yml rename to .t2d.yml index f579f529..de169445 100644 --- a/.travis.yml +++ b/.t2d.yml @@ -31,9 +31,8 @@ env: - MQT_DEP=PIP install: - - git clone -b master-eficent - https://github.com/ForgeFlow/maintainer-quality-tools.git - $HOME/maintainer-quality-tools + - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git + ${HOME}/maintainer-quality-tools - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - travis_install_nightly diff --git a/README.md b/README.md index 1d3de89a..72999028 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # stock-rma -TODO: add repo description. +Return Merchandise Authorization for Odoo