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§
- AstCallback
- AstCfg
- Configuration options for retrieving the nodes of an
AST
. - AstNode
- Information on an
AST
node. - AstPayload
- The payload of an
Ast
request. - AstResponse
- The response of an
AST
request. - Ccomment
Code - Code
Metrics - All metrics data.
- Comment
Rm - Comment
RmCfg - Configuration options for removing comments from a code.
- Concurrent
Runner - A runner to process files concurrently.
- Count
- Count of different types of nodes in a code.
- Count
Cfg - Configuration options for counting different types of nodes in a code.
- CppCode
- Dump
- DumpCfg
- Configuration options for dumping the
AST
of a code. - Files
Data - Data related to files.
- Filter
- Find
- FindCfg
- Configuration options for finding different types of nodes in a code.
- Func
Space - Function space data.
- Function
- Function
Cfg - Configuration options for detecting the span of each function in a code.
- Function
Span - Function span data.
- Java
Code - Javascript
Code - Metrics
- Metrics
Cfg - Configuration options for computing the metrics of a code.
- Mozjs
Code - Node
- An
AST
node. - Ops
- All operands and operators of a space.
- OpsCfg
- Configuration options for retrieving all the operands and operators in a code.
- OpsCode
- Parser
- Preproc
Code - Preproc
File - Preprocessor data of a
C/C++
file. - Preproc
Results - Preprocessor data of a series of
C/C++
files. - Python
Code - Rust
Code - TsxCode
- Typescript
Code
Enums§
- Concurrent
Errors - Series of errors that might happen when processing files concurrently.
- LANG
- The list of supported languages.
- Space
Kind - The list of supported space kinds.
Traits§
- Callback
- A trait for callback functions.
Functions§
- action
- Runs a function, which implements the
Callback
trait, on a code written in one of the supported languages. - count
- Counts the types of nodes specified in the input slice and the number of nodes in a code.
- dump_
node - Dumps the
AST
of a code. - dump_
ops - Dumps all operands and operators of a code.
- dump_
root - Dumps the metrics of a code.
- find
- Finds the types of nodes specified in the input slice.
- fix_
includes - Constructs a dependency graph of the include directives
in a
C/C++
file. - function
- Detects the span of each function in a code.
- get_
from_ emacs_ mode - Detects the language associated to the input
Emacs
mode. - get_
from_ ext - Detects the language associated to the input file extension.
- get_
function_ spaces - Returns all function spaces data of a code.
- get_
language_ for_ file - Detects the language of a code using the extension of a file.
- get_
macros - Returns the macros contained in a
C/C++
file. - get_ops
- Returns all operators and operands of each space in a code.
- guess_
language - Guesses the language of a code.
- metrics
- Returns all function spaces data of a code. This function needs a parser to be created a priori in order to work.
- operands_
and_ operators - Retrieves all the operators and operands of a code.
- preprocess
- Extracts preprocessor data from a
C/C++
file and inserts these data in aPreprocResults
object. - read_
file - Reads a file.
- read_
file_ with_ eol - Reads a file and adds an
EOL
at its end. - rm_
comments - Removes comments from a code.
- write_
file - Writes data to a file.
Type Aliases§
- Ccomment
Parser - The
Ccomment
language parser. - CppParser
- The
Cpp
language parser. - Java
Parser - The
Java
language parser. - Javascript
Parser - The
Javascript
language parser. - Mozjs
Parser - The
Mozjs
language parser. - Preproc
Parser - The
Preproc
language parser. - Python
Parser - The
Python
language parser. - Rust
Parser - The
Rust
language parser. - Span
- Start and end positions of a node in a code in terms of rows and columns.
- TsxParser
- The
Tsx
language parser. - Typescript
Parser - The
Typescript
language parser.