Skip to main content
OdooLS gives you three mechanisms to control diagnostic output: a per-import-type switch, a per-code severity map, and a path-based filter list. All settings live in your odools.toml file under the [config] section.

diag_missing_imports

diag_missing_imports
string
default:"all"
Controls which missing-import diagnostics (OLS02001) OdooLS emits.
ValueBehavior
"none"No missing-import diagnostics are emitted anywhere
"only_odoo"Diagnostics only for imports inside Odoo addon modules
"all"Diagnostics for all imports in the workspace (default)
[[config]]
diag_missing_imports = "only_odoo"
Use "only_odoo" if your workspace mixes Odoo addons with third-party Python packages that are not on the configured sys.path. This avoids noise from unresolvable stdlib or pip imports.

diagnostic_settings

diagnostic_settings
map<string, string>
A map from diagnostic code to severity. Accepted severity values are "Error", "Warning", "Info", "Hint", and "Disabled".Setting a code to "Disabled" completely suppresses it — no underline, no Problems panel entry.
[config.diagnostic_settings]
OLS03001 = "Disabled"   # suppress model-not-in-dependencies
OLS02001 = "Warning"    # downgrade missing import from warning (already default)
OLS01007 = "Error"      # keep wrong argument count as error
OLS03020 = "Disabled"   # suppress model shadowing warning
Codes not listed in diagnostic_settings use their default severity as defined in the diagnostic code reference pages.

diagnostic_filters

diagnostic_filters
array of filter objects
An ordered list of filters. Each filter matches diagnostics by file path, code pattern, and/or severity type, then suppresses the matched diagnostics for the matched files.
Each entry in diagnostic_filters is a TOML table with the following fields:
paths
array of strings
required
Glob patterns that match file paths. Supports *, **, and ?. Path variables ${userHome} and ${workspaceFolder:NAME} are expanded.
codes
array of strings
Regular expression patterns matched against diagnostic codes (e.g. "OLS03.*" matches all OLS03xxx codes). Defaults to matching all codes if omitted.
types
array of strings
Severity levels to filter: "Error", "Warning", "Info". Defaults to all types if omitted. "Disabled" is not a valid value here.
path_type
string
default:"in"
Controls how the paths list is interpreted.
ValueBehavior
"in"Apply this filter to files matching the paths list
"not_in"Apply this filter to files not matching the paths list

Examples

Suppress all model-dependency diagnostics in test files:
[[config.diagnostic_filters]]
paths = ["**/tests/**", "**/test_*.py"]
codes = ["OLS03.*"]
types = ["Error", "Warning"]
path_type = "in"
Suppress all warnings everywhere except the core addon:
[[config.diagnostic_filters]]
paths = ["${workspaceFolder:my_addon}/**"]
types = ["Warning"]
path_type = "not_in"
Silence missing-import warnings for a vendored third-party directory:
[[config.diagnostic_filters]]
paths = ["**/vendor/**"]
codes = ["OLS02.*"]
path_type = "in"
Filters are applied after diagnostic_settings. If you disable a code via diagnostic_settings, filters for that code have no effect because the diagnostic is never created.

Path variables

The following variables are expanded inside paths strings:
VariableExpands to
${userHome}The current user’s home directory
${workspaceFolder:NAME}The absolute path of workspace folder named NAME

Complete example

[[config]]
diag_missing_imports = "only_odoo"

[config.diagnostic_settings]
OLS03020 = "Disabled"
OLS03024 = "Disabled"
OLS02001 = "Warning"

[[config.diagnostic_filters]]
paths = ["**/tests/**", "**/test_*.py"]
codes = ["OLS03.*"]
types = ["Error", "Warning"]
path_type = "in"

[[config.diagnostic_filters]]
paths = ["${workspaceFolder:my_module}/migrations/**"]
codes = ["OLS04.*", "OLS03.*"]
path_type = "in"

Build docs developers (and LLMs) love