With the release of version 1.31.0, Designite revealed a more powerful console application. The new console application not only supports previously supported functionality (analyze projects and export results in CSV formats) but also allows a user to carry out trend analysis with a rich set of options. Specifically, the new console application offers the following capabilities:
- Analyze C# solution/projects and export the analysis results (architecture, design and implementation smells along with class and method metrics) in CSV format.
- Carry out a trend analysis by analyzing different versions of C# solutions and export the results.
- Carry out a trend analysis of a Git repository
- Exempt certain projects from the analysis for more relevant results
Let us explore these features in more detail.
Analyze C# solutions/projects
The console application provides the usage instruction when you execute it without any parameters.
To analyze a C# solution and to export the analysis results in the CSV format, you can use the following command:
DesigniteConsole.exe "c:\Workspace\xunit\xunit.vs2015.sln" "C:\temp\"
When you analyze a C# solution, the application tries to analyze all the C# projects that are part of the solution. What if you wish to analyze only a few specific projects? It’s fairly easy with the tool. Create a batch file containing the path of C# projects that you would like to analyze (one project in one line). An example of such a batch file is given below:
[Projects] c:\Workspace\NUnit-3.0.1-src\src\NUnitConsole\nunit3-console\nunit3-console.csproj c:\Workspace\NUnit-3.0.1-src\src\NUnitEngine\Addins\vs-project-loader\vs-project-loader.csproj c:\Workspace\NUnit-3.0.1-src\src\NUnitFramework\mock-assembly\mock-nunit-assembly-4.5.csproj
It is important to mention “[Projects]” tag to help the application identify the specific projects to
The following command can be used to analyze the above batch file.
DesigniteConsole.exe "C:\Workspace\NUnit-3.0.1-src\DesigniteTest.batch" "C:\temp\"
The new version of the console application also supports trend analysis. Create a batch file containing version and solution file path in a line separated by a semi-colon. An example of such a batch file is given below.
[Solutions for trend analysis] 2.6.3;C:\Workspace\nunit\NUnit-2.6.3\nunit.sln 3.0.0;C:\Workspace\nunit\NUnit-3.0.0-src\nunit.sln
Obviously, it is important to mention “[Solutions for trend analysis]” before specifying version and path
of a solution file.
Specify the following command to initiate the trend analysis:
DesigniteConsole.exe "C:\Workspace\nunit\test_trend.batch" -trend "C:\temp\"
The second parameter “-trend” states that you are interested in trend analysis and the third parameter is the path of the folder where the result of the analysis will be produced in CSV format.
It is often required to exclude a few certain projects from the trend analysis. You can specify project names (case sensitive) under “[Exempt projects]” tag to achieve the same. A project name containing one of the strings specified under the exempt projects tag is excluded from the analysis. For instance, we can exclude all the projects containing “test” in their names by specifying it under the exempt projects tag as follows.
[Solutions for trend analysis] 2.6.3;C:\Workspace\nunit\NUnit-2.6.3\nunit.sln 3.0.0;C:\Workspace\nunit\NUnit-3.0.0-src\nunit.sln [Exempt projects] test
Trend analysis for Git repositories
The Designite console application can analyze a Git repository and produce trend analysis results. You need to provide a few details in a batch file such as the path of the Git repository and path of the temporary folder. Here is a sample batch file that can be used to carry out a trend analysis for a Git repository.
[Git repo path] C:\Workspace\xunit [Git bash path] C:\Program Files\Git\git-bash.exe [Temp folder path] C:\Dev\Designite\temp [Versions] 399ea8c 3fdea50 6f6776a
You need to specify the path of the Git repository under the “[Git repo path]” tag. You also need to
provide a path of the Git bash console and temporary folder. The Designite console application uses Git bash to work
on a specific version of the code; therefore, you need to provide the path of the Git bash console. The application
also makes copies of the Git repository and thus requires a temporary folder to work with. Further, you need to
specify commit hash for the versions that you would like to analyze.
The following command will produce the trend analysis report.
DesigniteConsole.exe "C:\Workspace\nunit\test_trend_git.batch" -trend "C:\temp\"
There is another interesting feature that Designite console application supports. If you want to analyze N number of versions distributed across all the committed versions in a Git repository, you can do it easily with the application. Specify the number of versions with “[Auto choose versions]” tag in a batch file and leave the rest to the console application. Here is an example of such a batch file.
[Git repo path] C:\Workspace\xunit [Git bash path] C:\Program Files\Git\git-bash.exe [Temp folder path] C:\Dev\Designite\temp [Auto choose versions] 5
Here, the application will choose 5 different versions from the specified repository distributed almost uniformly since the first commit in the repository. This feature is particularly useful when you wish to analyze a large number of repositories automatically.