Globalyzer Lite Project Definition File Examples

Overview

To use Globalyzer Lite in an IDE (Integrated Development Environment) such as Visual Studio, Eclipse or IntelliJ IDEA, an external tool must be created. The tool will scan the items selected. If the project is selected, the entire project will be scanned. If a subdirectory is selected, all the directories and files under that folder will be scanned. If a file is selected, only that file will be scanned. If an open file is currently active, this file will be scanned.

This scan will execute the contents of your Project Definition File. You may decide what a scan involves by creating a project definition file. The project definition file allows you to login to the Globalyzer server and use defined rule sets for scanning.

Note that both the project-path and scan-items given in the project definition file will be overridden by the specified options. No modifications will be made to the project definition file itself.

Before setting up the IDE, the project definition file must be set up correctly. Globalyzer Lite can be run with different configurations.

Here are some examples of the various types of Project Definition Files for the different types of Globalyzer Lite configurations.


Setup the Project Definition File

Locally

To run locally, you have to have a Globalyzer.license file and the compressed files for the local rulesets.

  • Globalyzer.license is available from the same download site as Globalyzer Lite. Put the Globalyzer.license file in the C:\Lingoport directory on Windows or /Applications/Lingoport/ on Mac or $HOME/lingoport/ on Linux.
  • In the top level of the source code that is being analyzed, create a lingoport directory.
  • Place the rulesets and the Project Definition File in the lingoport folder. The rulesets are .zip files of the form <ruleset name>_<ruleset owner>.zip. For example, JavaScript_i18n.trial.com.zip is the JavaScript ruleset name for the user i18n@trial.com. Do not change the name.
The Project Definition File should look like:

<!-- see  http://wiki.lingoport.com/index.php5?title=Globalyzer_Lite#The_.globalyzerrc_File -->
<gzproject>
  <login>
    <username></username>
    <password></password>
    <server></server>
    <use-local-rulesets>true</use-local-rulesets>
    <optional>
      <proxy-user></proxy-user>
      <proxy-password></proxy-password>
      <proxy-host></proxy-host>
      <proxy-port></proxy-port>
    </optional>
  </login>
  <project-path>C:/Users/Trial/projects/trial</project-path>
  <project-name>Lingoport.trial</project-name>
  <report-path>globalyzer-lite-reports</report-path>
  <report-type>ScanDetailedXML</report-type>
  <report-priorities>C,1,2,3,4,5</report-priorities>
  <data-dictionary-location>C:/Users/Trial/.globalyzer-6.1.1_11</data-dictionary-location>
  <filter-with-dictionary>true</filter-with-dictionary>
  <scan-timeout>120</scan-timeout>
  <generate-partial-results>false</generate-partial-results>
  <scans>
    <scan>
      <scan-name>Java Scan</scan-name>
      <ruleset-name>Java Rule Set</ruleset-name>
      <ruleset-owner>i18n@trial.com</ruleset-owner>
      <encoding>systemDefault</encoding>
      <checks>
        <embedded-strings>true</embedded-strings>
        <locale-sensitive-methods>true</locale-sensitive-methods>
        <general-patterns>true</general-patterns>
        <static-file-references>true</static-file-references>
      </checks>
      <comments>
        <todo>GLOBALYZER_TODO</todo>
        <ignore-next-line>GLOBALYZER_IGNORE_NEXT_LINE</ignore-next-line>
        <start-ignore>GLOBALYZER_START_IGNORE</start-ignore>
        <end-ignore>GLOBALYZER_END_IGNORE</end-ignore>
      </comments>
      <scan-items>
        <item></item>
      </scan-items>
    </scan>
     <scan>
      <scan-name>JavaScript</scan-name>
      <ruleset-name>JavaScript</ruleset-name>
      <ruleset-owner>i18n@trial.com</ruleset-owner>
      <encoding>systemDefault</encoding>
      <checks>
        <embedded-strings>true</embedded-strings>
        <locale-sensitive-methods>true</locale-sensitive-methods>
        <general-patterns>true</general-patterns>
        <static-file-references>true</static-file-references>
      </checks>
      <comments>
        <todo>GLOBALYZER_TODO</todo>
        <ignore-next-line>GLOBALYZER_IGNORE_NEXT_LINE</ignore-next-line>
        <start-ignore>GLOBALYZER_START_IGNORE</start-ignore>
        <end-ignore>GLOBALYZER_END_IGNORE</end-ignore>
      </comments>
      <scan-items>
        <item></item>
      </scan-items>
    </scan>
  </scans>
</gzproject>							

There are some things to note in the Project Definition file.

  • <login> section. The username, password and server are not used locally, so they don't need to be set. If they are set and there is a problem with the local rulesets, Globalyzer Lite will attempt to log into a server.
  • <use-local-rulesets>true</use-local-rulesets> This instructs Globalyzer-Lite to look for the local rule sets.
  • </scan> section. The local rulesets need to be in the lingoport folder in the source code. They are named <ruleset name>_<ruleset owner>.zip such as JavaScript_i18n.trial.com.zip
    • <scan-name> This can be anything, but make it as descriptive as possible. It is often the same as the ruleset-name.
    • <ruleset-name> The ruleset name needs to match the name of the local ruleset. Otherwise, the scan will fail.
    • <ruleset-owner> The ruleset owner also needs to match the name of the local ruleset. Leaving this blank or putting in the wrong information will cause the scan to fail.

Remotely - with server information in the Project Definition File

If the rulesets are not local, but are on a server, the Project Definition file can be set up to login to the server.
  • In the top level of the source code that is being analyzed, create a lingoport directory.
  • Place the Project Definition File in the lingoport folder.
								
<?xml version="1.0" encoding="utf-8" ?>
<!-- see  http://wiki.lingoport.com/index.php5?title=Globalyzer_Lite#The_.globalyzerrc_File -->
<gzproject>
  <login>
    <username>bob@acme.com</username>
    <password>abc123</password>
    <server>https://www.globalyzer.com/gzserver </server>
    <use-local-rulesets>false</use-local-rulesets>
    <optional>
      <proxy-user></proxy-user>
      <proxy-password></proxy-password>
      <proxy-host></proxy-host>
      <proxy-port></proxy-port>
    </optional>
  </login>
  <project-path>C:/Users/Trial/projects/trial</project-path>
  <project-name>Lingoport.trial</project-name>
  <report-path>globalyzer-lite-reports</report-path>
  <report-type>ScanDetailedXML</report-type>
  <report-priorities>C,1,2,3,4,5</report-priorities>
  <data-dictionary-location>C:/Users/Trial/.globalyzer-6.1.1_11</data-dictionary-location>
  <filter-with-dictionary>true</filter-with-dictionary>
  <scan-timeout>120</scan-timeout>
  <generate-partial-results>false</generate-partial-results>
  <scans>
    <scan>
      <scan-name>Csharp</scan-name>
      <ruleset-name>csharp</ruleset-name>
      <ruleset-owner>bob@acme.com</ruleset-owner>
      <encoding>systemDefault</encoding>
      <checks>
        <embedded-strings>true</embedded-strings>
        <locale-sensitive-methods>true</locale-sensitive-methods>
        <general-patterns>true</general-patterns>
        <static-file-references>true</static-file-references>
      </checks>
      <comments>
        <todo>GLOBALYZER_TODO</todo>
        <ignore-next-line>GLOBALYZER_IGNORE_NEXT_LINE</ignore-next-line>
        <start-ignore>GLOBALYZER_START_IGNORE</start-ignore>
        <end-ignore>GLOBALYZER_END_IGNORE</end-ignore>
      </comments>
      <scan-items>
        <item></item>
      </scan-items>
    </scan>
     <scan>
      <scan-name>cplusplus</scan-name>
      <ruleset-name>cpp_wingen</ruleset-name>
      <ruleset-owner>bob@acme.com</ruleset-owner>
      <encoding>systemDefault</encoding>
      <checks>
        <embedded-strings>true</embedded-strings>
        <locale-sensitive-methods>true</locale-sensitive-methods>
        <general-patterns>true</general-patterns>
        <static-file-references>true</static-file-references>
      </checks>
      <comments>
        <todo>GLOBALYZER_TODO</todo>
        <ignore-next-line>GLOBALYZER_IGNORE_NEXT_LINE</ignore-next-line>
        <start-ignore>GLOBALYZER_START_IGNORE</start-ignore>
        <end-ignore>GLOBALYZER_END_IGNORE</end-ignore>
      </comments>
      <scan-items>
        <item></item>
      </scan-items>
    </scan>
  </scans>
</gzproject>			

  • <login> section. The username, password and server need to be filled in so that Globalyzer can log into the server.
  • <use-local-rulesets>false</use-local-rulesets>. This tells Globalyzer to look on the server for the rulesets.
  • <ruleset-name> and <ruleset-owner>. These need to be rulesets on the server and the user needs to have permission to use them if the owner is different from the Globalyzer Lite user.

Remotely - with the server information in the .globalyzerrc file

The Project Definition File does not have to have the server login information in it. The server login information can be in the <HOME>\.globalyzerrc file. The .globalyzerrc file looks like:

username bob@acme.com
password abc123
server  https://www.globalyzer.com/server

  • Put the .globalyzerrc file in the users home directory.
  • In the top level of the source code that is being analyzed, create a lingoport directory.
  • Place the Project Definition File in the lingoport folder.

And the Project Definition File, <login> stanza looks like:

<login>
   <username></username>
   <password></password>
   <server></server>
   <use-local-rulesets>false</use-local-ruleset>

If the server is specified in the Project Definition File, it must be the same as the .globalyzerrc file, otherwise the scan will fail.

One more thing

If using local rulesets, the <login> information can be filled out in the Project Definition File (or the .globalyzerrc file can exist). If Globalyzer Lite does not find the local ruleset, it will then try to login to the server and use the ruleset there.