Globalyzer 5 Java Rules: Difference between revisions

From Lingoport Wiki
Jump to navigation Jump to search
Line 23: Line 23:
This snippet of code does have strings.  
This snippet of code does have strings.  


The class company.project.Dbg is a debug class and the text method puts the String parameter into a database for support purposes. That string is not visible to the end user.  In that instance, the 'setText' method on a variable of type company.project.Dbg should be filtered.
The class <code>company.project.Dbg</code> is a debug class and the text method puts the String parameter into a database for support purposes. That string is not visible to the end user.  In that instance, the <code>setText</code> method on a variable of type <code>company.project.Dbg</code> should be filtered.


The variable lbl of class company.project.Label represents a text area in the User Unterface and the setText method passes a user visible string. The string "Menu" passed to this setText method should be flagged: It needs to be externalized out of the code into a resource bundle.
The variable lbl of class <code>company.project.Label</code> represents a text area in the User Interface and the <code>setText</code> method passes a user visible string. The string <code>Menu</code> passed to this <code>setText</code> method should be flagged: It needs to be externalized out of the code into a resource bundle.


== Rule ==
== Rule ==


== Result ==
== Result ==

Revision as of 19:24, 26 October 2015

Introduction

User Interface

Type of Rules

Example

Code Snippet

import company.project.Dbg;
import company.project.Label;
 [...]
 Dbg dbg = Dbg.getInstance();
 Label lbl = new Label();
 [...]
 dbg.setText("{0}: {1} action taken.");
 [...]
 label.setText("Menu");


This snippet of code does have strings.

The class company.project.Dbg is a debug class and the text method puts the String parameter into a database for support purposes. That string is not visible to the end user. In that instance, the setText method on a variable of type company.project.Dbg should be filtered.

The variable lbl of class company.project.Label represents a text area in the User Interface and the setText method passes a user visible string. The string Menu passed to this setText method should be flagged: It needs to be externalized out of the code into a resource bundle.

Rule

Result