Checking your ServiceNow code with Visual Studio Code

Once installed and configured, your Live Check Quality extension lets you check and improve your code with best practices from our rulesets. 

You can only check the code if you have the ServiceNow® Extension for VS Code installed and connected to an instance. Live Check Quality for ServiceNow lets you check the code of your scratch files. You then need to make suggested changes on the corresponding instance files. 

Checking for issues

Every time you wish, you can run a check on an XML file.

→ To check your code

  1. Right-click on a file you want to check and select Now: Show XML. This created a scratch file in your workspace.
  2. Press Ctrl + Shift + P. This opens up a command prompt. 
  3. Type in ServiceNow Quality Live check, and click on it. This runs a check against all our rules. 
  4. Check the issues detected in the Problems section in the editor. 

    For easy access to the Problems section, always show it in the editor. Go to View >  Appearance, and select the Show Panel.

Working on issues

The Problem section with issues is displayed in the scratch file context. Make sure to fix the issues in your instance files. 

For all the issues found in the check you can consult the following:

  • If you have a Quality Gates set up, issue indicator - New or Baseline, see below in Working with issues from Quality Gates
  • Issue type
  • Issue severity
  • Line and character number 
  • Link to best practice

→ To work on issues

  1. For each of the issue from the Problems section,  check issue severity and open up the best practice link included in the description.
  2. Open the corresponding instance file and fix the issue.
  3. Once you have finished fixing the issue, you can save the file or check again that it does not come up by running the check.

Working with issues from Quality Gates

Error rendering macro 'excerpt-include'

User 'null' does not have permission to view the page.

See more about how to set up OLD Quality Gates.

Once you have set up a Quality Gate on your org, you'll see that the issues reported on a file are divided into two categories: 

  • New - all the new issues added after you have baselined your platform. These issues should be fixed before you commit the file. 
  • Baseline - all the existing issues you have decided to accept as your existing technical debt.

If there are any new issues detected, the Quality Gates is alerting you and your developers that these should be fixed first by displaying the following message: 

Quality Gate does not allow code with any new issues. Make sure you solve these first. 





Last modified on Feb 16, 2021