Skip to content

fix(DC0007,DC0008,DC0004): document interfaces and control add-ins - #507

Open
MODUSCarstenScholling wants to merge 5 commits into
ALCops:mainfrom
MODUSCarstenScholling:dev-451-dc0007+dc0008-itf+addin
Open

fix(DC0007,DC0008,DC0004): document interfaces and control add-ins#507
MODUSCarstenScholling wants to merge 5 commits into
ALCops:mainfrom
MODUSCarstenScholling:dev-451-dc0007+dc0008-itf+addin

Conversation

@MODUSCarstenScholling

@MODUSCarstenScholling MODUSCarstenScholling commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #451

  • Restore DC0004 diagnostics for undocumented control add-in procedures.
  • Report undocumented control add-in event declarations as DC0009 with event-specific wording.
  • Remove the unavailable local/internal remediation from the public-procedure diagnostic.
  • Extend DC0007 and DC0008 object analysis to interfaces and control add-ins by analyzing IObjectTypeSymbol.
  • Preserve the test-codeunit exemption by applying it only to symbols that also implement IApplicationObjectTypeSymbol.
  • Report DC0007 for undocumented public interfaces and control add-ins, and DC0008 for undocumented internal interfaces.
  • Add regression coverage for documented and undocumented interface/control-add-in objects, plus parameterized control-add-in events.
  • Remove the vacuous internal-procedure control-add-in fixture.
  • Document the corrected control-add-in procedure/event diagnostic routing in the analyzer and documentation repositories.

- Fixes ALCops#451
- Analyze registered object symbols through IObjectTypeSymbol so IInterfaceTypeSymbol and IControlAddInTypeSymbol no longer exit before documentation is checked.
- Preserve the test-codeunit exemption by applying it only when the symbol also implements IApplicationObjectTypeSymbol.
- Report DC0007 for undocumented public interfaces and control add-ins, and DC0008 for undocumented internal interfaces.
- Add regression fixtures for the previously skipped object kinds and include them in the ObjectRequiresDocumentation test suite.
- Record the SDK interface hierarchy and the intentional ControlAddIn behavior in the DC0007/DC0008 maintainer guidance.
- Remove the resolved ObjectRequiresDocumentation known issue from the DC0004 procedure-documentation guidance.
@MODUSCarstenScholling MODUSCarstenScholling changed the title ## Title fix(DC0007,DC0008): document interfaces and control add-ins ## Title fix(DC0007,DC0008,DC0004): document interfaces and control add-ins Sep 3, 2026
@MODUSCarstenScholling MODUSCarstenScholling changed the title ## Title fix(DC0007,DC0008,DC0004): document interfaces and control add-ins fix(DC0007,DC0008,DC0004): document interfaces and control add-ins Sep 4, 2026
Resolves the DC0004 rule-doc conflict against the restructured .claude
rules and brings both DocumentationCop rule docs onto the new template:
DC0004 records the control add-in procedure and event decisions and
drops the resolved DC0007/DC0008 known issue; the new DC0007/DC0008 doc
gets the test-folder glob, deliberate non-reports, SDK facts and test
notes sections.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Arthurvdv

Copy link
Copy Markdown
Member

Review of #507 — document interfaces and control add-ins

Solid, well-scoped fix; the object-level IObjectTypeSymbol widening and the separate EventDeclaration action are the right shapes, and the fixtures/docs are updated. A few things worth addressing before merge:

1. DC0004 message is inaccurate for control add-in events (and procedures). AnalyzeControlAddInEvents reports PublicProcedureRequiresDocumentation, so an undocumented event ControlAddInReady() surfaces as:

Public procedure 'ControlAddInReady()' must include XML documentation comments (or be restricted to local or internal scope).

It is not a procedure, and control add-in members take no local/internal modifier, so the remediation is impossible. DC0009 (EventRequiresDocumentation, "Event '{0}' ...") is enabled by default and reads correctly for events. Worth reconsidering the ID for events, or at least a control-add-in-appropriate message. (The same "restricted to local or internal scope" tail is now emitted for control add-in procedures too.)

2. Missing NoDiagnostic regression for documented interfaces/control add-ins (object rule). ObjectRequiresDocumentation gained PublicHasDiagnostic/InternalHasDiagnostic fixtures only. There is no fixture proving a documented public/internal interface or control add-in is left alone, so a future false positive on these IObjectTypeSymbol-only kinds would go uncaught.

3. The parameterized-event path is untested. Every control add-in event fixture is parameterless, so GetEventDisplayText/GetTypeDisplayText — including the #if NETSTANDARD2_1 reflection branch — never execute under test. A HasDiagnostic fixture with event Foo(bar: Integer) would cover it.

4. InternalNoDiagnostic/ControlAddIn.al now passes vacuously. It still holds an undocumented procedure MyProcedure() and asserts no DC0006. With the exemption removed, that procedure now emits DC0004, not DC0006 — so the test stays green without validating anything meaningful. Consider updating or removing it to reflect the new behavior.

5. Minor: display-text duplication. GetEventDisplayText/GetTypeDisplayText re-implement what the method path already gets from GetDiagnosticDisplayText(MethodSymbolDisplayFormat.MethodSignature); the two formatters can drift over time.

Nothing here is a crash; items 1–2 are the ones I'd want resolved before merge.

- Fixes ALCops#451
- Report undocumented control add-in event declarations with DC0009 while retaining DC0004 for control add-in procedures.
- Remove the unavailable local/internal remediation from the DC0004 message and use public-event wording for DC0009.
- Add documented interface and control add-in object regressions plus a parameterized control add-in event fixture.
- Remove the vacuous DC0006 control add-in fixture and document the corrected diagnostic routing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: DC0007/DC0008 never fire for interface and controladdin objects

2 participants