microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

Warn on duplicate Captions #6423

Closed dzzzb closed 2 years ago

dzzzb commented 3 years ago

Describe the bug Duplicate captions on table fields can arise from developers copying and pasting fields and forgetting to update the Caption to match the new field name, and this leads to confusion and possibly horror when users see two fields with the same caption and don't know which to update.

To Reproduce image

Expected behavior It's difficult to imagine cases where duplicate captions are legitimate, at least on tables. Maybe on pages there can be legit cases for this, but I dunno.. It's up to you whether to extend this to pages too. Here I'm concerned about tables as that's where most captions are.

Therefore, if more than one fields on a table have the same Caption, I would think that should be a warning. Please consider adding such a diagnostic to the compiler/analysis.

5. Versions:

fvet commented 3 years ago

Be carefull when you have a table with x obsoleted fields...

atoader commented 3 years ago

As fvet mentioned, there are cases where this might be applicable. I think it is a potential enhancement for CodeCop. I will label it for now. We are working on a process that will provide more visibility into where these issues should be filed and when they could be addressed.

dzzzb commented 3 years ago

Be carefull when you have a table with x obsoleted fields...

I guess you mean, in case we have Some Field but then have to redo it as Some Field NEW or suchlike, with e.g. a different data type (table relation, etc.), but the same caption?

If so, then yeah, it seems that obsoleted fields should not be counted to judge duplicates.

mazhelez commented 2 years ago

Thanks for reporting this issue. Sorry we haven’t completed it yet, but we’ve had to prioritize elsewhere. We’re planning to give the CodeCop engine and its rules an overhaul in a future major release. Thanks for your patience.