Crate rust_code_analysis

Source
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§

Enums§

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

Traits§

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 Aliases§