Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 5.48 KB

File metadata and controls

61 lines (41 loc) · 5.48 KB

ALCops Analyzers

NuGet NuGet Downloads Build License

A collection of custom code analyzers for the AL programming language of Microsoft Dynamics 365 Business Central. ALCops ships multiple specialized cops covering everything from platform correctness and application modeling to documentation, formatting, linting, and test structure.

Full documentation: http://www.alcops.dev.

Analyzers

Cop Description
ApplicationCop Validates rules that enforce correct modeling and behavior of Business Central objects, ensuring domain-consistent tables, pages, permissions, and metadata. Focuses on application correctness rather than AL language semantics.
DocumentationCop Enforces documentation quality in code, such as procedure comments and developer-facing descriptions. Ensures clarity of intent without affecting runtime behavior.
FormattingCop Covers stylistic and syntactic consistency rules. Ensures clean, uniform, readable code without influencing behavior or semantics.
LinterCop Identifies non-breaking code smells and suggests better implementation patterns. Focuses on maintainability, clarity, and recommended practices where multiple valid options exist.
PlatformCop Validates AL language and runtime semantic correctness, preventing patterns that always fail or behave unpredictably. These rules apply universally, independent of the Business Central domain model.
TestAutomationCop Ensures correctness and structure of test codeunits and related test procedures. Applies exclusively to test logic, not production code.
Common Cross-cutting diagnostics from the shared ALCops.Common library, loaded with every cop — for example a warning when your alcops.json cannot be loaded.

Browse the complete rules reference at alcops.dev/docs/analyzers.

Configuration

Analyzer-specific settings are configured in alcops.json. A project can inherit a centrally maintained base configuration from one anonymously accessible HTTP(S) URL or absolute local file path and override only the values it needs:

{
  "Extends": {
    "Source": "https://example.com/company.alcops.json"
  },
  "SubscriberNamingPattern": "{Event Source}_{Event Name}[_{Element Name}]"
}

Local scalar values and arrays replace inherited values. Nested objects are merged property by property. Inheritance chains are deliberately not supported. See the configuration guide for all settings and precedence rules.

HTTP(S) sources must be anonymously accessible. URLs containing embedded credentials such as https://user:pass@example.com/alcops.json are rejected before network access, and their username/password are omitted from diagnostics. Committing alcops.json means trusting its referenced configuration source.

HTTP responses are limited to 1 MiB (1,048,576 bytes), with a five-second timeout. If a declared Extends source cannot be resolved, ALCops uses the built-in defaults for the entire configuration, discards local overrides, and reports CM0001.

Failed HTTP requests are cached per workspace for 30 seconds after the failure. Compilations during that cooldown reuse defaults and CM0001 without another request; the first new compilation requesting settings after it expires retries. Each compilation keeps its original snapshot, and successful loads remain cached for the analyzer session. The first analysis using an uncached HTTP source, or retrying after the cooldown, can wait for the request; cancelling that analysis also cancels the request without starting a new cooldown. Empty, comment-only or JSON-null local configuration uses defaults without a warning; an inherited configuration must contain a JSON object.

Contributing

Contributions are welcome! Whether it's a new rule idea, a bug report, or a pull request — all input helps improve ALCops for the community.

  • 💡 Suggest a rule » Open a GitHub Discussion
  • 🐛 Report a bug » File an Issue
  • 🔧 Submit a PR » Fork the repo, create a branch, and open a pull request

Thank you

ALCops is a continuation of BusinessCentral.LinterCop and this project wouldn't exist without the foundation built by that community. A heartfelt thank you to every contributor who invested their time, ideas, and code into the original LinterCop. Your work didn't end there, it lives on and grows further here in ALCops.

License

This project is licensed under the MIT License.