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
ASTnode. - AstPayload
- The payload of an
Astrequest. - AstResponse
- The response of an
ASTrequest. - 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
ASTof 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
ASTnode. - 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
Callbacktrait, 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
ASTof 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
Emacsmode. - 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 aPreprocResultsobject. - read_
file - Reads a file.
- read_
file_ with_ eol - Reads a file and adds an
EOLat its end. - rm_
comments - Removes comments from a code.
- write_
file - Writes data to a file.
Type Aliases§
- Ccomment
Parser - The
Ccommentlanguage parser. - CppParser
- The
Cpplanguage parser. - Java
Parser - The
Javalanguage parser. - Javascript
Parser - The
Javascriptlanguage parser. - Mozjs
Parser - The
Mozjslanguage parser. - Preproc
Parser - The
Preproclanguage parser. - Python
Parser - The
Pythonlanguage parser. - Rust
Parser - The
Rustlanguage parser. - Span
- Start and end positions of a node in a code in terms of rows and columns.
- TsxParser
- The
Tsxlanguage parser. - Typescript
Parser - The
Typescriptlanguage parser.