diff --git a/.editorconfig b/.editorconfig index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_LmVkaXRvcmNvbmZpZw==..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_LmVkaXRvcmNvbmZpZw== 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ # Configuration for known file extensions -[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}] +[*.{css,htm,html,js,json,jsx,less,markdown,md,py,rst,sass,scss,toml,xml,yaml,yml}] charset = utf-8 end_of_line = lf indent_size = 4 @@ -7,6 +7,6 @@ insert_final_newline = true trim_trailing_whitespace = true -[*.{json,yml,yaml,rst,md}] +[*.{json,yml,yaml,rst,markdown,md,toml}] indent_size = 2 @@ -11,7 +11,7 @@ indent_size = 2 -# Do not configure editor for libs and autogenerated content -[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}] +# Do not configure editor for libs +[*/static/{lib,src/lib}/**] charset = unset end_of_line = unset indent_size = unset diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000000000000000000000000000000000000..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_LmVzbGludHJjLnltbA== --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,187 @@ +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 index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_LmZsYWtlOA==..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_LmZsYWtlOA== 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,5 @@ [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 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_LmdpdGxhYi1jaS55bWw=..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_LmdpdGxhYi1jaS55bWw= 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,6 @@ include: - project: xcg/ci-templates file: /odoo/15.0/gitlab-ci.yaml + +variables: + CI_TEMPLATE_NO_INSTALL_MODULE: "" diff --git a/__manifest__.py b/__manifest__.py index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_X19tYW5pZmVzdF9fLnB5..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_X19tYW5pZmVzdF9fLnB5 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -19,5 +19,6 @@ ############################################################################## { "name": "Calendar Widget", + "license": "AGPL-3", "summary": "A calendar widget to use inside a form view", "version": "15.0.1.0.0", @@ -22,4 +23,4 @@ "summary": "A calendar widget to use inside a form view", "version": "15.0.1.0.0", - "license": "AGPL-3", + "category": "Hidden", "author": "XCG Consulting", @@ -25,5 +26,4 @@ "author": "XCG Consulting", - "category": "Hidden", "website": "https://odoo.consulting/", "depends": [ "web", diff --git a/doc/autotodo.py b/doc/autotodo.py index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_ZG9jL2F1dG90b2RvLnB5..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_ZG9jL2F1dG90b2RvLnB5 100755 --- a/doc/autotodo.py +++ b/doc/autotodo.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2014, 2018, 2022 XCG Consulting +# Copyright © 2014, 2018, 2022, 2023 XCG Consulting # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,7 +22,7 @@ import os import os.path import sys -from typing import Dict, Mapping, Tuple +from collections.abc import Mapping def main(): @@ -99,8 +99,8 @@ res[tag].extend(info) -def scan_file(filename, tags) -> Tuple[Dict[str, Tuple[str, int, str]], int]: - res = {tag: [] for tag in tags} +def scan_file(filename, tags) -> tuple[dict[str, list[tuple[str, int, str]]], int]: + res: dict[str, list[tuple[str, int, str]]] = {tag: [] for tag in tags} line_num: int = 0 with open(filename, "r") as f: for line_num, line in enumerate(f): diff --git a/doc/conf.py b/doc/conf.py index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_ZG9jL2NvbmYucHk=..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_ZG9jL2NvbmYucHk= 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -34,7 +34,7 @@ "sphinx.ext.coverage", "sphinx.ext.graphviz", "sphinx.ext.viewcode", - "sphinxodoo.ext.autodoc", + "sphinxodooautodoc.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. @@ -145,7 +145,5 @@ intersphinx_mapping = {"https://docs.python.org/3/": None} -# -# odoo-sphinx-autodoc -# +# -- Options for sphinx-odoo-autodoc extension ---------------------------- @@ -151,5 +149,6 @@ -# sphinxodoo_addons : List of addons name to load (if empty, no addon will be loaded) +# sphinxodooautodoc_addons : List of addons name to load (if empty, no addon will be +# loaded) this_module = os.path.basename( os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ) @@ -153,10 +152,12 @@ this_module = os.path.basename( os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ) -sphinxodoo_addons = [this_module] -# sphinxodoo_root_path : Path of the Odoo root directory -sphinxodoo_root_path = os.path.dirname(os.path.dirname(os.path.abspath(odoo.__file__))) -# sphinxodoo_addons_path : List of paths were Odoo addons to load are located +sphinxodooautodoc_addons = [this_module] +# sphinxodooautodoc_root_path : Path of the Odoo root directory +sphinxodooautodoc_root_path = os.path.dirname( + os.path.dirname(os.path.abspath(odoo.__file__)) +) +# sphinxodooautodoc_addons_path : List of paths were Odoo addons to load are located c = None # find setup file of superproject, if any directory = os.path.dirname(os.getenv("PWD")) @@ -167,7 +168,7 @@ c.read(setup_path) if c.has_section("odoo_scripts"): # reload with odoo_scripts - c = Configuration(os.path.dirname(setup_path)) + c = Configuration(directory) else: c = None if not c: @@ -176,9 +177,9 @@ else: directory = None -sphinxodoo_addons_path = list() +sphinxodooautodoc_addons_path = [] if c: addon_dirs = set(os.path.dirname(path) for path in c.modules) for line in addon_dirs: @@ -180,8 +181,8 @@ if c: addon_dirs = set(os.path.dirname(path) for path in c.modules) for line in addon_dirs: - sphinxodoo_addons_path.append(os.path.join(directory, line)) + sphinxodooautodoc_addons_path.append(os.path.join(directory, line)) else: # add this directory top dir @@ -186,6 +187,8 @@ else: # add this directory top dir - sphinxodoo_addons_path.append(os.path.dirname(os.path.dirname(os.getenv("PWD")))) + sphinxodooautodoc_addons_path.append( + os.path.dirname(os.path.dirname(os.getenv("PWD"))) + ) other_addons = os.getenv("ODOO_ADDONS_PATH", default=None) if other_addons: for addon_path in other_addons.split(","): @@ -189,4 +192,4 @@ other_addons = os.getenv("ODOO_ADDONS_PATH", default=None) if other_addons: for addon_path in other_addons.split(","): - sphinxodoo_addons_path.append(addon_path) + sphinxodooautodoc_addons_path.append(addon_path) diff --git a/doc/index.rst b/doc/index.rst index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_ZG9jL2luZGV4LnJzdA==..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_ZG9jL2luZGV4LnJzdA== 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,3 +1,12 @@ +.. |coverage| image:: .badges/coverage.svg + :target: https://orus.io/xcg/odoo-modules/calendar_field/-/pipelines?ref=branch/15.0 + :alt: Coverage report +.. |pylint| image:: .badges/pylint.svg + :target: https://orus.io/xcg/odoo-modules/calendar_field/-/pipelines?ref=branch/15.0 + :alt: pylint score + +|coverage| |pylint| + .. include:: README.rst Contents: @@ -15,4 +24,3 @@ * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/pyproject.toml b/pyproject.toml index 4a82bff4d7852ef4eb6b494136c2d0f83e1aaead_cHlwcm9qZWN0LnRvbWw=..9fad63a387d0ed6b49bfa4ef4c879ae63a3da6cc_cHlwcm9qZWN0LnRvbWw= 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,70 @@ +[project] +name = "odoo-addon-calendar_field" +dynamic = ["version"] +readme = "README.rst" +requires-python = "~=3.9" +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.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Framework :: Odoo", + "Framework :: Odoo :: 15.0", + "License :: OSI Approved :: GNU Affero General Public License v3" +] +dependencies = ["odoo==15.0.*"] + +[project.optional-dependencies] +doc = ["sphinx", "sphinx-odoo-autodoc", "odoo-scripts"] +test = [] + +[project.urls] +repository = "https://orus.io/xcg/odoo-modules/calendar_field" +changelog = "https://orus.io/xcg/odoo-modules/calendar_field/-/blob/branch/15.0/NEWS.rst" + +[build-system] +requires = ["hatchling >=1.19", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.build] +exclude = [ + "/doc/", + "/.editorconfig", + "/.eslintrc.yml", + "/.flake8", + "/.gitlab-ci.yml", + "/.hgignore", + "/.hgtags", + "/.prettierrc.yml", + "/.yamllint.yaml" +] + +[tool.hatch.build.targets.wheel] +include = [ + "*.csv", + "/i18n/", + "/static/", + "README.rst", + "*.xml", + "*.py", + "*.svg", + "*.png" +] + +[tool.hatch.build.targets.wheel.sources] +"" = "odoo/addons/calendar_field" + +[tool.hatch.version] +source = "vcs" + +[tool.black] +target-version = ["py39", "py310", "py311"] +required-version = "22" + [tool.isort] py_version = 39 profile = "black" @@ -12,6 +79,3 @@ 'FIRSTPARTY', 'LOCALFOLDER' ] - -[tool.black] -target = 3.9