StefanMaron / BusinessCentral.LinterCop

Community driven code linter for AL (MS Dynamics 365 Business Central)
https://stefanmaron.com
MIT License
74 stars 31 forks source link

LC0035 - Table Extension Fields #669

Closed ans-bar-bm closed 2 months ago

ans-bar-bm commented 3 months ago

Currently the rule only reports fields for which a page or pageextension does directly exist in the context. Say i have an empty app and add 2 fields as a tableeextension to the Customer table. So far no LC0035 will be shown. If I then add the first field to any page related to the Customer table via a pageextension, then i will get the LC0035 for the second field.

Since users would be able to customize the fields without the pageextension when just the tableextension exists, I would expect the diagnostic to show for tableextension fields even without a pageextension in the context.

To avoid excess diagnostics for page-less tables like posting buffers and similar, the diagnostic might only be raised when either the LookupPageId or DrillDownPageId on the base table is set.

I'm not sure if this is the wanted behaviour in all cases, or if some special ones exist. But i feel like in general it would make the rule more consistent.

Arthurvdv commented 3 months ago

Thank you for raising this and providing a PR for this.

I believe you're right that the rule also be raised as you've described and this will indeed make the rule more consistent.

I'll included in the pre-release version of the LinterCop so we can review this change.