data-clumps-type-context
v0.1.102
Published
This is a package to identify data-clumps-type-context
Downloads
37
Maintainers
Readme
About
A reporting format for Data-Clumps as used in data-clumps.
// src/api/src/ignoreCoverage/DataClumpsTypeContext.ts
/**
* This type encapsulates the context of multiple data clumps. It includes the report's version,
* the options used during the data clump analysis, and a dictionary mapping keys to data clump contexts.
*/
import {DataClumpsDetectorContext} from "./DataClumpsDetectorContext";
import {DataClumpTypeContext, Dictionary} from "../index";
export type DataClumpsTypeContext = {
// The version of the context format or the tooling.
report_version: string,
// The options used during the data clump analysis.
detector: DataClumpsDetectorContext,
// A dictionary mapping keys to data clump contexts.
data_clumps: Dictionary<DataClumpTypeContext>,
// The timestamp when the report was generated
report_timestamp: string,
// The language or framework the detector is designed for
target_language: string
// An overall summary of the report, it could contain a general overview, high risk files or any other relevant summary data
report_summary: {
amount_data_clumps: number | null,
amount_files_with_data_clumps: number | null,
amount_classes_or_interfaces_with_data_clumps: number | null,
amount_methods_with_data_clumps: number | null,
fields_to_fields_data_clump: number | null,
parameters_to_fields_data_clump: number | null,
parameters_to_parameters_data_clump: number | null,
additional: any,
}
// Information about the project or codebase where the data clumps are detected
project_info: {
project_url: string | null,
project_name: string | null,
project_version: string | null,
project_commit_hash: string | null,
project_tag: string | null,
project_commit_date: string | null,
number_of_files: number | null,
number_of_classes_or_interfaces: number | null,
number_of_methods: number | null,
number_of_data_fields: number | null,
number_of_method_parameters: number | null,
additional: any,
}
}
// src/api/src/ignoreCoverage/DataClumpsDetectorContext.ts
/**
* This type holds the configuration options for a specific detector during data clump analysis.
*/
export type DataClumpsDetectorContext = {
// The name of the detector used in the analysis
name: string,
url: string | null,
// The version of the detector used in the analysis
version: string,
// The threshold value or metric that defines a data clump for the detector
options: any,
}
// src/api/src/ignoreCoverage/DataClumpTypeContext.ts
/**
* This type represents the context in which a data clump exists.
*/
import {DataClumpsVariableFromContext, Dictionary} from "../index";
export type DataClumpTypeContext = {
// The type of the context, in this case always 'data_clump'.
type: string;
// A unique identifier typically composed of the file path, class name, method name, and parameter names.
key: string;
probability: number | null;
// The file path from where the data clump originates.
from_file_path: string;
// The name of the class or interface where the data clump originates.
from_class_or_interface_name: string;
// A unique key of the class or interface where the data clump originates.
from_class_or_interface_key: string;
// The name of the method where the data clump originates, if applicable.
from_method_name: string | null;
// A unique key of the method where the data clump originates, if applicable.
from_method_key: string | null;
// The file path to where the data clump points.
to_file_path: string;
// The name of the class or interface to where the data clump points.
to_class_or_interface_name: string;
// A unique key of the class or interface to where the data clump points.
to_class_or_interface_key: string;
// The name of the method to where the data clump points, if applicable.
to_method_name: string | null;
// A unique key of the method to where the data clump points, if applicable.
to_method_key: string | null;
// The specific type of data clump: 'parameter_data_clump' or 'field_data_clump'.
data_clump_type: string;
// Information about specific information like propability, risk, etc.
data_clump_type_additional?: any;
// A dictionary mapping keys to data clumps parameter from context.
data_clump_data: Dictionary<DataClumpsVariableFromContext>
}
// src/api/src/ignoreCoverage/DataClumpsVariableFromContext.ts
/**
* This type represents a parameter from the context in which a data clump exists.
*/
import {Position, DataClumpsVariableToContext} from "../index";
export type DataClumpsVariableFromContext = {
// A unique identifier for this parameter.
key: string;
// The name of the parameter in the source code.
name: string;
// The data type of the parameter.
type: string;
// Modifiers applied to the parameter, e.g., 'public', 'private', 'readonly', etc.
modifiers: string[] | undefined;
position: Position;
probability: number | null;
// Representation of the matching parameter in the destination context.
to_variable: DataClumpsVariableToContext;
}
// src/api/src/ignoreCoverage/DataClumpsVariableToContext.ts
import {Position} from "../index";
/**
* This type represents a parameter in the destination context matching a data clump.
*/
export type DataClumpsVariableToContext = {
// A unique identifier for this parameter.
key: string;
// The name of the parameter in the source code.
name: string;
// The data type of the parameter.
type: string;
position: Position;
// Modifiers applied to the parameter, e.g., 'public', 'private', 'readonly', etc.
modifiers: string[] | undefined;
}
// src/api/src/ignoreCoverage/Position.ts
/**
* This type represents a position in a source code
*/
export type Position = {
startLine: number;
startColumn: number;
endLine: number;
endColumn: number;
}
// src/api/src/ignoreCoverage/Dictionary.ts
export interface Dictionary<T> {
[Key: string]: T;
}
License
MIT
Contributors
The FireboltCasters