diff --git a/.badges/code_style-black-000000.svg b/.badges/code_style-black-000000.svg deleted file mode 100644 index b31cf98396ff4af1f97f2b8377202a463487ad70_LmJhZGdlcy9jb2RlX3N0eWxlLWJsYWNrLTAwMDAwMC5zdmc=..0000000000000000000000000000000000000000 --- a/.badges/code_style-black-000000.svg +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<svg xmlns="http://www.w3.org/2000/svg" width="114" height="20"> - <linearGradient id="b" x2="0" y2="100%"> - <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> - <stop offset="1" stop-opacity=".1" /> - </linearGradient> - <mask id="anybadge_1"> - <rect width="114" height="20" rx="3" fill="#fff" /> - </mask> - <g mask="url(#anybadge_1)"> - <path fill="#555" d="M0 0h72v20H0z" /> - <path fill="#000000" d="M72 0h42v20H72z" /> - <path fill="url(#b)" d="M0 0h114v20H0z" /> - </g> - <g - fill="#fff" - text-anchor="middle" - font-family="DejaVu Sans,Verdana,Geneva,sans-serif" - font-size="11" - > - <text x="37.0" y="15" fill="#010101" fill-opacity=".3">code style</text> - <text x="36.0" y="14">code style</text> - </g> - <g - fill="#fff" - text-anchor="middle" - font-family="DejaVu Sans,Verdana,Geneva,sans-serif" - font-size="11" - > - <text x="94.0" y="15" fill="#010101" fill-opacity=".3">black</text> - <text x="93.0" y="14">black</text> - </g> -</svg> diff --git a/.badges/code_style-ruff.svg b/.badges/code_style-ruff.svg new file mode 100644 index 0000000000000000000000000000000000000000..5c559305469f192a7fc0bd1458b51e189ed075e9_LmJhZGdlcy9jb2RlX3N0eWxlLXJ1ZmYuc3Zn --- /dev/null +++ b/.badges/code_style-ruff.svg @@ -0,0 +1,49 @@ +<svg + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + width="53" + height="20" + role="img" + aria-label="Ruff" +> + <title>Ruff</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="53" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="20" height="20" fill="#555" /> + <rect x="20" width="33" height="20" fill="#261230" /> + <rect width="53" height="20" fill="url(#s)" /> + </g> + <g + fill="#fff" + text-anchor="middle" + font-family="Verdana,Geneva,DejaVu Sans,sans-serif" + text-rendering="geometricPrecision" + font-size="110" + > + <image + x="5" + y="3" + width="10" + height="14" + xlink:href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTEwIiBoZWlnaHQ9IjYyMiIgdmlld0JveD0iMCAwIDUxMCA2MjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yMDYuNzAxIDBDMjAwLjk2NCAwIDE5Ni4zMTQgNC42NDEzMSAxOTYuMzE0IDEwLjM2NjdWNDEuNDY2N0MxOTYuMzE0IDQ3LjE5MiAxOTEuNjYzIDUxLjgzMzMgMTg1LjkyNyA1MS44MzMzSDE1Ni44NDNDMTUxLjEwNyA1MS44MzMzIDE0Ni40NTYgNTYuNDc0NiAxNDYuNDU2IDYyLjJWMTQ1LjEzM0MxNDYuNDU2IDE1MC44NTkgMTQxLjgwNiAxNTUuNSAxMzYuMDY5IDE1NS41SDEwNi45ODZDMTAxLjI0OSAxNTUuNSA5Ni41OTg4IDE2MC4xNDEgOTYuNTk4OCAxNjUuODY3VjIyMi44ODNDOTYuNTk4OCAyMjguNjA5IDkxLjk0ODQgMjMzLjI1IDg2LjIxMTggMjMzLjI1SDU3LjEyODNDNTEuMzkxNyAyMzMuMjUgNDYuNzQxMyAyMzcuODkxIDQ2Ljc0MTMgMjQzLjYxN1YzMDAuNjMzQzQ2Ljc0MTMgMzA2LjM1OSA0Mi4wOTA5IDMxMSAzNi4zNTQ0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aria-hidden="true" + x="355" + y="150" + fill="#010101" + fill-opacity=".3" + transform="scale(.1)" + textLength="230" + > + Ruff + </text> + <text x="355" y="140" transform="scale(.1)" fill="#fff" textLength="230">Ruff</text> + </g> +</svg> diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index b31cf98396ff4af1f97f2b8377202a463487ad70_LmVzbGludHJjLnltbA==..0000000000000000000000000000000000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,187 +0,0 @@ -env: - browser: true - es6: true - -# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 -parserOptions: - ecmaVersion: 2019 - -overrides: - - files: - - "**/*.esm.js" - parserOptions: - sourceType: module - -# Globals available in Odoo that shouldn't produce errorings -globals: - _: readonly - $: readonly - fuzzy: readonly - jQuery: readonly - moment: readonly - odoo: readonly - openerp: 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 -rules: - accessor-pairs: warn - array-callback-return: warn - callback-return: warn - capitalized-comments: - - warn - - always - - ignoreConsecutiveComments: true - ignoreInlineComments: true - complexity: - - warn - - 15 - constructor-super: warn - dot-notation: warn - eqeqeq: warn - global-require: warn - handle-callback-err: warn - id-blacklist: warn - id-match: warn - init-declarations: error - max-depth: warn - max-nested-callbacks: warn - max-statements-per-line: warn - no-alert: warn - no-array-constructor: warn - no-caller: warn - no-case-declarations: warn - no-class-assign: warn - no-cond-assign: error - no-const-assign: error - no-constant-condition: warn - no-control-regex: warn - no-debugger: error - no-delete-var: warn - no-div-regex: warn - no-dupe-args: error - no-dupe-class-members: error - no-dupe-keys: error - no-duplicate-case: error - no-duplicate-imports: error - no-else-return: warn - no-empty-character-class: warn - no-empty-function: error - no-empty-pattern: error - no-empty: warn - no-eq-null: error - no-eval: error - no-ex-assign: error - no-extend-native: warn - no-extra-bind: warn - no-extra-boolean-cast: warn - no-extra-label: warn - no-fallthrough: warn - no-func-assign: error - no-global-assign: error - no-implicit-coercion: - - warn - - allow: ["~"] - no-implicit-globals: warn - no-implied-eval: warn - no-inline-comments: warn - no-inner-declarations: warn - no-invalid-regexp: warn - no-irregular-whitespace: warn - no-iterator: warn - no-label-var: warn - no-labels: warn - no-lone-blocks: warn - no-lonely-if: error - no-mixed-requires: error - no-multi-str: warn - no-native-reassign: error - no-negated-condition: warn - no-negated-in-lhs: error - no-new-func: warn - no-new-object: warn - no-new-require: warn - no-new-symbol: warn - no-new-wrappers: warn - no-new: warn - no-obj-calls: warn - no-octal-escape: warn - no-octal: warn - no-param-reassign: warn - no-path-concat: warn - no-process-env: warn - no-process-exit: warn - no-proto: warn - no-prototype-builtins: warn - no-redeclare: warn - no-regex-spaces: warn - no-restricted-globals: warn - no-restricted-imports: warn - no-restricted-modules: warn - no-restricted-syntax: warn - no-return-assign: error - no-script-url: warn - no-self-assign: warn - no-self-compare: warn - no-sequences: warn - no-shadow-restricted-names: warn - no-shadow: warn - no-sparse-arrays: warn - no-sync: warn - no-this-before-super: warn - no-throw-literal: warn - no-undef-init: warn - no-undef: error - no-unmodified-loop-condition: warn - no-unneeded-ternary: error - no-unreachable: error - no-unsafe-finally: error - no-unused-expressions: error - no-unused-labels: error - no-unused-vars: error - no-use-before-define: error - no-useless-call: warn - no-useless-computed-key: warn - no-useless-concat: warn - no-useless-constructor: warn - no-useless-escape: warn - no-useless-rename: warn - no-void: warn - no-with: warn - operator-assignment: [error, always] - prefer-const: warn - radix: warn - require-yield: warn - sort-imports: warn - spaced-comment: [error, always] - strict: [error, function] - use-isnan: error - valid-jsdoc: - - warn - - prefer: - arg: param - argument: param - augments: extends - constructor: class - exception: throws - func: function - method: function - prop: property - return: returns - virtual: abstract - yield: yields - preferType: - array: Array - bool: Boolean - boolean: Boolean - number: Number - object: Object - str: String - string: String - requireParamDescription: false - requireReturn: false - requireReturnDescription: false - requireReturnType: false - valid-typeof: warn - yoda: warn diff --git a/.flake8 b/.flake8 deleted file mode 100644 index b31cf98396ff4af1f97f2b8377202a463487ad70_LmZsYWtlOA==..0000000000000000000000000000000000000000 --- a/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -max-line-length = 88 -per-file-ignores= - __init__.py:F401 - __manifest__.py:B018 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b31cf98396ff4af1f97f2b8377202a463487ad70_LmdpdGxhYi1jaS55bWw=..5c559305469f192a7fc0bd1458b51e189ed075e9_LmdpdGxhYi1jaS55bWw= 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,3 @@ include: - project: xcg/ci-templates - file: /odoo/16.0/gitlab-ci.yaml + file: /odoo/18.0/gitlab-ci.yaml diff --git a/.prettierrc.yml b/.prettierrc.yml deleted file mode 100644 index b31cf98396ff4af1f97f2b8377202a463487ad70_LnByZXR0aWVycmMueW1s..0000000000000000000000000000000000000000 --- a/.prettierrc.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Defaults for all prettier-supported languages. -# Prettier will complete this with settings from .editorconfig file. -bracketSpacing: false -printWidth: 88 -proseWrap: always -semi: true -trailingComma: "es5" -xmlWhitespaceSensitivity: "ignore" diff --git a/NEWS.rst b/NEWS.rst index b31cf98396ff4af1f97f2b8377202a463487ad70_TkVXUy5yc3Q=..5c559305469f192a7fc0bd1458b51e189ed075e9_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -2,6 +2,6 @@ Changelog ========= -16.0.1.0.1 +18.0.1.0.0 ---------- @@ -6,8 +6,3 @@ ---------- -Loosen python version. - -16.0.1.0.0 ----------- - -Migration to Odoo 16. +Migration to Odoo 18. diff --git a/README.rst b/README.rst index b31cf98396ff4af1f97f2b8377202a463487ad70_UkVBRE1FLnJzdA==..5c559305469f192a7fc0bd1458b51e189ed075e9_UkVBRE1FLnJzdA== 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ =============== .. |coverage| image:: .badges/coverage.svg - :target: https://orus.io/xcg/odoo-modules/base_context/-/pipelines?ref=branch/16.0 + :target: https://orus.io/xcg/odoo-modules/base_context/-/pipelines?ref=branch/18.0 :alt: Coverage report .. the image is updated by the CI when building the documentation .. |pylint| image:: .badges/pylint.svg @@ -7,7 +7,7 @@ :alt: Coverage report .. the image is updated by the CI when building the documentation .. |pylint| image:: .badges/pylint.svg - :target: https://orus.io/xcg/odoo-modules/base_context/-/pipelines?ref=branch/16.0 + :target: https://orus.io/xcg/odoo-modules/base_context/-/pipelines?ref=branch/18.0 :alt: pylint score .. |maturity| image:: .badges/maturity.svg :target: https://odoo-community.org/page/development-status @@ -15,10 +15,10 @@ .. |license| image:: .badges/licence-AGPL--3-blue.svg :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -.. |black| image:: .badges/code_style-black-000000.svg - :target: https://github.com/psf/black - :alt: Black +.. |ruff| image:: .badges/code_style-ruff.svg + :target: https://github.com/astral-sh/ruff + :alt: Ruff .. |prettier| image:: .badges/code_style-prettier-ff69b4.svg :target: https://github.com/prettier/prettier :alt: Prettier @@ -21,7 +21,7 @@ .. |prettier| image:: .badges/code_style-prettier-ff69b4.svg :target: https://github.com/prettier/prettier :alt: Prettier -|coverage| |pylint| |maturity| |license| |black| |prettier| +|coverage| |pylint| |maturity| |license| |ruff| |prettier| Provide a :py:meth:~odoo.models.Model.get_clean_context and :py:meth:~odoo.models.Model.with_lang method on models. diff --git a/__manifest__.py b/__manifest__.py index b31cf98396ff4af1f97f2b8377202a463487ad70_X19tYW5pZmVzdF9fLnB5..5c559305469f192a7fc0bd1458b51e189ed075e9_X19tYW5pZmVzdF9fLnB5 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ ############################################################################## # # Context Methods, for Odoo -# Copyright © 2021, 2022, 2023 XCG Consulting <https://xcg-consulting.fr> +# Copyright © 2021, 2022, 2023, 2024 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,7 +21,7 @@ "name": "Context Methods", "license": "AGPL-3", "summary": "Provide context method on models", - "version": "16.0.1.0.1", + "version": "18.0.1.0.0", "category": "Hidden", "author": "XCG Consulting", "website": "https://orbeet.io/", diff --git a/eslint.config.cjs b/eslint.config.cjs new file mode 100644 index 0000000000000000000000000000000000000000..5c559305469f192a7fc0bd1458b51e189ed075e9_ZXNsaW50LmNvbmZpZy5janM= --- /dev/null +++ b/eslint.config.cjs @@ -0,0 +1,204 @@ +jsdoc = require("eslint-plugin-jsdoc"); + +const config = [ + { + plugins: { + jsdoc, + }, + languageOptions: { + globals: { + _: "readonly", + $: "readonly", + fuzzy: "readonly", + jQuery: "readonly", + moment: "readonly", + odoo: "readonly", + openerp: "readonly", + owl: "readonly", + luxon: "readonly", + }, + ecmaVersion: 2024, + sourceType: "script", + }, + rules: { + "accessor-pairs": "warn", + "array-callback-return": "warn", + "callback-return": "warn", + "capitalized-comments": [ + "warn", + "always", + { + ignoreConsecutiveComments: true, + ignoreInlineComments: true, + }, + ], + complexity: ["warn", 15], + "constructor-super": "warn", + "dot-notation": "warn", + eqeqeq: "warn", + "global-require": "warn", + "handle-callback-err": "warn", + "id-blacklist": "warn", + "id-match": "warn", + "init-declarations": "error", + "max-depth": "warn", + "max-nested-callbacks": "warn", + "max-statements-per-line": "warn", + "no-alert": "warn", + "no-array-constructor": "warn", + "no-caller": "warn", + "no-case-declarations": "warn", + "no-class-assign": "warn", + "no-cond-assign": "error", + "no-const-assign": "error", + "no-constant-condition": "warn", + "no-control-regex": "warn", + "no-debugger": "error", + "no-delete-var": "warn", + "no-div-regex": "warn", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-else-return": "warn", + "no-empty-character-class": "warn", + "no-empty-function": "error", + "no-empty-pattern": "error", + "no-empty": "warn", + "no-eq-null": "error", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "warn", + "no-extra-bind": "warn", + "no-extra-boolean-cast": "warn", + "no-extra-label": "warn", + "no-fallthrough": "warn", + "no-func-assign": "error", + "no-global-assign": "error", + "no-implicit-coercion": [ + "warn", + { + allow: ["~"], + }, + ], + "no-implicit-globals": "warn", + "no-implied-eval": "warn", + "no-inline-comments": "warn", + "no-inner-declarations": "warn", + "no-invalid-regexp": "warn", + "no-irregular-whitespace": "warn", + "no-iterator": "warn", + "no-label-var": "warn", + "no-labels": "warn", + "no-lone-blocks": "warn", + "no-lonely-if": "error", + "no-mixed-requires": "error", + "no-multi-str": "warn", + "no-native-reassign": "error", + "no-negated-condition": "warn", + "no-negated-in-lhs": "error", + "no-new-func": "warn", + "no-new-object": "warn", + "no-new-require": "warn", + "no-new-symbol": "warn", + "no-new-wrappers": "warn", + "no-new": "warn", + "no-obj-calls": "warn", + "no-octal-escape": "warn", + "no-octal": "warn", + "no-param-reassign": "warn", + "no-path-concat": "warn", + "no-process-env": "warn", + "no-process-exit": "warn", + "no-proto": "warn", + "no-prototype-builtins": "warn", + "no-redeclare": "warn", + "no-regex-spaces": "warn", + "no-restricted-globals": "warn", + "no-restricted-imports": "warn", + "no-restricted-modules": "warn", + "no-restricted-syntax": "warn", + "no-return-assign": "error", + "no-script-url": "warn", + "no-self-assign": "warn", + "no-self-compare": "warn", + "no-sequences": "warn", + "no-shadow-restricted-names": "warn", + "no-shadow": "warn", + "no-sparse-arrays": "warn", + "no-sync": "warn", + "no-this-before-super": "warn", + "no-throw-literal": "warn", + "no-undef-init": "warn", + "no-undef": "error", + "no-unmodified-loop-condition": "warn", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unused-expressions": "error", + "no-unused-labels": "error", + "no-unused-vars": "error", + "no-use-before-define": "error", + "no-useless-call": "warn", + "no-useless-computed-key": "warn", + "no-useless-concat": "warn", + "no-useless-constructor": "warn", + "no-useless-escape": "warn", + "no-useless-rename": "warn", + "no-void": "warn", + "no-with": "warn", + "operator-assignment": ["error", "always"], + "prefer-const": "warn", + radix: "warn", + "require-yield": "warn", + "sort-imports": "warn", + "spaced-comment": ["error", "always"], + strict: ["error", "function"], + "use-isnan": "error", + "jsdoc/check-tag-names": "warn", + "jsdoc/check-types": "warn", + "jsdoc/require-param-description": "off", + "jsdoc/require-return": "off", + "jsdoc/require-return-description": "off", + "jsdoc/require-return-type": "off", + "valid-typeof": "warn", + yoda: "warn", + }, + settings: { + jsdoc: { + tagNamePreference: { + arg: "param", + argument: "param", + augments: "extends", + constructor: "class", + exception: "throws", + func: "function", + method: "function", + prop: "property", + return: "returns", + virtual: "abstract", + yield: "yields", + }, + preferredTypes: { + array: "Array", + bool: "Boolean", + boolean: "Boolean", + number: "Number", + object: "Object", + str: "String", + string: "String", + }, + }, + }, + }, + { + files: ["**/*.esm.js"], + languageOptions: { + ecmaVersion: 2024, + sourceType: "module", + }, + }, +]; + +module.exports = config; diff --git a/models/base.py b/models/base.py index b31cf98396ff4af1f97f2b8377202a463487ad70_bW9kZWxzL2Jhc2UucHk=..5c559305469f192a7fc0bd1458b51e189ed075e9_bW9kZWxzL2Jhc2UucHk= 100644 --- a/models/base.py +++ b/models/base.py @@ -1,7 +1,7 @@ ############################################################################## # # Context Methods, for Odoo -# Copyright © 2021, 2022, 2023 XCG Consulting <https://xcg-consulting.fr> +# Copyright © 2021, 2022, 2023, 2024 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/prettier.config.cjs b/prettier.config.cjs new file mode 100644 index 0000000000000000000000000000000000000000..5c559305469f192a7fc0bd1458b51e189ed075e9_cHJldHRpZXIuY29uZmlnLmNqcw== --- /dev/null +++ b/prettier.config.cjs @@ -0,0 +1,12 @@ +/** @type {import('prettier').Config} */ + +const config = { + bracketSpacing: false, + printWidth: 88, + proseWrap: "always", + semi: true, + trailingComma: "es5", + xmlWhitespaceSensitivity: "ignore", +}; + +module.exports = config; diff --git a/pyproject.toml b/pyproject.toml index b31cf98396ff4af1f97f2b8377202a463487ad70_cHlwcm9qZWN0LnRvbWw=..5c559305469f192a7fc0bd1458b51e189ed075e9_cHlwcm9qZWN0LnRvbWw= 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,10 +2,10 @@ name = "odoo-addon-base_context" dynamic = ["version"] readme = "README.rst" -requires-python = "~=3.10" +requires-python = "~=3.11" license = { file = "LICENSE", name = "GNU Affero General Public License v3" } keywords = ["odoo"] authors = [{ name = "XCG Consulting" }] classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", @@ -6,7 +6,8 @@ license = { file = "LICENSE", name = "GNU Affero General Public License v3" } keywords = ["odoo"] authors = [{ name = "XCG Consulting" }] classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Framework :: Odoo", @@ -12,4 +13,4 @@ "Framework :: Odoo", - "Framework :: Odoo :: 16.0", + "Framework :: Odoo :: 18.0", "License :: OSI Approved :: GNU Affero General Public License v3" ] @@ -14,6 +15,6 @@ "License :: OSI Approved :: GNU Affero General Public License v3" ] -dependencies = ["odoo==16.0.*"] +dependencies = ["odoo==18.0.*"] [project.optional-dependencies] doc = [] @@ -21,6 +22,6 @@ [project.urls] repository = "https://orus.io/xcg/odoo-modules/base_context" -changelog = "https://orus.io/xcg/odoo-modules/base_context/-/blob/branch/16.0/NEWS.rst" +changelog = "https://orus.io/xcg/odoo-modules/base_context/-/blob/branch/18.0/NEWS.rst" [build-system] @@ -25,5 +26,5 @@ [build-system] -requires = ["setuptools >=64.0.0", "wheel", "setuptools_scm[toml] >=6.2"] -build-backend = "setuptools.build_meta" +requires = ["hatchling >=1.19", "hatch-vcs"] +build-backend = "hatchling.build" @@ -29,4 +30,13 @@ -[tool.setuptools] -package-dir = { "odoo.addons.base_context" = "." } +[tool.hatch.build] +exclude = [ + "/doc/", + "/.editorconfig", + "/eslint.config.cjs", + "/.gitlab-ci.yml", + "/.hgignore", + "/.hgtags", + "/prettier.config.cjs", + "/.yamllint.yaml" +] @@ -32,4 +42,13 @@ -[tool.setuptools.package-data] -"*" = ["*"] +[tool.hatch.build.targets.wheel] +include = [ + "*.csv", + "/i18n/", + "/static/", + "README.rst", + "*.xml", + "*.py", + "*.svg", + "*.png" +] @@ -35,3 +54,4 @@ -[tool.setuptools_scm] +[tool.hatch.build.targets.wheel.sources] +"" = "odoo/addons/base_context" @@ -37,5 +57,5 @@ -[tool.black] -target = 3.10 +[tool.hatch.version] +source = "vcs" [tool.isort] @@ -40,15 +60,11 @@ [tool.isort] -py_version = 310 -profile = "black" -known_odoo = ['odoo'] -known_odoo_addons = ['odoo.addons'] -sections = [ - 'FUTURE', - 'STDLIB', - 'THIRDPARTY', - 'ODOO', - 'ODOO_ADDONS', - 'FIRSTPARTY', - 'LOCALFOLDER' +section-order = [ + "future", + "standard-library", + "third-party", + "odoo", + "odoo-addons", + "first-party", + "local-folder" ] @@ -54,1 +70,25 @@ ] + +[tool.isort.sections] +"odoo" = ["odoo"] +"odoo-addons" = ["odoo.addons"] + +[tool.ruff.lint.mccabe] +max-complexity = 16 + +[tool.ruff] +target-version = "py311" + +[tool.ruff.lint] +extend-select = [ + "B", + "C90", + "E501", # line too long (default 88) + "I", # isort + "UP", # pyupgrade + +] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py +"__manifest__.py" = ["B018"] # useless expression diff --git a/tests/test_with_lang.py b/tests/test_with_lang.py index b31cf98396ff4af1f97f2b8377202a463487ad70_dGVzdHMvdGVzdF93aXRoX2xhbmcucHk=..5c559305469f192a7fc0bd1458b51e189ed075e9_dGVzdHMvdGVzdF93aXRoX2xhbmcucHk= 100644 --- a/tests/test_with_lang.py +++ b/tests/test_with_lang.py @@ -1,7 +1,7 @@ ############################################################################## # # Context Methods, for Odoo -# Copyright © 2022 XCG Consulting <https://xcg-consulting.fr> +# Copyright © 2022, 2023, 2024 XCG Consulting <https://xcg-consulting.fr> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as