Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,34 @@
"moment": false,
"odoo": false,
"openerp": false,
"self": false
},
"env": {
"browser": true
"self": false,
"odoo": "readonly",
"$": "readonly",
"jQuery": "readonly",
"Chart": "readonly",
"fuzzy": "readonly",
"StackTrace": "readonly",
"QUnit": "readonly",
"luxon": "readonly",
"py": "readonly",
"FullCalendar": "readonly",
"globalThis": "readonly",
"ScrollSpy": "readonly",
"module": "readonly",
"chai": "readonly",
"describe": "readonly",
"it": "readonly",
"mocha": "readonly",
"DOMPurify": "readonly",
"Alert": "readonly",
"Collapse": "readonly",
"Dropdown": "readonly",
"Modal": "readonly",
"Offcanvas": "readonly",
"Popover": "readonly",
"Tooltip": "readonly"
},

"rules": {
"no-alert": "warn",
"no-array-constructor": "warn",
Expand Down Expand Up @@ -285,7 +308,13 @@
"yield-star-spacing": "off",
"yoda": "warn"
},
"parserOptions": {
"ecmaVersion": 2017
}

"env": {
"browser": true,
"es2022": true
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
}
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ env:

# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2019
ecmaVersion: 2022

overrides:
- files:
- "**/*.esm.js"
- "**/*.js"
parserOptions:
sourceType: module

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pre-Commit PR

on:
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
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 --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pre-Commit Push

on:
push:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
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
15 changes: 0 additions & 15 deletions .github/workflows/pre-commit.yml

This file was deleted.

67 changes: 46 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
exclude: |
(?x)
# Project Specific
# OSI Template Specific
^helm/|
^odoo/legacy/|
^odoo/src/paid-addons|
^odoo/tests/|
^odoo/src/patches|
# Odoo source code
^odoo/odoo/|
# NOT INSTALLABLE ADDONS
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
Expand All @@ -8,13 +17,13 @@ exclude: |
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
^README\.rst$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)|
helm/odoo/templates
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
node: "16.17.0"
Expand All @@ -28,29 +37,35 @@ 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/oca/maintainer-tools
rev: 451de41fa3e8aa81d077c804322d48632eb5ff74
rev: 4cd2b852214dead80822e93e6749b16f2785b2fe
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
args: ["https://github.com/ursais/odoo-template"]
- id: oca-gen-addon-readme
- repo: https://github.com/myint/autoflake
rev: v1.6.1
hooks:
- id: autoflake
args:
- --addons-dir=.
- --branch=17.0
- --org-name=ursais
- --repo-name=odoo-template
- --if-source-changed
- --keep-source-digest
- --convert-fragments-to-markdown
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.25
- --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.8.0
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
rev: v2.7.1
hooks:
- id: prettier
name: prettier (with plugin-xml)
Expand All @@ -61,15 +76,15 @@ repos:
- --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: v9.0.0-beta.1
rev: v8.24.0
hooks:
- id: eslint
verbose: true
args:
- --color
- --fix
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
Expand All @@ -91,20 +106,30 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
rev: v2.38.2
hooks:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
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
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==21.9.2"]
- repo: https://github.com/OCA/pylint-odoo
rev: v9.0.5
rev: 7.0.2
hooks:
- id: pylint_odoo
name: pylint with optional checks
Expand Down
99 changes: 20 additions & 79 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,106 +13,47 @@ valid-odoo-versions=17.0
[MESSAGES CONTROL]
disable=all

# This .pylintrc contains optional AND mandatory checks and is meant to be
# loaded in an IDE to have it check everything, in the hope this will make
# optional checks more visible to contributors who otherwise never look at a
# green travis to see optional checks that failed.
# This .pylintrc contains optional checks only
# .pylintrc-mandatory containing only mandatory checks is used the pre-commit
# config as a blocking check.

enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
enable=api-one-deprecated,
character-not-valid-in-resource-link,
class-camelcase,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-module,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
invalid-commit,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
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,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
manifest-required-author,
manifest-required-key,
manifest-version-format,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
pointless-statement,
pointless-string-statement,
redefined-builtin,
rst-syntax-error,
too-complex,
unnecessary-utf8-coding-comment
translation-field,
translation-required,
unnecessary-utf8-coding-comment,
use-vim-comment,
website-manifest-key-not-valid-uri,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute


[REPORTS]
Expand Down
Loading