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
722 stars 242 forks source link

AA0072 - drives me mad, I can't find much info on the rule itself #7666

Closed simplyTrex closed 5 months ago

simplyTrex commented 5 months ago

var RecSibExtSetupTableRecord: Record Sib.BusinessCentralsAddons.SibExtSetupTable;

Where I can find a practical documentation that explain this rule? How should I rename this variable, to be able to get rid of the CodeCop AA0027?

I deeply apologize for posting this here. No idea where to go for answers and documentation plainly states some general things.

"The name of RecSibExtSetupTableRecord is not valid. The name of variables and parameters must be suffixed with the type or object name."

It makes no sense and trying to understand.

dannoe commented 5 months ago

Try SibExtSetupTable. If this doesn't work, maybe this is a bug with Namespaces?

PS: In our projects we disable AA0027. (see also this yammer thread: https://www.yammer.com/dynamicsnavdev/#/Threads/show?threadId=1602560331243520)

simplyTrex commented 5 months ago

Thank you but nope, the song remains the same:

The name of SibExtSetupTable is not valid. The name of variables and parameters must be suffixed with the type or object name.

It just drives me nuts. I did not wanted to disable it, I wanted to learn to format and name variable names as it is recommended, but in Microsoft Docs, it is just a vague description without any examples.

simplyTrex commented 5 months ago

Not sure what I should try doing about namespaces. I am inside the respective namespace, so I removed the namespace identifier in front of the table name with no avail. Same AL0072.

dannoe commented 5 months ago

Can not reproduce this with the newest AL vsix. (Version: 12.6.936426). Could be caching problem. Can you try to reload or restart your vscode. (Ctrl+Shift+P -> Reload window)

simplyTrex commented 5 months ago

Thanks @dannoe.

Reloaded Window.

The name of SibExtSetupTable is not valid. The name of variables and parameters must be suffixed with the type or object name.

Switched to pre-release. Reload window. same issue. Switch to release version. Reload window. Same issue.

dannoe commented 5 months ago

Can you maybe share a minimal project with this error?

grafik

simplyTrex commented 5 months ago

I will try yes. But I see you have it too above, isn't it?

dannoe commented 5 months ago

The warning appears just on the Foo variable, which is correct. With the SibExtSetupTable variable I have no warning in my vscode.

simplyTrex commented 5 months ago

image

How do you preffer me to share the project, I am new to this? It has two AL files.

dannoe commented 5 months ago

Zip it up and just drag and drop it into your input box here. (Do not include the .alpackage folder in the zip else you will exceed the upload limit on Github.)

PS: In your screenshot the variable name should be SiboneyExtSetupTable.

simplyTrex commented 5 months ago

Do I get any credentials to take out?

simplyTrex commented 5 months ago

Daymn, if I named it SiboneyExtSetupTable, it went away, I am totally confused now!

simplyTrex commented 5 months ago

I did the same in the original project and it all went away. No more AL0072!

dannoe commented 5 months ago

Awesome. If it is resolved you can close this issue with the "Close issue" button under the input box.

simplyTrex commented 5 months ago

Oh wow. thank you. I need to read again from the beginning to check what really happened here. Thank you @dannoe . Muțumesc!

simplyTrex commented 5 months ago

This is closed, as it got resolved, thanks to above replies from @dannoe

mjmatthiesen commented 5 months ago

Highly recommend disabling this silly rule. AA0027 is asinine.

simplyTrex commented 5 months ago

I only activated it to try to learn what would be best practice recommended for naming variables and objects. Basically to be more catholic than the pope himself.