Code Analysis Component v1.4

Dani Beaubien (Open Road Development Inc.) has released an update for his free and fantastic 4D Code Code Analysis. If you ever want to know whether your 4D code behaves or nor here’ you chance to get a closer look.

The updated the 4Dv13 Code Analysis component addresses a few outstanding bugs and added enhancements. The bulk of the enhancements deal with the preferences and the way how they are stored. The component itself has been moved to a better support code management.
This version is now using more platform friendly end-of-line characters so that source code control systems will recognize each line. A quick launcher floating palette has been added, makes it much easier for a quick export  of any method changes to disk.

 

WHAT IS IT

Code Analysis is easy to use and offers the following features:

  • Can perform analysis on “all” stored methods in the structure including project methods, project form/object methods, table form/object methods, database methods and trigger methods.
  • Gathers stats on line counts, comment line counts, blank line counts, code line counts, and cyclomatic complexity.
  • Can export, as disk files, every method in the structure. Can be used for archiving, backups, and source code management.
  • Can export, as JSON files, every available form and form object property in the structure. Can be used for archiving, backups, and source code management.
  • Can export, as JSON files, every available table and field property in the structure. Can be used for archiving, backups, and source code management.
  • Can create HTML documentation of the methods in the structure. The HTML docs can be limited to only those methods that have been marked as shared with host. This gives 4D developers to easily produce documentation for components that they share.
  • Can create a docset for the shared methods. Third party Docset viewers are available on many platforms.

 

Please feel free to drop Danie Beaubien a note on suggestions and feature requests. He does plan to do some more tweaks and add new features in the future.

HOW TO GET IT

Go to <http://openroaddevelopment.com/projects_4dComponent_CodeAnalysis.html> to get more information and download the component.

VERSION 1.4 CHANGES

General

  • Adjusted the layout of the Preferences and API Docs buttons on the window.
  • Enhanced the format used in the internal xml preference files. A preference label attribute is part of each preference.
  • Worked around an issue with the “folder separator” constant with a hotfix version of 4D.
  • Fixed issue that allowed html files to be dragged onto the webarea on the documentation/release notes window.
  • Fixed issue where object names had special characters. The objects are display properly rather than encoded characters. The issue was fixed on screen and in the exported HTML docs.
  • Improved Read Me file

Quick Launcher

  • Added a quick launcher window that can be set as floating or just a plain palette. From this quick launcher window you can export the methods to text files as well as open the main window for the component or the preferences. The window can be opened by calling the “CA_ShowQuickLauncher method”.

Preferences

  • Split the preference on what to append to the folder containing the exported methods. The options are nothing, date only, date & time.
  • Added a preference to control which line endings to use for the exports. CR, LF and CRLF are the options.

Method Difference Viewer

  • Made some slight UI updates to the screen.
  • Added ability to copy, using an Apply button, the method from disk into the 4D method.
    Note: Form methods can only be updated. They cannot be created this way.
  • Fixed issue where the changes within a line would not be highlighted if the that line of the method contained a <, > or &.
  • Fixed issue where any html embedded in a line would be hidden if the that line of the method contained a <, > or &.
  • The DIFF parser will normalize the end-of-line character(s) before performing the DIFF. The result is that two files of identical content but with different EOLs will not show as having differences. This also applies to the differences tab as well.

Complexity Tab

Added “Called” column that shows the number of times that method is called directly in 4D Code.

Differences Tab

  • The folder that was used to check for differences against is stored in the local structure preferences. The next time the Code Analysis window is opened, that last folder is restored so that a quick “Re-Check” button can be done.
  • Fixed a bug in the “Create Method From File” so that the BOM in the UTF8 file is not imported as part of the code. The option to create a method from a file is part of the contextual menu when clicking on a method in the list of differences.
  • Fixed a bug that caused the “Show File on Disk” pop-up menu option to not work. This option is part of the contextual menu when clicking on a method in the list of differences.

Structure Export Tab

  • Fixed runtime errors that would occur when Exporting Properties. Apparently using pointers to local vars as parms to an EXECUTE METHOD is not a good idea.

Internal Changes

  • Window locations are stored in a global preference file rather one preference file per structure that the CodeAnlysis component is installed in.
  • The Preference dialog preference values are now tied to an internal project name that is generated the first time the CodeAnaysis component is used. This means that the preferences will persist if the host structure changes it’s name. The internal project name is stored in the host structure’s resource folder.

Dani Beaubien
dbeaubien@openroaddevelopment.com
Open Road Development, Inc.