feat: add FC0006 - Permission values should be lowercase#401
Merged
Arthurvdv merged 5 commits intoJul 14, 2026
Conversation
Flags uppercase permission values (RIMD) in the Permissions property of application objects (codeunit, table, page, report, requestpage, xmlport, query), where casing has no runtime meaning. Excludes permissionset and permissionsetextension objects and the InherentPermissions property, where casing distinguishes direct from indirect permissions. Includes a code fix that lowercases all permission values in the property. Refs discussion #383 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per feedback from rvanbekkum on discussion #383, the rule also applies to the execute permission. The uppercase check already covered any uppercase character; this adds the 'x' to the diagnostic message and test evidence for X values. On object-level Permissions, X values only occur in code carrying a compile error (AL0195 on tabledata entries; non-tabledata entries are dropped by parser error recovery and never reach the analyzer), so the new test cases use error-tolerant fixtures (ThrowsWhenInputDocumentContainsError = false), following the existing ApplicationCop.Test/TestHelper.cs pattern. A future SDK that legalizes non-tabledata entries is covered automatically by the generic uppercase check. Refs discussion #383 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n-values-should-be-lowercase # Conflicts: # .github/instructions/instruction-maintenance.instructions.md # src/ALCops.FormattingCop/DiagnosticIds.cs
Older SDKs reject the permission set extension fixture with AL0334 (extension target already declared in this module). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ension fixture Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a new FormattingCop rule FC0006
PermissionValuesShouldBeLowercasefrom discussion #383.The
Permissionsproperty on application objects accepts permission values in any casing, but casing has no runtime meaning there. UppercaseRIMDfalsely suggests direct permission grants, a semantic that only exists inpermissionset/permissionsetextensionobjects and theInherentPermissionsproperty. FC0006 flags uppercase values and ships a code fix that lowercases them.Scope decisions
Covered objects: codeunit, table, page, report, requestpage, xmlport, query (all objects supporting the
Permissionsproperty).Excluded:
permissionset/permissionsetextensionobjects and theInherentPermissionsproperty — casing is semantic there (direct vs. indirect).Granularity: one diagnostic per
Permissionsproperty (matches FC0004).Severity: Info, Category Style (matches FC0004).
Scope was posted for feedback on the discussion: scope comment.
Execute permission (
X) is covered: the uppercase check applies to every permission value, includingX, per rvanbekkum's feedback on the discussion.Notable finding
The AL compiler only accepts
tabledataentries in the object-levelPermissionsproperty; non-tabledata entries (codeunit X = X) fail withAL0104: Syntax error, 'tabledata' expected, despite Microsoft Learn examples suggesting otherwise. Parser evidence:ObjectParserparses object-level permission lists with aTableDataKeyword-only predicate.Consequence for
Xcoverage: in FC0006's scope,Xonly occurs in code carrying a compile error (AL0195on tabledata entries; non-tabledata entries are dropped by parser error recovery and never reach the analyzer). The rule still flags and fixestabledata Foo = X, and the generic uppercase check automatically covers non-tabledata entries should a future compiler legalize them. TheXtest cases use error-tolerant fixtures (ThrowsWhenInputDocumentContainsError = false), following the existingApplicationCop.Test/TestHelper.cspattern.Changes
PermissionValuesShouldBeLowercase(syntax-node action onPermissionPropertyValue, skips obsolete objects and permissionset ancestors)PermissionValuesShouldBeLowercaseCodeFixProvider(lowercases all permission tokens, BatchFixer)EnumProvider: addedSyntaxKind.PermissionPropertyValueTesting
dotnet build ALCops.sln: cleandotnet test ALCops.sln: all pass (FormattingCop.Test: 101, incl. 21 new FC0006 tests)Documentation page for alcops.dev prepared separately.
Closes #383