1.2. Basic Analysis

The following steps describe the first analysis of a code base based on the existing dependencies, detected cyclic dependencies, detected duplicate blocks and further metrics:

  1. Select packages in the Navigation View and open them via the context menu in the Graph view and Exploration view to see/examine their existing dependencies. Experiment with the different options for creating the representations. Experiment also with the options provided on the opened views to focus on different dependency types, etc.

  2. Examine the detected issues on the Issues view.

  3. Customize the duplicate code analyzer via the menu "System" -> "Configure..." -> "Duplicate Code" and specify a smaller minimum block length (e.g. 20 lines), so that duplicates are detected. Use the Duplicate Blocks view to open a side-by-side diff for closer inspection.

  4. Check the detected package cycles in the Cycle Groups view, open one of them in the Cycle view for closer inspection.

  5. Right-click anywhere on the white area in the Cycle view to show the cyclic elements in the Exploration view for further investigation.

  6. Right-click anywhere on the white area in the Cycle view to open the Cycle Breakup view. Compute a break-up set for the cycle.

  7. Right-click on the proposed dependency to remove and create a new "Delete Refactoring" via the context menu. The created task is now visible in the Tasks and Refactorings views.

  8. Create a resolution for another issue in the Issues view. Check the filter options of the view in the top right corner to show only issues of a certain category.

  9. Switch the Virtual Model on the application's tool bar (top right of the application) and select the "Parser" model in the combo box. Since the resolutions are specific to the Virtual Model, the issues re-appear in the Issues view.

  10. Select the Metrics view and examine the values for the system. Use the combo box at the top-left of the view to examine metric values on other levels (Java Package, Source File, Routine, etc.). Multi-select metrics and see if you can detect a correlation. Define a threshold and check the value distribution on the histogram and pie charts.

  11. Check where JUnit is used: Open the Exploration view for the JUnit package that is contained in the "External [Java]" node in the Navigation view.

  12. Specify an exclude filter on the Workspace view by right-clicking on one of the "Filter" nodes shown above the root directories. Check the context help (F1) and the related chapter in the user manual to get more information about the different filter types. Experiment with the wildcards and filter types to exclude test related classes. Check that the number of issues in the Issues view changes. Use the filter that keeps the test related classes in the Sonargraph model but marks them as "excluded".

  13. Irrelevant issues can be either ignored or filtered. Click on the little downwards-pointing white triangle in the top-right corner of the Issues view and open the filter dialog. Deselect the issue type "Dependency To Excluded Internal Component".

  14. Ctrl+H opens the search dialog. Enter **test* to identify test classes (they should all be marked as excluded).

    Note: If all internal types are filtered out with references to JUnit, there will be no more dependencies being shown in the representation views (Exploration view, Graph view) to these external types.

  15. Create a new script by selecting the "Scripts" folder on the Files view and opening the context menu.

  16. Modify the default content to check for all types being excluded.

End of Step 1 (step1_crm-domain-example.sonargraph).

Related topics: