diff --git a/src/pre_commit_vauxoo/__main__.py b/src/pre_commit_vauxoo/__main__.py index c4a7250..55511ec 100644 --- a/src/pre_commit_vauxoo/__main__.py +++ b/src/pre_commit_vauxoo/__main__.py @@ -7,6 +7,7 @@ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ + from pre_commit_vauxoo.cli import main if __name__ == "__main__": diff --git a/src/pre_commit_vauxoo/cfg/.eslintrc.cjs b/src/pre_commit_vauxoo/cfg/.eslintrc.cjs new file mode 100644 index 0000000..0ce7acf --- /dev/null +++ b/src/pre_commit_vauxoo/cfg/.eslintrc.cjs @@ -0,0 +1,253 @@ +const config = [{ + languageOptions: { + globals: { + _: "readonly", + $: "readonly", + fuzzy: "readonly", + jQuery: "readonly", + moment: "readonly", + odoo: "readonly", + openerp: "readonly", + owl: "readonly", + luxon: "readonly", + }, + + ecmaVersion: 2024, + sourceType: "module", + }, + + rules: { + "accessor-pairs": "error", + "array-bracket-spacing": "off", + "array-callback-return": "error", + "arrow-body-style": "off", + "arrow-parens": "off", + "arrow-spacing": "off", + "block-scoped-var": "off", + "block-spacing": "off", + "brace-style": "off", + "callback-return": "error", + "camelcase": "off", + "capitalized-comments": "off", + "comma-dangle": "off", + "comma-spacing": "off", + "comma-style": "error", + "complexity": "off", + "computed-property-spacing": "off", + "consistent-return": "off", + "consistent-this": "off", + "constructor-super": "error", + "curly": "off", + "default-case": "off", + "dot-location": [ + "error", + "property" + ], + "dot-notation": "off", + "eol-last": "error", + "eqeqeq": "off", + "func-names": "off", + "func-style": "off", + "generator-star-spacing": "off", + "global-require": "error", + "guard-for-in": "off", + "handle-callback-err": "error", + "id-blacklist": "error", + "id-length": "off", + "id-match": "error", + "indent": "off", + "init-declarations": "off", + "jsx-quotes": "error", + "key-spacing": "off", + "keyword-spacing": "off", + "linebreak-style": [ + "error", + "unix" + ], + "lines-around-comment": "off", + "max-depth": "off", + "max-len": "off", + "max-lines": "off", + "max-nested-callbacks": "error", + "max-params": "off", + "max-statements": "off", + "max-statements-per-line": "off", + "multiline-ternary": "off", + "new-cap": "off", + "new-parens": "error", + "newline-after-var": "off", + "newline-before-return": "off", + "newline-per-chained-call": "off", + "no-alert": "off", + "no-array-constructor": "error", + "no-bitwise": "off", + "no-caller": "error", + "no-case-declarations": "off", + "no-catch-shadow": "error", + "no-class-assign": "error", + "no-cond-assign": "off", + "no-confusing-arrow": "error", + "no-console": "off", + "no-const-assign": "error", + "no-constant-condition": "off", + "no-continue": "off", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-div-regex": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-keys": "off", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-else-return": "off", + "no-empty": "off", + "no-empty-character-class": "error", + "no-empty-function": "off", + "no-empty-pattern": "error", + "no-eq-null": "off", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "off", + "no-extra-bind": "error", + "no-extra-boolean-cast": "error", + "no-extra-label": "error", + "no-extra-parens": "off", + "no-extra-semi": "off", + "no-fallthrough": "error", + "no-floating-decimal": "error", + "no-func-assign": "error", + "no-global-assign": "off", + "no-implicit-coercion": "off", + "no-implicit-globals": "off", + "no-implied-eval": "error", + "no-inline-comments": "off", + "no-inner-declarations": "off", + "no-invalid-regexp": "error", + "no-invalid-this": "off", + "no-irregular-whitespace": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "off", + "no-loop-func": "off", + "no-magic-numbers": "off", + "no-mixed-operators": "off", + "no-mixed-requires": "off", + "no-mixed-spaces-and-tabs": "error", + "no-multi-spaces": "off", + "no-multi-str": "error", + "no-multiple-empty-lines": "off", + "no-native-reassign": "off", + "no-negated-condition": "off", + "no-negated-in-lhs": "error", + "no-nested-ternary": "off", + "no-new": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-require": "error", + "no-new-symbol": "error", + "no-new-wrappers": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-param-reassign": "off", + "no-path-concat": "error", + "no-plusplus": "off", + "no-process-env": "error", + "no-process-exit": "error", + "no-proto": "error", + "no-prototype-builtins": "off", + "no-redeclare": "off", + "no-regex-spaces": "error", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-modules": "error", + "no-restricted-syntax": "error", + "no-return-assign": "off", + "no-script-url": "error", + "no-self-assign": "off", + "no-self-compare": "error", + "no-sequences": "off", + "no-shadow": "off", + "no-shadow-restricted-names": "error", + "no-spaced-func": "off", + "no-sparse-arrays": "error", + "no-sync": "error", + "no-tabs": "error", + "no-ternary": "off", + "no-this-before-super": "error", + "no-throw-literal": "error", + "no-trailing-spaces": "off", + "no-undef": "off", + "no-undef-init": "error", + "no-undefined": "off", + "no-underscore-dangle": "off", + "no-unexpected-multiline": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "off", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unused-expressions": "off", + "no-unused-labels": "off", + "no-unused-vars": "off", + "no-use-before-define": "off", + "no-useless-call": "off", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "off", + "no-useless-escape": "off", + "no-useless-rename": "error", + "no-var": "off", + "no-void": "error", + "no-warning-comments": "off", + "no-whitespace-before-property": "error", + "no-with": "error", + "object-curly-newline": "off", + "object-curly-spacing": "off", + "object-property-newline": "off", + "object-shorthand": "off", + "one-var": "off", + "one-var-declaration-per-line": "off", + "operator-assignment": "error", + "operator-linebreak": "off", + "padded-blocks": "off", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-reflect": "off", + "prefer-rest-params": "off", + "prefer-spread": "off", + "prefer-template": "off", + "quote-props": "off", + "quotes": "off", + "radix": "off", + "require-jsdoc": "off", + "require-yield": "error", + "rest-spread-spacing": "off", + "semi": "off", + "semi-spacing": "off", + "sort-imports": "off", + "sort-vars": "off", + "space-before-blocks": "off", + "space-before-function-paren": "off", + "space-in-parens": "off", + "space-infix-ops": "off", + "space-unary-ops": "off", + "spaced-comment": "off", + "strict": "off", + "template-curly-spacing": "off", + "unicode-bom": "error", + "use-isnan": "error", + "valid-jsdoc": "off", + "valid-typeof": "error", + "vars-on-top": "off", + "wrap-iife": "off", + "wrap-regex": "off", + "yield-star-spacing": "off", + "yoda": "error" + }, + +}, ]; + +module.exports = config diff --git a/src/pre_commit_vauxoo/cfg/.eslintrc.json b/src/pre_commit_vauxoo/cfg/.eslintrc.json deleted file mode 100644 index 8eb68a4..0000000 --- a/src/pre_commit_vauxoo/cfg/.eslintrc.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "globals": { - "$": false, - "_": false, - "jQuery": false, - "moment": false, - "odoo": false, - "openerp": false, - "self": false - }, - "env": { - "browser": true - }, - "rules": { - "capitalized-comments": "off", - "no-alert": "off", - "no-array-constructor": "error", - "no-bitwise": "off", - "no-caller": "error", - "no-case-declarations": "off", - "no-catch-shadow": "error", - "no-class-assign": "error", - "no-cond-assign": "off", - "no-confusing-arrow": "error", - "no-console": "off", - "no-const-assign": "error", - "no-constant-condition": "off", - "no-continue": "off", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-div-regex": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-keys": "off", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-else-return": "off", - "no-empty": "off", - "no-empty-character-class": "error", - "no-empty-function": "off", - "no-empty-pattern": "error", - "no-eq-null": "off", - "no-eval": "error", - "no-ex-assign": "error", - "no-extend-native": "off", - "no-extra-bind": "error", - "no-extra-boolean-cast": "error", - "no-extra-label": "error", - "no-extra-parens": "off", - "no-extra-semi": "off", - "no-fallthrough": "error", - "no-floating-decimal": "error", - "no-func-assign": "error", - "no-global-assign": "off", - "no-implicit-coercion": "off", - "no-implicit-globals": "off", - "no-implied-eval": "error", - "no-inline-comments": "off", - "no-inner-declarations": "off", - "no-invalid-regexp": "error", - "no-invalid-this": "off", - "no-irregular-whitespace": "error", - "no-iterator": "error", - "no-label-var": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-lonely-if": "off", - "no-loop-func": "off", - "no-magic-numbers": "off", - "no-mixed-operators": "off", - "no-mixed-requires": "off", - "no-mixed-spaces-and-tabs": "error", - "no-multi-spaces": "off", - "no-multi-str": "error", - "no-multiple-empty-lines": "off", - "no-native-reassign": "off", - "no-negated-condition": "off", - "no-negated-in-lhs": "error", - "no-nested-ternary": "off", - "no-new": "error", - "no-new-func": "error", - "no-new-object": "error", - "no-new-require": "error", - "no-new-symbol": "error", - "no-new-wrappers": "error", - "no-obj-calls": "error", - "no-octal": "error", - "no-octal-escape": "error", - "no-param-reassign": "off", - "no-path-concat": "error", - "no-plusplus": "off", - "no-process-env": "error", - "no-process-exit": "error", - "no-proto": "error", - "no-prototype-builtins": "off", - "no-redeclare": "off", - "no-regex-spaces": "error", - "no-restricted-globals": "error", - "no-restricted-imports": "error", - "no-restricted-modules": "error", - "no-restricted-syntax": "error", - "no-return-assign": "off", - "no-script-url": "error", - "no-self-assign": "off", - "no-self-compare": "error", - "no-sequences": "off", - "no-shadow": "off", - "no-shadow-restricted-names": "error", - "no-whitespace-before-property": "error", - "no-spaced-func": "off", - "no-sparse-arrays": "error", - "no-sync": "error", - "no-tabs": "error", - "no-ternary": "off", - "no-trailing-spaces": "off", - "no-this-before-super": "error", - "no-throw-literal": "error", - "no-undef": "off", - "no-undef-init": "error", - "no-undefined": "off", - "no-unexpected-multiline": "error", - "no-underscore-dangle": "off", - "no-unmodified-loop-condition": "error", - "no-unneeded-ternary": "off", - "no-unreachable": "error", - "no-unsafe-finally": "error", - "no-unused-expressions": "off", - "no-unused-labels": "off", - "no-unused-vars": "off", - "no-use-before-define": "off", - "no-useless-call": "off", - "no-useless-computed-key": "error", - "no-useless-concat": "error", - "no-useless-constructor": "off", - "no-useless-escape": "off", - "no-useless-rename": "error", - "no-void": "error", - "no-var": "off", - "no-warning-comments": "off", - "no-with": "error", - "array-bracket-spacing": "off", - "array-callback-return": "error", - "arrow-body-style": "off", - "arrow-parens": "off", - "arrow-spacing": "off", - "accessor-pairs": "error", - "block-scoped-var": "off", - "block-spacing": "off", - "brace-style": "off", - "callback-return": "error", - "camelcase": "off", - "comma-dangle": "off", - "comma-spacing": "off", - "comma-style": "error", - "complexity": "off", - "computed-property-spacing": "off", - "consistent-return": "off", - "consistent-this": "off", - "constructor-super": "error", - "curly": "off", - "default-case": "off", - "dot-location": ["error", "property"], - "dot-notation": "off", - "eol-last": "error", - "eqeqeq": "off", - "func-names": "off", - "func-style": "off", - "generator-star-spacing": "off", - "global-require": "error", - "guard-for-in": "off", - "handle-callback-err": "error", - "id-blacklist": "error", - "id-length": "off", - "id-match": "error", - "indent": "off", - "init-declarations": "off", - "jsx-quotes": "error", - "key-spacing": "off", - "keyword-spacing": "off", - "linebreak-style": ["error", "unix"], - "lines-around-comment": "off", - "max-depth": "off", - "max-len": "off", - "max-lines": "off", - "max-nested-callbacks": "error", - "max-params": "off", - "max-statements": "off", - "max-statements-per-line": "off", - "multiline-ternary": "off", - "new-cap": "off", - "new-parens": "error", - "newline-after-var": "off", - "newline-before-return": "off", - "newline-per-chained-call": "off", - "object-curly-newline": "off", - "object-curly-spacing": "off", - "object-property-newline": "off", - "object-shorthand": "off", - "one-var": "off", - "one-var-declaration-per-line": "off", - "operator-assignment": "error", - "operator-linebreak": "off", - "padded-blocks": "off", - "prefer-arrow-callback": "off", - "prefer-const": "off", - "prefer-reflect": "off", - "prefer-rest-params": "off", - "prefer-spread": "off", - "prefer-template": "off", - "quote-props": "off", - "quotes": "off", - "radix": "off", - "require-jsdoc": "off", - "require-yield": "error", - "rest-spread-spacing": "off", - "semi": "off", - "semi-spacing": "off", - "sort-imports": "off", - "sort-vars": "off", - "space-before-blocks": "off", - "space-before-function-paren": "off", - "space-in-parens": "off", - "space-infix-ops": "off", - "space-unary-ops": "off", - "spaced-comment": "off", - "strict": "off", - "template-curly-spacing": "off", - "unicode-bom": "error", - "use-isnan": "error", - "valid-jsdoc": "off", - "valid-typeof": "error", - "vars-on-top": "off", - "wrap-iife": "off", - "wrap-regex": "off", - "yield-star-spacing": "off", - "yoda": "error" - }, - "parserOptions": { - "ecmaVersion": 2022, - "sourceType": "module" - } -} diff --git a/src/pre_commit_vauxoo/cfg/.flake8 b/src/pre_commit_vauxoo/cfg/.flake8 index 5df5fa3..875505e 100644 --- a/src/pre_commit_vauxoo/cfg/.flake8 +++ b/src/pre_commit_vauxoo/cfg/.flake8 @@ -7,7 +7,7 @@ # E203 (whitespace before ':') is handled by black and it doesn't consider black syntax like: # E741 do not use variables named ‘l’, ‘O’, or ‘I’ # chunk = records[index : index + chunk_size] -ignore = E123,E133,E203,E226,E241,E242,E501,E741,F811,F601,W503,W504 +ignore = B036,E123,E133,E203,E226,E241,E242,E501,E741,F811,F601,W503,W504 max-line-length = 119 per-file-ignores= __init__.py:F401 diff --git a/src/pre_commit_vauxoo/cfg/.flake8-optional b/src/pre_commit_vauxoo/cfg/.flake8-optional index 39eab33..d8c6bf2 100644 --- a/src/pre_commit_vauxoo/cfg/.flake8-optional +++ b/src/pre_commit_vauxoo/cfg/.flake8-optional @@ -4,7 +4,8 @@ jobs = 0 # B = bugbear # B9 = bugbear opinionated (incl line length +10% tolerance) select = C,E,F,W,B,B9 -# E203 whitespace before ':' (black behaviour) +# B036: Don't except `BaseException` unless you plan to re-raise it. (covered by pylint) +# E203: whitespace before ':' (black behaviour) # E501: flake8 line length (covered by bugbear B950) # W503: line break before binary operator (black behaviour) # W504: line break after binary operator (black behaviour?) @@ -17,7 +18,7 @@ select = C,E,F,W,B,B9 # B905: zip(strict=True) only works in python >= 3.10 # B907: We sometimes quote for stylistic purposes # F401: imported but unused (like __init__ already works) -ignore = E203,E501,W503,W504,E241,B023,E226,B904,B905,B907,E123,E275 +ignore = B036,E203,E501,W503,W504,E241,B023,E226,B904,B905,B907,E123,E275 per-file-ignores = __init__.py:F401 __manifest__.py:B018 diff --git a/src/pre_commit_vauxoo/cfg/.pre-commit-config-autofix.yaml b/src/pre_commit_vauxoo/cfg/.pre-commit-config-autofix.yaml index aaaf878..86b02eb 100644 --- a/src/pre_commit_vauxoo/cfg/.pre-commit-config-autofix.yaml +++ b/src/pre_commit_vauxoo/cfg/.pre-commit-config-autofix.yaml @@ -27,14 +27,14 @@ exclude: | ) default_language_version: python: python3 - node: "14.13.0" + node: "23.6.0" repos: - repo: https://github.com/psf/black-pre-commit-mirror.git - rev: 23.12.1 + rev: 25.1.0 hooks: - id: black - repo: https://github.com/myint/autoflake - rev: v2.2.1 + rev: v2.3.1 hooks: - id: autoflake args: @@ -45,18 +45,18 @@ repos: - --remove-duplicate-keys - --remove-unused-variables - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v3.1.0 hooks: - id: prettier name: prettier (with plugin-xml) additional_dependencies: - - "prettier@2.7.1" + - "prettier@2.8.8" - "@prettier/plugin-xml@2.2.0" args: - --plugin=@prettier/plugin-xml files: \.(js|xml)$ - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -68,31 +68,39 @@ repos: args: ["--remove"] - id: mixed-line-ending args: ["--fix=lf"] + - id: requirements-txt-fixer + - id: pretty-format-json + args: ["--autofix"] - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.20.0 hooks: - id: pyupgrade args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 6.0.1 hooks: - id: isort - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.4 + rev: v1.5.5 hooks: - id: remove-tabs exclude: (Makefile|debian/rules|.gitmodules|\.po|\.pot)(\.in)?$ - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.51.0 + - repo: local hooks: - id: eslint - name: javascript lints + name: eslint + entry: eslint args: - --color - - --config=.eslintrc.json + - --config=.eslintrc.cjs - --fix + verbose: true + types: [javascript] + language: node + additional_dependencies: + - eslint@9.18.0 - repo: https://github.com/OCA/odoo-pre-commit-hooks - rev: v0.1.4 + rev: v0.1.6 hooks: - id: oca-checks-po args: diff --git a/src/pre_commit_vauxoo/cfg/.pre-commit-config-optional.yaml b/src/pre_commit_vauxoo/cfg/.pre-commit-config-optional.yaml index 0c2b74f..8206e82 100644 --- a/src/pre_commit_vauxoo/cfg/.pre-commit-config-optional.yaml +++ b/src/pre_commit_vauxoo/cfg/.pre-commit-config-optional.yaml @@ -26,7 +26,7 @@ exclude: | ) default_language_version: python: python3 - node: "14.13.0" + node: "23.6.0" repos: - repo: https://github.com/OCA/pylint-odoo rev: v9.3.13 @@ -40,25 +40,25 @@ repos: # uncomment after fix https://github.com/OCA/pylint-odoo/pull/512 # - --jobs=0 # 0 will auto-detect the number of processors available to use - repo: https://github.com/OCA/odoo-pre-commit-hooks - rev: v0.1.4 + rev: v0.1.6 hooks: - id: oca-checks-odoo-module - id: oca-checks-po - repo: https://github.com/PyCQA/doc8 - rev: v1.1.1 + rev: v2.0.0 hooks: - id: doc8 name: RST lint - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.3.0 hooks: - id: flake8 name: flake8 + bugbear optional checks - additional_dependencies: ["flake8-bugbear==23.9.16"] + additional_dependencies: ["flake8-bugbear==24.12.12"] args: - --config=.flake8-optional - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.8.6 hooks: - id: bandit name: bandit EXPERIMENTAL (Won't affect CI status)! diff --git a/src/pre_commit_vauxoo/cfg/.pre-commit-config.yaml b/src/pre_commit_vauxoo/cfg/.pre-commit-config.yaml index 068cd22..0d8424c 100644 --- a/src/pre_commit_vauxoo/cfg/.pre-commit-config.yaml +++ b/src/pre_commit_vauxoo/cfg/.pre-commit-config.yaml @@ -26,10 +26,10 @@ exclude: | ) default_language_version: python: python3 - node: "14.13.0" + node: "23.6.0" repos: - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.3.0 hooks: - id: flake8 name: flake8 mandatory checks @@ -44,15 +44,19 @@ repos: - --disable=R0000 # uncomment after fix https://github.com/OCA/pylint-odoo/pull/512 # - --jobs=0 # 0 will auto-detect the number of processors available to use - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.51.0 + - repo: local hooks: - id: eslint - name: javascript mandatory checks + name: eslint + entry: eslint args: - --color - - --config=.eslintrc.json - # - --fix + - --config=.eslintrc.cjs + verbose: true + types: [javascript] + language: node + additional_dependencies: + - eslint@9.18.0 - repo: local hooks: - id: name-non-ascii @@ -70,14 +74,15 @@ repos: types: [text] files: (^deactivate\.jinja$|/data/neutralize\.sql$) - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - - id: debug-statements - id: check-case-conflict - id: check-docstring-first - id: check-executables-have-shebangs + - id: check-json - id: check-merge-conflict # exclude files where underlines are not distinguishable from merge conflicts exclude: /README\.rst$|^docs/.*\.rst$ - id: check-symlinks - id: check-xml + - id: debug-statements diff --git a/src/pre_commit_vauxoo/cli.py b/src/pre_commit_vauxoo/cli.py index fe6dbbc..65c2822 100644 --- a/src/pre_commit_vauxoo/cli.py +++ b/src/pre_commit_vauxoo/cli.py @@ -14,7 +14,6 @@ Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration """ - import contextlib import os import subprocess