Difference between revisions of "Lite IDE Ignore"

From Lingoport Wiki
Jump to: navigation, search
(Lite is set in Eclipse)
(Refactor the Code or Ignore the Issue)
Line 21: Line 21:
 
= Refactor the Code or Ignore the Issue=
 
= Refactor the Code or Ignore the Issue=
 
Depending on what the developer sees, the issue either needs to be refactored or ignored. If the issue needs to be ignored, the //$NON-NLS-L$ comment needs to be added at the end of that line. One can simply add it by typing it. Some short cut exist and some can be created. For instance:
 
Depending on what the developer sees, the issue either needs to be refactored or ignored. If the issue needs to be ignored, the //$NON-NLS-L$ comment needs to be added at the end of that line. One can simply add it by typing it. Some short cut exist and some can be created. For instance:
  +
  +
* Go to the end of the line to ignore and type <Ctr><Space>
  +
* Choose "nls - non externalize string marker" in the list of templates.
  +
  +
or
  +
 
* Add the string "nls" and type <Ctr><Space>
 
* Add the string "nls" and type <Ctr><Space>
 
* Eclipse proposes the standard $NLS notation by default. Select that notation and type L.
 
* Eclipse proposes the standard $NLS notation by default. Select that notation and type L.

Revision as of 16:19, 14 March 2018

When using Lite in an IDE (see https://www.globalyzer.com/gzserver/help/referenceLite/globalyzer-lite-IDE-usage.html ), you can use the power of the IDE to mark some issues in the code as to be ignored. Globalyzer uses a set of standard comments, namely $NON-NLS-L$. There are many ways to do so. We will illustrate one such way with Lite in Eclipse.

Lite is set in Eclipse

To set Lite in your Eclipse environment, refer to https://www.globalyzer.com/gzserver/help/referenceLite/globalyzer-lite-IDE-usage.html#Eclipse ; There are two sections, one for Linux, one for Windows.


LiteConfigured.gif

Run Lite

  • Select the directory or file you want to analyze
  • Click on the external tools button

=> Lite analyzes the relevant files based on the Globalyzer Project Definition file and shows the clickable results in the Console view.

LiteRun.gif

Navigate to the Issue

  • Click on the issue in the Console

=> It opens the file and highlights the line with the issue.

Refactor the Code or Ignore the Issue

Depending on what the developer sees, the issue either needs to be refactored or ignored. If the issue needs to be ignored, the //$NON-NLS-L$ comment needs to be added at the end of that line. One can simply add it by typing it. Some short cut exist and some can be created. For instance:

  • Go to the end of the line to ignore and type <Ctr><Space>
  • Choose "nls - non externalize string marker" in the list of templates.

or

  • Add the string "nls" and type <Ctr><Space>
  • Eclipse proposes the standard $NLS notation by default. Select that notation and type L.

LiteNlsCtrSpace.gif

The line now reads:

   	Locale locale = new Locale("en", "US"); //$NON-NLS-L$
  • Repeat the process for other false positives

Lines tagged with the //$NON-NLS-L$ will be ignored by Globalyzer the next time you run the Lite external tool.

Advanced Template

The previous illustration was done using the default template. You can modify the template to have directly //$NON-NLS-L$ on other key combination or the same nls<Ctr><Space>.

The following image shows how to use nll<Ctr><Space> to insert directory //$NON-NLS-L$. NllTemplate.gif

This is one way of adding //$NON-NLS-L$ at the end of the line. Some developers will decide on other methods.