Kiuwan’s great advantage is its possibility to analyze your code in your own infrastructure without having to upload your code to the cloud. For this, we can download Kiuwan Local Analyzer, which will allow you to run a local analyses (or as many as you want) from any machine and view the results on KIUWAN with all the functionality it provides. It also allows to integrate analyses and code quality and security measurement tasks with your continuous integration or deployment process.
All resulting data is securely uploaded to KIUWAN platform, where you can see the results on the dashboards, generate reports, see the metrics and defects lists. Just as if you had uploaded your code and run the analysis in the cloud.
For complex analyses, using Kiuwan Local Analyzer you have the possibility to set the memory to be used, determine an estimate of time (which, by default, is 1 hour) or configure the extensions for each desired technology.
First of all, it is important to review some basic requirements for the proper performance of the analyzer:
- Operating systems supported by Kiuwan Local Analyzer are: Windows, Linux, MacOS or any UNIX operating system that supports Java.
- Have permission on your computer to download the .zip file, unzip it and execute it.
- Internet connection is required for account validation, data synchronization between the platform and the agent, for automatic agent updates, downloading the quality model and uploading the results to KIUWAN.
- A 1.6 or higher Java version, JDK or JRE installed and properly configured.
Once verified the requirements, download the analyzer and run a local analysis on an application:
- Click New on the top right.
- On A Analyze locally: download analyzer option click on Download now.
- Once downloaded, we unzip it.
- Execute it with %KiuwanLocalAnalyzer%/kiuwan.cmd.
- If needed, verify proxy options (Proxy Configuration) and configure it.
- Sign in with your KIUWAN account credentials.
- Select the application to analyze or create a new one, which will be automatically done with the standard settings.
- Introduce the Label you deem.
- In Select folder(s) to analyze, indicate the directory where the sources to analyze are, which should not be compressed.
- Click on Continue.
- Before starting the analysis, you can check the amount of files and how many of them were found. You can also enable the technologies you want to be analyzed.
- Clic on Analyze to run the local analysis.
- When the analysis ends, if a problem occurs, you can check the log with all its information, that you can also find in the analyzer folder: %kiuwanlocalanalyzer%/temp, in agentGUI.log file.
- Once the analysis ends, click on View results button, which will take you directly to KIUWAN.
After running your first local static analysis and check how easy to use the analyzer is, let’s dive a little deeper into the existing settings.
First, we learn how to set the time and memory to be used in the analysis:
- Once the application is selected with the code to analyze, click on Configuration.
- Timeout is 1 hour by default, 3 600 000 milliseconds. If you need more time to analyze, modify this property extending it to, for example, 7 200 000 milliseconds and click Save. You need to configure the timeout when an analysis fails and a ‘timeout error’ is in the log file.
- The memory to use, Max memory size, is, by default, 1024m. If you need to use more, modify this property extending it to, for example, 2048m and click Save. You need to configure the Max memory when an analysis fails and a ‘OutOfMemoryError error’ is in the log file.
Now we see how to configure an extension. For this example, we have used Transact-SQL:
- Sometimes, we have unusual file extensions, considering the technology we have written them in. Let’s see how to analyze some code without its usual extension.
- We have three files: test1.sql, test2.sql and test3.txt (this last one has .txt extension, but we know it has Transact-SQL code).
- Note that when selecting the sources to analyze, Kiuwan Local Analyzer only recognizes those with .sql extension.
- To recognize the .txt file, click on Configuration, go to Extensions editor tab, select Transact-SQL and add .txt extension.
- Check that the extension does not appear in Extensions ignored.
- Then, Save.
- Then, you will see that Kiuwan Local Analyzer recognizes the three files, when selecting the technology.
Another option to analyze is from command line, CMD in Windows (agent.cmd) or some LINUX/UNIX console (agent.sh).
- Let’s see a CMD example:
- Access by console to %kiuwanlocalanalyzer%/bin/ folder.
If you choose not to upload your code, with Kiuwan Local Analyzer you can expand the confidentiality level of your source code, so it does not indicate fragments of code in the violations found, and it just shows the line where the violation is.
To better understand this option, let’s first see an example when the local analysis is run with its standard settings:
- On Defects screen, when we review the violations found in an analysis, it indicates the file name, the line of code and the fragments of code to be reviewed or repaired.
Now let’s see how it would result by changing the analyzer settings:
- On Defects screen, we see that it just shows us the file and the line where the violation were found. “Line of code not available (optional)”.
To perform this process, we follow these steps to configure the analyzer:
- Once selected the application and its code to analyze, click on Configuration.
- In Upload fragment of code for defects and duplications, you can select True (file, line and fragment) or False (file and line).
- Click on Save and run the local analysis..
On KIUWAN you can find all the documentation.
And last, but not least, here you have some video tutorials.