Globalyzer in IDE
Contents
Can I use Globalyzer Lite with my standard IDE?
The Globalyzer Lite client can be used with Eclipse, Visual Studio and IntelliJ IDEs.
Using Globalyzer Lite from an Integrated Development Environment
Globalyzer Lite may be used within many IDEs that support external tools, including Visual Studio, IntelliJ IDEA, and Eclipse. Configuring Lite as an external tool takes some initial setup, but is relatively easy to accomplish. Once configured, Lite may be used through the IDE's external tool menu with the click of a button. The recommended, documented tools:
- Scan the currently selected file/directory.
- Scan everything within the parent directory of the currently selected file/directory.
- Scan the entire project.
Demonstration videos are available for:
To configure Lite in the IDE, please see this page: Lite IDE Usage.
The developer can then use the power of the IDE to refactor the relevant issues or to mark false positives in the code using Globalyzer ignore comments, such as $NON-NLS-L$. For more information, see the Globalyzer Comment Tags in False Positives .
Those refactoring and the comment tags are now part of the code: The Continuous Globalization System using the same Lite project definition file will show the same results in the Dashboard.
How do I install Globalyzer Lite?
To install the Globalyzer Lite, you first need a Globalyzer account (see this FAQ). Once you have an account, you log into the Globalyzer Server and at the bottom of your home page there is a link to download Globalyzer Lite.
The Globalyzer Lite is a standalone Java application. It uses Rule Sets to scan code at the command line. It is used in Jenkins configured for the Continuous G11n System and can be integrated as an external tool in an IDE.
Please see installation for complete Globalyzer Lite download/installation instructions.
To install:
- Unzip the Globalyzer Lite zip file at a desired location
- Run either
lite-setup.bat
orlite-setup.sh
depending on your system.
To verify the installation, from a command line at the location that it was installed:
java -jar globalyzer-lite.jar -version
or, show the help info:
java -jar globalyzer-lite.jar -help
Sharing Project Definition Files Between IDEs and Build Systems
It is common to check in a single project definition file per code repository. However, the desired IDE configuration may sometimes be incompatible with the desired build system configuration.
These incompatibilities are best solved by modifying the project definition file within the build system. The IDE config can then be used as the default.
Here is an example: The desired report type for Globalyzer Lite may be ScanDetailedCSV for developer usage, but will need to be ScanDetailedXML within the build system. The project definition file would then be written out with the <report-type> set to ScanDetailedCSV:
<gzproject> ... <report-type>ScanDetailedCSV</report-type> ... </gzproject>
The build system can then be set to auto-replace "ScanDetailedCSV" with "ScanDetailedXML". The following Linux command will do so:
$ sed --in-place 's|ScanDetailedCSV|ScanDetailedXML|' $WORKSPACE/ProjectDefinition.xml
If desired, the opposite replacement also may be performed at the end of the build.
Finally, here is a bash function to replace the content of any XML field:
replace_xml_token() { token_name=$1 new_content=$2 sed -ri "s|(<${token_name}>).*(</${token_name}>)|\1${new_content}\2|g" $WORKSPACE/ProjectDefinition.xml }
It may be used like so:
$ replace_xml_token "report-type" "ScanDetailedXML"