Compatibility
Default severity: Warning Auto-fix: No Category: Compatibility Can be disabled: Yes Enabled by default: Yes
What this rule does
A data-driven rule module that handles 1,924 MATLAB Code Analyzer checks about deprecated and removed functions and behavior changes. Instead of implementing one struct per check, a single CompatibilityEngine loads data/compatibility.toml at compile time, parses it into a function-name lookup table, and emits diagnostics with the specific check ID from the matched entry (e.g. DPSD, not the meta ID COMPAT).
On each function_call or command node, the engine extracts the function name and performs an O(1) HashMap lookup. A function name may map to multiple check IDs (e.g. tcpip → TCPC + TCPS); every matching entry is emitted. The entries span three category groups:
- compatibility — deprecated or removed functions (1,012 entries)
- behavior-changes — behavior changes between releases (905 entries)
- forward-compatibility — constructs that will break in a future release (7 entries)
Entries with an empty function_name are "generic" checks that cannot be matched by function name alone (they require AST pattern matching) and are skipped during the lookup-based check. These are implemented as file-level AST-pattern checks in the compatibility/generic/ modules (property and attribute removals, removed options and input arguments, forward-compatibility version gates, and behavior-change figure and axes properties) and dispatched from check_file.
Check IDs
Compatibility (899 checks)
Forward Compatibility (7 checks)
Behavior Changes (905 checks)
Examples
Incorrect
psd(x) % DPSD — removed; use periodogram or pwelch
strread(s) % STREAD — removed; use textscanCorrect
periodogram(x)
textscan(s)Configuration
The lookup engine itself takes no parameters. Per-check severity can be overridden by rule ID or by category:
[lint.categories]
compatibility = "warn"
[lint.rules]
COMPAT = "error"See Configuration for the full parameter list and rules.md for the complete rule inventory.