Code Analysis Component v2.0 Released March 7, 2017

A 4D v14/v15 Component targeted to 4D developers to do analysis on their 4D Code. The component provides the ability to export all the methods in the host database as text files, export all the methods as HTML documentation, and provide statistics on each of the methods.

The component has been released for 4D v14 and 4D v15, free of charge, to the 4D Community. Download Now

 

Code Analysis Component for 4D v12 or 13

Only a subset of the features are supported based on when active development for of the component for those versions of 4D was stopped.

The component has been released, free of charge, to the 4D Community. Download Now

 

Source Code Control Support

As of Release 1.4 of the component, the exported methods are source code control friendly. The end-of-line characters default to the norms for the platform (LF on Mac OS X, CRLF on Windows). This can be customized using preferences as well you can customize the name of the folder that the code is exported to including the ability to append just the current date, current date and time or append nothing.

Future versions of the component will have increasing support for managing the methods that go into a folder that is linked with source control.

All the properties that 4D has provided a getter for are included in the exported JSON files.

Method Explorer

As of v2.0, a simple method explorer is available. From the explorer you can view statistics on the methods along with the last time it was saved. The methods can be filtered using a custom filter or through preset filters in a dropdown menu.

Perform Method Code Analysis

The component performs basic code analysis on every project method, project form method, table form method, database method and trigger method in the structure.

From this tab, the user can see some basic statistics for each method including cyclomatic complexity. The results of the analysis can be saved for future usage. The thresholds for the cyclomatic complexity and other parameters are modifiable and stored in the component's preferences.

 

Perform Index Analysis

The component performs basic analysis on queries that are made and how the indexes are used.

From this tab, the user can see some basic statistics for each field that is either in a query or has an index. This analysis will help you determine which fields should index, should not be indexed and what type of index. The results of the analysis can be saved for future usage.

 

 

Perform DIFF Comparisons

The component allows the 4D Developer to perform a comparison of previous method export against the 4D structure. The results of the comparison are shown with a brief description describing what the differences are.

The 4D Developer can double click a particular method and see a detailed view comparing the method as it is stored in the structure against the method as it is stored on disk. All differences are highlighted.

 

Introduced in v1.5 of the component, the 4D Developer is now able to include specific extra folders in the export and then perform difference comparisons between what is locally in 4D and what has been previously exported. The results of the comparison are shown with a brief description describing what the differences are.

 

Export Structure Code

The component allows the 4D developer to export all the methods in the structure to disk as text files. These exported methods can be then archived, backed up, or put into a source control system.

The component also allows the 4D developer to export the code as HTML docs or as a DocSet. There is an option to limit the export to only include those methods that have been marked as shared with the host database which allows the developer to produce HTML documentation for their own component. Any comments on the 4D methods are also included.

DocSets can be opened by Dash or xCode and are useful for a quick developer references.

 
 

Structure Export

The component allows the 4D developer to export form/form object properties and table/field properties to disk as JSON text files.These exported JSON text files can be then archived, backed up, or put into a source control system.

All the properties that 4D has provided a getter for are included in the exported JSON files.

 
 

 

4D Project Method Comment Management

As of v1.8, the component supports the ability to take the comment blocks at the top of each project method and have those comments placed as the 4D Project Method Comment. This is useful for 4D Deelopers that make their own components and want to have meaningful tooltips.