Skip to content

Commit e8b84f0

Browse files
committed
chore: fix pre-commit issues and add missing config files
- Add missing config files from openspp-modules (.eslintrc.yml, .editorconfig, .prettierrc.yml, .ruff.toml, .openspp-lint.yaml, .flake8, .isort.cfg, .gitattributes) - Fix eslint version 9.12.0 -> 8.57.0 for .eslintrc.yml compatibility - Fix PII in log messages (use IDs instead of names) - Fix g2p namespace reference - Fix YAML syntax error in compliance.yaml - Fix XML ID naming conventions for privileges - Apply auto-formatting (prettier, ruff-format, whitespace) - Regenerate README files and requirements.txt
1 parent 9611ede commit e8b84f0

547 files changed

Lines changed: 10590 additions & 5868 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Configuration for known file extensions
2+
[*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}]
3+
charset = utf-8
4+
end_of_line = lf
5+
indent_size = 4
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{json,yml,yaml,rst,md}]
11+
indent_size = 2
12+
13+
# Do not configure editor for libs and autogenerated content
14+
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
15+
charset = unset
16+
end_of_line = unset
17+
indent_size = unset
18+
indent_style = unset
19+
insert_final_newline = false
20+
trim_trailing_whitespace = false

.eslintrc.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
root: true
2+
env:
3+
browser: true
4+
es6: true
5+
6+
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
7+
parserOptions:
8+
ecmaVersion: 2024
9+
10+
overrides:
11+
- files:
12+
- "**/*.esm.js"
13+
- "**/*.js"
14+
parserOptions:
15+
sourceType: module
16+
17+
# Globals available in Odoo that shouldn't produce errorings
18+
globals:
19+
_: readonly
20+
$: readonly
21+
fuzzy: readonly
22+
jQuery: readonly
23+
moment: readonly
24+
odoo: readonly
25+
openerp: readonly
26+
owl: readonly
27+
28+
# Styling is handled by Prettier, so we only need to enable AST rules;
29+
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
30+
rules:
31+
accessor-pairs: warn
32+
array-callback-return: warn
33+
callback-return: warn
34+
capitalized-comments:
35+
- warn
36+
- always
37+
- ignoreConsecutiveComments: true
38+
ignoreInlineComments: true
39+
complexity:
40+
- warn
41+
- 15
42+
constructor-super: warn
43+
dot-notation: warn
44+
eqeqeq: warn
45+
global-require: warn
46+
handle-callback-err: warn
47+
id-blacklist: warn
48+
id-match: warn
49+
init-declarations: error
50+
max-depth: warn
51+
max-nested-callbacks: warn
52+
max-statements-per-line: warn
53+
no-alert: warn
54+
no-array-constructor: warn
55+
no-caller: warn
56+
no-case-declarations: warn
57+
no-class-assign: warn
58+
no-cond-assign: error
59+
no-const-assign: error
60+
no-constant-condition: warn
61+
no-control-regex: warn
62+
no-debugger: error
63+
no-delete-var: warn
64+
no-div-regex: warn
65+
no-dupe-args: error
66+
no-dupe-class-members: error
67+
no-dupe-keys: error
68+
no-duplicate-case: error
69+
no-duplicate-imports: error
70+
no-else-return: warn
71+
no-empty-character-class: warn
72+
no-empty-function: error
73+
no-empty-pattern: error
74+
no-empty: warn
75+
no-eq-null: error
76+
no-eval: error
77+
no-ex-assign: error
78+
no-extend-native: warn
79+
no-extra-bind: warn
80+
no-extra-boolean-cast: warn
81+
no-extra-label: warn
82+
no-fallthrough: warn
83+
no-func-assign: error
84+
no-global-assign: error
85+
no-implicit-coercion:
86+
- warn
87+
- allow: ["~"]
88+
no-implicit-globals: warn
89+
no-implied-eval: warn
90+
no-inline-comments: warn
91+
no-inner-declarations: warn
92+
no-invalid-regexp: warn
93+
no-irregular-whitespace: warn
94+
no-iterator: warn
95+
no-label-var: warn
96+
no-labels: warn
97+
no-lone-blocks: warn
98+
no-lonely-if: error
99+
no-mixed-requires: error
100+
no-multi-str: warn
101+
no-native-reassign: error
102+
no-negated-condition: warn
103+
no-negated-in-lhs: error
104+
no-new-func: warn
105+
no-new-object: warn
106+
no-new-require: warn
107+
no-new-symbol: warn
108+
no-new-wrappers: warn
109+
no-new: warn
110+
no-obj-calls: warn
111+
no-octal-escape: warn
112+
no-octal: warn
113+
no-param-reassign: warn
114+
no-path-concat: warn
115+
no-process-env: warn
116+
no-process-exit: warn
117+
no-proto: warn
118+
no-prototype-builtins: warn
119+
no-redeclare: warn
120+
no-regex-spaces: warn
121+
no-restricted-globals: warn
122+
no-restricted-imports: warn
123+
no-restricted-modules: warn
124+
no-restricted-syntax: warn
125+
no-return-assign: error
126+
no-script-url: warn
127+
no-self-assign: warn
128+
no-self-compare: warn
129+
no-sequences: warn
130+
no-shadow-restricted-names: warn
131+
no-shadow: warn
132+
no-sparse-arrays: warn
133+
no-sync: warn
134+
no-this-before-super: warn
135+
no-throw-literal: warn
136+
no-undef-init: warn
137+
no-undef: warn
138+
no-unmodified-loop-condition: warn
139+
no-unneeded-ternary: error
140+
no-unreachable: error
141+
no-unsafe-finally: error
142+
no-unused-expressions: error
143+
no-unused-labels: error
144+
no-unused-vars: error
145+
no-use-before-define: error
146+
no-useless-call: warn
147+
no-useless-computed-key: warn
148+
no-useless-concat: warn
149+
no-useless-constructor: warn
150+
no-useless-escape: warn
151+
no-useless-rename: warn
152+
no-void: warn
153+
no-with: warn
154+
operator-assignment: [error, always]
155+
prefer-const: warn
156+
radix: warn
157+
require-yield: warn
158+
sort-imports: warn
159+
spaced-comment: [error, always]
160+
strict: [error, function]
161+
use-isnan: error
162+
valid-jsdoc:
163+
- warn
164+
- prefer:
165+
arg: param
166+
argument: param
167+
augments: extends
168+
constructor: class
169+
exception: throws
170+
func: function
171+
method: function
172+
prop: property
173+
return: returns
174+
virtual: abstract
175+
yield: yields
176+
preferType:
177+
array: Array
178+
bool: Boolean
179+
boolean: Boolean
180+
number: Number
181+
object: Object
182+
str: String
183+
string: String
184+
requireParamDescription: false
185+
requireReturn: false
186+
requireReturnDescription: false
187+
requireReturnType: false
188+
valid-typeof: warn
189+
yoda: warn

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[flake8]
2+
max-line-length = 120
3+
max-complexity = 25
4+
# B = bugbear
5+
# B9 = bugbear opinionated (incl line length)
6+
select = C,E,F,W,B,B9
7+
# E203: whitespace before ':' (black behaviour)
8+
# E501: flake8 line length (covered by bugbear B950)
9+
# W503: line break before binary operator (black behaviour)
10+
ignore = E203,E501,W503
11+
per-file-ignores=
12+
__init__.py:F401

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.geojson filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ docker/.env.production
103103
.act-secrets
104104
.actrc
105105
scripts/run_ci_local.sh
106-
.github/workflows/ci-local.yml
106+
.github/workflows/ci-local.yml

.isort.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[settings]
2+
; see https://github.com/psf/black
3+
multi_line_output=3
4+
include_trailing_comma=True
5+
force_grid_wrap=0
6+
combine_as_imports=True
7+
use_parentheses=True
8+
line_length=120
9+
known_odoo=odoo
10+
known_odoo_addons=odoo.addons
11+
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
12+
default_section=THIRDPARTY
13+
ensure_newline_before_comments = True

.openspp-lint.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# OpenSPP Lint Configuration
2+
# See scripts/lint/README.md for documentation
3+
4+
# Module-specific overrides
5+
modules:
6+
# Example: Allow non-standard patterns for specific modules
7+
# spp_api:
8+
# allow_model_patterns:
9+
# - "spp_api.*"
10+
11+
# Rule configurations
12+
rules:
13+
naming:
14+
# Additional Boolean field exceptions (beyond is_*/has_* prefix)
15+
boolean_exceptions:
16+
- "bidirectional"
17+
- "recurring"
18+
- "active" # Standard Odoo field
19+
# Additional verb prefixes for Boolean fields
20+
boolean_verb_prefixes:
21+
- "compute_"
22+
- "generate_"
23+
# Additional Many2one exceptions (fields that don't need _id suffix)
24+
# Built-in exceptions: parent, company, currency, country, state,
25+
# partner, user, categ, id_type, kind,
26+
# source, destination, relation,
27+
# disabled_by, created_by, approved_by, rejected_by,
28+
# district, region, province, city, village
29+
many2one_exceptions: []
30+
31+
# Model namespace exceptions (models that don't need spp.* namespace)
32+
# Built-in exceptions include:
33+
# - Standard Odoo models (res.partner, res.users, etc.)
34+
# - Third-party models (queue.job, fastapi.endpoint, res.users.role, etc.)
35+
# Add any additional models here that should be excluded from the spp.* check
36+
namespace_exceptions: []
37+
# Example:
38+
# namespace_exceptions:
39+
# - "my.custom.model"
40+
# - "external.lib.model"
41+
42+
xml_ids:
43+
# Allow legacy patterns during migration
44+
allow_legacy_patterns: false
45+
46+
performance:
47+
# N+1 detection is Odoo-aware:
48+
# - Skips methods with @api.depends (Odoo prefetches automatically)
49+
# - Detects .mapped() prefetch patterns
50+
# - Skips ORM method calls on related objects (write, update, etc.)
51+
# - Tracks nested loops correctly
52+
n_plus_one_threshold: 1
53+
54+
ui:
55+
# Models likely to have >1k records (require list limit="80")
56+
large_models:
57+
- "res.partner" # Registry
58+
- "spp.payment" # Transactional
59+
- "spp.entitlement" # Transactional
60+
- "spp.event.data" # Transactional
61+
- "spp.program.membership" # Relationship
62+
- "spp.group.membership" # Relationship
63+
- "spp.change.request" # Workflow (high volume)
64+
65+
# Search panel threshold (disable if records exceed this count)
66+
search_panel_max_records: 100000
67+
68+
# O2M fields that can be editable (exceptions to large O2M rule)
69+
# Add fields known to have <100 records
70+
allow_editable_o2m:
71+
- "line_ids" # Generic line items (typically <20)
72+
- "manager_ids" # Program managers (typically <10)
73+
- "approver_ids" # Approval workflow (typically <5)
74+
75+
# Severity overrides (change default severity for rules)
76+
# Valid values: error, warning, info
77+
severity:
78+
# Naming checks as warnings (common during migration)
79+
naming.boolean_prefix: warning
80+
naming.many2one_suffix: warning
81+
82+
# UI pattern checks
83+
ui.xpath_class: error # Error for @class (Odoo 19 incompatible)
84+
ui.statusbar_location: error # Error for statusbar in wrong location
85+
ui.extension_points: info # Info for missing extension points
86+
ui.large_o2m_editable: warning # Warn for editable large O2M fields
87+
88+
# Example: Downgrade performance checks during migration
89+
# performance.offset_pagination: info
90+
# performance.n_plus_one: info
91+
92+
# Patterns to ignore (glob patterns)
93+
ignore:
94+
- "**/migrations/**"
95+
- "**/tests/**"
96+
- "**/__pycache__/**"
97+
# Demo data generators - one-time operations where N+1 queries are acceptable
98+
- "**/wizard/*demo_generator.py"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ repos:
9797
types: [javascript]
9898
language: node
9999
additional_dependencies:
100-
- "eslint@9.12.0"
100+
- "eslint@8.57.0"
101101
- "eslint-plugin-jsdoc@50.3.1"
102102
- repo: https://github.com/pre-commit/pre-commit-hooks
103103
rev: v4.6.0

.prettierrc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Defaults for all prettier-supported languages.
2+
# Prettier will complete this with settings from .editorconfig file.
3+
bracketSpacing: false
4+
printWidth: 120
5+
proseWrap: always
6+
semi: true
7+
trailingComma: "es5"
8+
xmlWhitespaceSensitivity: "strict"

.ruff.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
target-version = "py312"
3+
fix = true
4+
line-length = 120
5+
6+
[lint]
7+
extend-select = [
8+
"B",
9+
"C90",
10+
"E501", # line too long (default 88)
11+
"I", # isort
12+
"UP", # pyupgrade
13+
]
14+
extend-safe-fixes = ["UP008"]
15+
exclude = ["setup/*"]
16+
17+
[format]
18+
exclude = ["setup/*"]
19+
20+
[lint.per-file-ignores]
21+
"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py
22+
"__manifest__.py" = ["B018", "E501"] # allow long lines and useless expression in manifests
23+
24+
[lint.isort]
25+
section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"]
26+
27+
[lint.isort.sections]
28+
"odoo" = ["odoo"]
29+
"odoo-addons" = ["odoo.addons"]
30+
31+
[lint.mccabe]
32+
max-complexity = 25

0 commit comments

Comments
 (0)