示例#1
0
def main(show_combined_graph):
    logging.basicConfig(stream=sys.stderr, level=logging.INFO)
    configurator = Configurator()
    configurator.default()

    dependency_filter_config_class = Configurator().get_concrete_adapter(
        DependencyFilterConfiguration)
    dep_filter_config = dependency_filter_config_class()
    file_to_module_map_supply = OnTheFlyHeaderExceptionOnlyFileToModuleMapSupply(
    )

    link_deps_supply = OnTheFlyModuleLinkDepsSupply(dep_filter_config)

    link_deps_graph = link_deps_supply.get_module_link_deps_graph()
    full_include_graph = OnTheFlyModuleIncludeDepsSupply(
        outputter_config=NullDependencyFilterConfiguration(),
        file_to_module_map_supply=file_to_module_map_supply
    ).get_module_include_deps_graph()
    module_grouper = config_module_grouper(
        modules=full_include_graph.node_names())

    include_deps_graph = DependencyFilterHelper.filter_graph(
        dependency_filter_configuration=dep_filter_config,
        graph=full_include_graph)
    ec = ConsistencyChecker(
        link_deps_graph,
        include_deps_graph,
        node_group_conf=config_node_group_conf(module_grouper))

    report_filename = os.path.join(config_basic.get_results_directory(),
                                   "IncludeDeps",
                                   "include_link_dep_consistency_report.txt")
    report_output = configurator.create_instance(
        cls=ConsistencyCheckerReportOutputter,
        file_to_module_map_supply=file_to_module_map_supply,
        module_grouper=module_grouper,
        report_filename=report_filename)
    report_output.print_all(
        missing_link_deps_graph=ec.get_missing_link_deps_graph(),
        irregular_link_deps_graph=ec.get_irregular_link_deps_graph())

    IncludeDepsGraphOutputter(
        module_grouper=module_grouper).output_include_deps_graph(
            ec.get_module_include_deps_graph())

    result_output = configurator.create_instance(
        cls=ConsistencyCheckerGraphOutputter,
        file_to_module_map_supply=file_to_module_map_supply,
        module_grouper=module_grouper)

    result_output.output_combined_graph(
        show_combined_graph,
        ec.get_combined_graph(),
        ec.get_overview_combined_graph(),
    )

    if '--focus_on_each_group' in sys.argv:
        PerGroupOutputter.output_focus_on_each_group(
            module_grouper=module_grouper,
            full_graph=full_include_graph,
            base_name=FileModuleIncludeDepsSupply(
            ).get_module_include_deps_basename(),
            base_description=IncludeDepsGraphOutputter.BASE_DESCRIPTION,
            dependency_filter_config_class=dependency_filter_config_class)
示例#2
0
            AttributedEdge(from_node="BTC.CAB.X.ClassC",
                           to_node="BTC.CAB.Y.B"),
            AttributedEdge(from_node="BTC.CAB.Z.ClassD",
                           to_node="BTC.CAB.Y.B"),
        ))
        graph.lookup_edge("BTC.CAB.X.ClassA", "BTC.CAB.Y.B").set_attrs(
            {EdgeAttributes.COLOR: Colors.RED})
        outfile = open(output_filename, "w")
        outputter = self.__graph_outputter_class(
            graph=graph,
            outfile=outfile,
            decorator_config=DecoratorSet(
                node_label_decorators=(MyNodeColorDecorator(), ), ),
            output_groups=True,
            node_grouper=CABStyleFinestLevelModuleGrouperInternal(
                modules=graph.node_names(),
                internal_modules=graph.node_names(),
                min_parts=3),
            description=GraphDescriptionImpl(description="test",
                                             basename=output_filename))
        outputter.output_all()


if __name__ == '__main__':
    logging.basicConfig(stream=sys.stderr, level=logging.INFO)
    configurator = Configurator()
    configurator.default()
    GraphOutputDemo(graph_outputter_class=configurator.get_concrete_adapter(
        GraphicalGraphOutputter)).run(
            output_filename=sys.argv[1] if len(sys.argv) > 1 else "test")