Expand description

rust-code-analysis is a library to analyze and extract information from source codes written in many different programming languages.

You can find the source code of this software on GitHub, while issues and feature requests can be posted on the respective GitHub Issue Tracker.

Supported Languages

  • C++
  • C#
  • CSS
  • Go
  • HTML
  • Java
  • JavaScript
  • The JavaScript used in Firefox internal
  • Python
  • Rust
  • Typescript

Supported Metrics

  • CC: it calculates the code complexity examining the control flow of a program.
  • SLOC: it counts the number of lines in a source file.
  • PLOC: it counts the number of physical lines (instructions) contained in a source file.
  • LLOC: it counts the number of logical lines (statements) contained in a source file.
  • CLOC: it counts the number of comments in a source file.
  • BLANK: it counts the number of blank lines in a source file.
  • HALSTEAD: it is a suite that provides a series of information, such as the effort required to maintain the analyzed code, the size in bits to store the program, the difficulty to understand the code, an estimate of the number of bugs present in the codebase, and an estimate of the time needed to implement the software.
  • MI: it is a suite that allows to evaluate the maintainability of a software.
  • NOM: it counts the number of functions and closures in a file/trait/class.
  • NEXITS: it counts the number of possible exit points from a method/function.
  • NARGS: it counts the number of arguments of a function/method.

Modules

Structs

Configuration options for retrieving the nodes of an AST.
Information on an AST node.
The payload of an Ast request.
The response of an AST request.
All metrics data.
Configuration options for removing comments from a code.
A runner to process files concurrently.
Count of different types of nodes in a code.
Configuration options for counting different types of nodes in a code.
Configuration options for dumping the AST of a code.
Data related to files.
Configuration options for finding different types of nodes in a code.
Function space data.
Configuration options for detecting the span of each function in a code.
Function span data.
Configuration options for computing the metrics of a code.
An AST node.
All operands and operators of a space.
Configuration options for retrieving all the operands and operators in a code.
Preprocessor data of a C/C++ file.
Preprocessor data of a series of C/C++ files.

Enums

Series of errors that might happen when processing files concurrently.
The list of supported languages.
The list of supported space kinds.

Traits

A trait for callback functions.

Functions

Runs a function, which implements the Callback trait, on a code written in one of the supported languages.
Counts the types of nodes specified in the input slice and the number of nodes in a code.
Dumps the AST of a code.
Dumps all operands and operators of a code.
Dumps the metrics of a code.
Finds the types of nodes specified in the input slice.
Constructs a dependency graph of the include directives in a C/C++ file.
Detects the span of each function in a code.
Detects the language associated to the input Emacs mode.
Detects the language associated to the input file extension.
Returns all function spaces data of a code.
Detects the language of a code using the extension of a file.
Returns the macros contained in a C/C++ file.
Returns all operators and operands of each space in a code.
Guesses the language of a code.
Returns all function spaces data of a code. This function needs a parser to be created a priori in order to work.
Retrieves all the operators and operands of a code.
Extracts preprocessor data from a C/C++ file and inserts these data in a PreprocResults object.
Reads a file.
Reads a file and adds an EOL at its end.
Removes comments from a code.
Writes data to a file.

Type Definitions

The Ccomment language parser.
The Cpp language parser.
The Java language parser.
The Javascript language parser.
The Mozjs language parser.
The Preproc language parser.
The Python language parser.
The Rust language parser.
Start and end positions of a node in a code in terms of rows and columns.
The Tsx language parser.
The Typescript language parser.