web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

How to Ignore the Warnings or Add any Errors in Business Central in VS Code

Syed Mehdi Profile Picture Syed Mehdi 5

Sometimes, we get some unwanted warnings while working on an AL Project which does not require any changes in the code. So, just to ignore certain warning ID’s, we can create a Ruleset to handle such warnings. Similarly, we can also create Errors which we can add in our Ruleset.

How to Enable Code Analysis?

  • Create a settings.json file in your project as shown below.
  • Add the code “al.enableCodeAnalysers” : true in the settings.json file to enable the Code Analyser as below.
  • Now, add the al.rulesetpath and mention the json file name that needed to be created to Ignore the warnings or add Errors or Warnings.

Now, let’s go ahead and create the Rules in the ruleset.json file which we have mentioned in the settings.json.

Let’s take few examples where we will try to ignore warnings which we don’t require and let’s handle it by adding it to the ruleset.json file as shown below.

We have created a rule for the Warning ID AA0074, where we have assigned it the Action as Hidden which will remove all the warnings having that ID from the Project. This warning checks the Prefix and Postfix in the Text Constant names which we don’t need to change.

Similarly, Warning ID AA0470 required the developer to provide an explanation of all the Text Labels in the Project. We have added in the Ruleset as we don’t want to see that warning.

So, in the same way we can add as many warnings in the ruleset which we want to ignore in the project.

I hope you got something useful from this blog. Please write in the comments below any topic or suggestion for my next blog.

Thanks for Reading!


This was originally posted here.

Comments

*This post is locked for comments