refactorguide package

Submodules

refactorguide.cli module

Console script for refactorguide.

refactorguide.cli.main() → None[source]

refactorguide.desgin module

class refactorguide.desgin.Design(layers, smells)[source]

Bases: object

refactorguide.design_parser module

refactorguide.design_parser.load_design(design_file_path, generate_example=False)[source]

refactorguide.formatters module

refactorguide.formatters.dependencies_tree(module_dict: Dict[str, Dict[str, List[refactorguide.models.Class]]], oneline_format='{full_name}') → str[source]

refactorguide.hierarchy module

refactorguide.hierarchy.build_hierarchy(classes: List[refactorguide.models.Class], layer_designs: Dict[str, List[Dict[str, str]]])[source]
refactorguide.hierarchy.filter_hierarchy(container: refactorguide.models.ComponentList, path_patterns: Dict[str, str], hierarchy: refactorguide.models.Hierarchy)refactorguide.models.Hierarchy[source]
refactorguide.hierarchy.missing_wildcards(wildcards_dict)[source]

refactorguide.input_idea module

refactorguide.input_idea.read_file(idea_dep_file_path) → List[refactorguide.models.Class][source]

refactorguide.models module

class refactorguide.models.Class(path, name, package, module, layer=None, dependencies=[])[source]

Bases: refactorguide.models.ClassInfo, refactorguide.models.Component

property dependencies

all dependencies of the component in order.

property usages

all usages of the component in order.

class refactorguide.models.ClassInfo(path: str, name: str, package: str, module: str, layer: str)[source]

Bases: object

Information of a class.

property full_name

includes both package and name

property hierarchy_path
is_layer(layer) → bool[source]

Check whether class belongs to specfic layer.

Parameters

layer – layer’s name

Returns

True if class belongs to layer

property is_production

True if the class is production code

oneline_str(template) → str[source]
path_match(ignore_none=False, **kwargs) → bool[source]
class refactorguide.models.Component[source]

Bases: object

A component is something that has dependencies and usages, such as class, package, module and layer.

abstract property dependencies

all dependencies of the component in order.

abstract property hierarchy_path

path of the component in the hierarchy

property smell_dependencies

all smell dependencies of component in order.

property smell_usages

all smell usages of the component in order.

abstract property usages

all usages of the component in order.

class refactorguide.models.ComponentList(name, parent=None)[source]

Bases: refactorguide.models.Component

property classes
property dependencies

all dependencies of the component in order.

find_items(wildcards)[source]
abstract property item_type
property items
separate_items(wildcards)[source]
property smell_dependency_classes
property smell_uasge_classes
property usages

all usages of the component in order.

class refactorguide.models.Dependency(path: str, name: str, package: str, module: str, layer: str)[source]

Bases: refactorguide.models.ClassInfo

property has_smell
oneline_str(template)[source]
class refactorguide.models.Hierarchy(layers: List[refactorguide.models.Layer] = [], **_)[source]

Bases: refactorguide.models.ComponentList

property hierarchy_path

path of the component in the hierarchy

property item_type
property layers
property modules
property packages
class refactorguide.models.Layer(name: str, modules: List[refactorguide.models.Module] = [], **kwargs)[source]

Bases: refactorguide.models.ComponentList

property hierarchy_path

path of the component in the hierarchy

property item_type
property layer
property modules
property packages
class refactorguide.models.Module(name: str, packages: List[refactorguide.models.Package] = [], layer: Optional[str] = None, **_)[source]

Bases: refactorguide.models.ComponentList

property hierarchy_path

path of the component in the hierarchy

property item_type
property layer
property module
property packages
class refactorguide.models.Package(name, classes=[], module=None, layer=None, **_)[source]

Bases: refactorguide.models.ComponentList

property all_attributes
property classes
property hierarchy_path

path of the component in the hierarchy

property item_type
property module
oneline_str(template)[source]
property package
refactorguide.models.group_class_by_module_package(classes: List[refactorguide.models.Class]) → Dict[str, Dict[str, refactorguide.models.Class]][source]

Group class by its attributes: ‘module’, ‘pacakge’ and ‘name’, returns an embeded dict

refactorguide.models.path_to_wd_dict(path_or_path_dict: Dict[str, str]) → Dict[str, str][source]
refactorguide.models.wd_dict_to_path(from_dict)[source]

refactorguide.output_md module

refactorguide.output_md.write_files(report_dir, hierarchy: refactorguide.models.Hierarchy)[source]

refactorguide.output_uml module

refactorguide.output_uml.get_plant_head(module_name, pkg_dict)[source]
refactorguide.output_uml.get_plant_relation(file, dep_file_name_list, isUsage)[source]
refactorguide.output_uml.write_files(report_dir, hierarchy: refactorguide.models.Hierarchy)[source]

refactorguide.smells module

class refactorguide.smells.Smell(check, description)[source]

Bases: object

property all_args
class refactorguide.smells.SmellAddOnDependency(**kwargs)[source]

Bases: refactorguide.smells.Smell

property all_args
class refactorguide.smells.SmellCylicDependency[source]

Bases: refactorguide.smells.Smell

class refactorguide.smells.SmellDependency(**kwargs)[source]

Bases: refactorguide.smells.Smell

property all_args
class refactorguide.smells.SmellDependencyCrossModule[source]

Bases: refactorguide.smells.Smell

class refactorguide.smells.SmellDependencyCrossPackage[source]

Bases: refactorguide.smells.Smell

refactorguide.smells.addon_dependency(hierachy, cls, dep)[source]
refactorguide.smells.cross_module(hierachy, cls: refactorguide.models.Class, dep: refactorguide.models.Class) → bool[source]
refactorguide.smells.cross_package(hierachy, cls, dep)[source]
refactorguide.smells.cylic_dependency(hierachy, cls, dep)[source]
refactorguide.smells.find_smells(hierarchy: refactorguide.models.Hierarchy, dependency_smells)[source]

refactorguide.statistics module

refactorguide.statistics.components_statistics(components: List[refactorguide.models.Component])[source]
refactorguide.statistics.dependencies_statistics(dependency_group: Dict[refactorguide.models.Dependency, List[Tuple[refactorguide.smells.Smell, refactorguide.models.Dependency, refactorguide.models.Class]]])[source]
refactorguide.statistics.group_classes_by_smell_dependency(classes: List[refactorguide.models.Class]) → Dict[refactorguide.smells.Smell, Dict[refactorguide.models.Dependency, List[Tuple[refactorguide.smells.Smell, refactorguide.models.Dependency, refactorguide.models.Class]]]][source]
refactorguide.statistics.smell_data_frame(classes: List[refactorguide.models.Class])[source]
refactorguide.statistics.smells_statistics(smell_group: Dict[refactorguide.smells.Smell, Dict[refactorguide.models.Dependency, List[Tuple[refactorguide.smells.Smell, refactorguide.models.Dependency, refactorguide.models.Class]]]])[source]

refactorguide.tools module

refactorguide.tools.write_file(file_path, *content)[source]

Module contents

Top-level package for Refactor Guide.