In this section:

Introduction

Parasoft supports Android-based applications by integrating with Android Lint, a command line static analysis tool for Java, Kotlin, and XML code that ships with Google’s Android Development Kit. The tool reports potential problems, such as, possible bugs, suboptimal code, overcomplicated expressions, and unused code. Android Lint should not be confused with the popular lint analyzer for C. Visit the Android Lint website for additional information.

The Parasoft Android Lint extension processes the result file output from your open source static analysis tool, generates reports showing violations and severities for the code authors, and sends the data to Parasoft DTP. DTP presents the data in widgets, reports, and other interfaces that enable you to prioritize violations, place them into remediation workflows, and monitor progress toward improving the code quality. 

Requirements

  • Android Lint version 34 is currently supported.
  • Android Development Kit (ADK) from Google, including the tools subdirectory. You should be able successfully run a lint test from the command line. If are working with a Gradle project, you should be able to run gradlew from the command line. The complete SDK is not required. 
  • When running Android Lint, create the output as an XML file (i.e., --xml androidlint-results.xml).

Usage

  1. If you have not already done so, execute Android Lint and verify that the results are output to a file in Checkstyle format.
  2. Open a command prompt and navigate to the Multi-Language Pack installation directory.
  3. Execute the multilanguage-pack.bat or multilanguage-pack.sh script with the required parameters all on one line, e.g.:
multilanguage-pack.sh -tool AndroidLint -results.file "c:\YourProject\androidlint-results.xml" -source.dir "C:\YourProject\src"

Internal technical log files from the Multi-Language Pack execution are generated in the <INSTALL>/.mlp subdirectory.

Required Parameters

The following parameters are required.

tool

This setting specifies the Parasoft extension to execute. Use -tool AndroidLint to run the Android Lint extension.

results.file

This settings specifies the paths to one or more XML files containing Android Lint execution results. You can separate multiple files with a semicolon (;). You can also use the following wildcard characters to point to multiple XML files. If you use wildcards, the path must be in quotation marks. Additionally, the path cannot have spaces if you use wildcards and are running the extension on Linux or OSX.

  • * - matches zero or more characters
  • ** - matches zero or more directories
  • ? - matches a single character

   For example:

-results.file "c:\YourProject\ResultsFile.xml;c:\YourProject2\**\*.xml;c:\YourProject3\ResultsFile?.xml"

The following example matches all files with *.kt extensions in any subtree of the src directory:

"/src/**/*.kt"

source.dir

This parameter specifies the path to the source code of the project under test. This is used to collect source control metadata (e.g., authorship, last updated, etc.) for DTP reporting and processing.

  • No labels