about
12/03/2022
CppCodeAnalyzer Repo
CppCodeAnalyzer code

CppCodeAnalyzer  Repository

Uses rule-based parser to build AST holding data for display

Quick Status Code functions correctly no known defects Demonstration code yes Documentation yes - needs much more Test cases no, but planned Static library no, but planned Build requires C++17 option Planned design changes Add more demonstration code
Fig 1. CodeAnalyzer Packages
Fig 2. CodeAnalyzer Activities
Fig 3. CodeAnalyzer Output

1.0 Concept

CppCodeAnalyzer executes static type-based code analysis on specified files in a specified directory tree. It evaluates metrics and provides an Abstract Syntax Tree representation for the analysis results. Note that each of the figures on the right expand when the image body is clicked. They contract when their title bars are clicked, or when the page is refreshed.

2.0 Design

The CodeAnalyzer package static structure is shown in Figure 1. The Window, Executive, ConfigParser, FileMgr, and FileSystem are responsible for configuring the analyzer and feeding it input data. The Display and Logger are tasked with sending information to the user. All other packages are part of a rule-based CppParser Fig 2. shows the CodeAnalyzer activities as they evolve in time. The Window subsystem collects user input, configures the parser by constructing its command line, and creates the CodeAnalyzer process. Then, the CodeAnalyzer extracts configuration information from its command line and starts a directory navigation process that continually feeds file references for analysis. Each code file is parsed using CppParser, which contributes to the contents of a simplified Abstract Syntax Tree. As the tree is built, analysis of complexity and other metrics runs, providing information displayed to the user as analysis of each file completes. This activity pipeline provides continous information to the user as computation progresses. A typical output is shown in Fig 3.

3.0 Build

CppCodeAnalyzer was built with Visual Studio Community Edition - 2019 and tested on Windows 10.

4.0 Status

My teaching assistants and I used this code analyzer for years grading code projects for my graduate software design courses at Syracuse University. I built the original prototype version for a research project in 2004, excellent work by Dr. Murat Gungor. I had the pleasure of working with and advising Murat on his dissertation, of which this research was a part. The CodeAnalyzer has evolved through several iterations, adding functionality, fixing aggravating flaws, and simplifying.
  Next Prev Pages Sections About Keys