diff --git a/content/docs/analyzers/Common/CM0001.md b/content/docs/analyzers/Common/CM0001.md new file mode 100644 index 0000000..17edd1f --- /dev/null +++ b/content/docs/analyzers/Common/CM0001.md @@ -0,0 +1,40 @@ ++++ +title = 'The ALCops configuration file could not be fully loaded' +linkTitle = 'CM0001' + +[params] + id = 'CM0001' + severity = 'Warning' + category = 'Configuration' + codeAction = false + ignoreObsolete = false ++++ + +`CM0001` warns when an [`alcops.json`](/docs/getting-started/configuration/) configuration file was found but could not be fully applied. Without this warning a broken configuration silently falls back to the default settings, and it can be hard to understand why your settings have no effect. + +The message names the file and the reason: + +``` +The ALCops configuration 'C:\Source\MyApp\alcops.json' could not be fully loaded: unknown setting 'CognitivComplexityThreshold' +``` + +### When it is reported + +| Situation | Effect on settings | +|---|---| +| The file exists but cannot be read (I/O or permission error) | Defaults are used | +| The file contains invalid JSON (syntax error, wrong value type, unknown enum value) | Defaults are used | +| The file is valid JSON but contains an unrecognized top-level setting (for example a typo in the name) | All recognized settings still apply; one warning per unknown setting | + +No warning is reported when no `alcops.json` exists — using the defaults without a configuration file is perfectly fine. + +### Notes + +- Setting names are matched case-insensitively, and the `$schema` key is always allowed. +- The warning has no source location because `alcops.json` is not part of the compilation. Visual Studio Code shows such diagnostics against `app.json`. +- An unreadable `alcops.json` in the app folder does **not** fall back to a configuration in a parent directory: the app-level file was intended to win, so ALCops uses the defaults and reports the problem instead. +- Typos *inside* nested settings (for example a misspelled key under `StatementBlockSpacing`) are not detected by this rule; reference the [JSON schema](https://raw.githubusercontent.com/ALCops/Analyzers/main/src/ALCops.Common/Settings/alcops.schema.json) via `$schema` to have your editor validate those. + +### How to fix + +Open the `alcops.json` named in the message and correct the reported problem — fix the JSON syntax, correct the setting name, or resolve the file permission issue. The warning disappears once the file loads cleanly. diff --git a/content/docs/analyzers/Common/_index.md b/content/docs/analyzers/Common/_index.md new file mode 100644 index 0000000..1fb07b0 --- /dev/null +++ b/content/docs/analyzers/Common/_index.md @@ -0,0 +1,13 @@ +--- +title: "Common" +type: docs +no_list: true +--- + +Cross-cutting diagnostics from the shared `ALCops.Common` library. `ALCops.Common.dll` is loaded alongside every cop (it is part of every documented setup), so these diagnostics are reported once regardless of which cops you enable. + +## Rules + +| ID | Title | Severity | Enabled | Code Fix | +|---|---|---|---|---| +| [CM0001](cm0001/) | The ALCops configuration file could not be fully loaded | Warning | ✓ | | diff --git a/content/docs/analyzers/_index.md b/content/docs/analyzers/_index.md index cf3011f..139b843 100644 --- a/content/docs/analyzers/_index.md +++ b/content/docs/analyzers/_index.md @@ -12,4 +12,5 @@ no_list: true | [FormattingCop](FormattingCop) | Enforces consistent code formatting and visual structure. | | [LinterCop](LinterCop) | Flags code quality issues, measures complexity, and promotes modern AL patterns. | | [PlatformCop](PlatformCop) | Detects code that is technically broken, dangerous, or silently ignored at the AL platform level. | -| [TestAutomationCop](TestAutomationCop) | Validates the structure and correctness of AL test code. | \ No newline at end of file +| [TestAutomationCop](TestAutomationCop) | Validates the structure and correctness of AL test code. | +| [Common](Common) | Cross-cutting diagnostics from the shared ALCops.Common library, loaded with every cop. | \ No newline at end of file