Beispiel #1
0
 def write_results(self, output_dir):
     self._logger.info("Writing output to %s", str(output_dir))
     writer.write_cycles_to_txt(
         os.path.join(output_dir, "bundle_cycles.txt"), self._cycles)
     writer.write_dataframe_to_xls(self._analysis_result, "bundles.xls",
                                   output_dir, "Bundles")
     writer.write_graphml(os.path.join(output_dir, "dependencies.graphml"),
                          self._graph)
Beispiel #2
0
 def write_results(self, output_dir):
     writer.write_dataframe_to_xls(
         self._analysis_result,
         "cognitive_complexity_per_package.xls",
         output_dir,
         "Package Complexity",
     )
     self._plot_treemaps(output_dir)
Beispiel #3
0
    def test_write_dataframe_to_xls_saves_xls(self, mock_writer_factory):
        mock_data = Mock()
        mock_writer = Mock()
        mock_writer_factory.return_value = mock_writer

        sut.write_dataframe_to_xls(mock_data, "", "", "")

        self.assertTrue(mock_writer.save.called)
Beispiel #4
0
    def test_write_dataframe_to_xls_writes_to_given_path(
            self, mock_writer_factory):
        mock_data = Mock()
        exp_filename = "dummyFileName"
        exp_out_dir = os.path.join("dummy", "path")
        exp_path = os.path.join(exp_out_dir, exp_filename)

        sut.write_dataframe_to_xls(mock_data, exp_filename, exp_out_dir, "")

        mock_writer_factory.assert_called_with(exp_path)
Beispiel #5
0
    def test_write_dataframe_to_xls_writes_expected_data(
            self, mock_writer_factory):
        mock_data = Mock()
        mock_writer = Mock()
        exp_sheetname = "My Dummy Sheet"
        mock_writer_factory.return_value = mock_writer

        sut.write_dataframe_to_xls(mock_data, "", "", exp_sheetname)

        mock_data.to_excel.assert_called_with(mock_writer,
                                              exp_sheetname,
                                              index=False)
Beispiel #6
0
 def write_results(self, output_dir):
     writer.write_dataframe_to_xls(
         self._analysis_result,
         "cognitive_complexity_per_method.xls",
         output_dir,
         "Method Complexity",
     )
     methods_with_comp_greater_zero = self._create_barchart_data()
     plot.plot_barchart(
         methods_with_comp_greater_zero,
         "Cognitive complexity",
         "Methods with highest cognitive complexity",
         output_dir,
         "most_complex_methods.pdf",
     )
Beispiel #7
0
 def write_results(self, output_dir):
     writer.write_dataframe_to_xls(
         self._analysis_result,
         "cognitive_complexity_per_class.xls",
         output_dir,
         "Class Complexity",
     )
     batchart_data = self._create_barchart_data()
     plot.plot_barchart(
         batchart_data,
         "Cognitive complexity",
         "Classes with highest cognitive complexity",
         output_dir,
         "most_complex_classes.pdf",
     )
Beispiel #8
0
 def write_results(self, output_dir):
     writer.write_dataframe_to_xls(
         self._analysis_result,
         "changed_lines_per_package.xls",
         output_dir,
         "Changes since " + self._workspace.since,
     )
     tm_data = self._create_tm_data()
     plot.plot_treemap(
         tm_data,
         "Number of changed lines per packag since " +
         self._workspace.since,
         output_dir,
         "changed_lines_per_package.pdf",
         "changes:",
     )
Beispiel #9
0
 def write_results(self, output_dir):
     writer.write_dataframe_to_xls(
         self._analysis_result,
         "changed_lines_per_file.xls",
         output_dir,
         "Changes since " + self._workspace.since,
     )
     barchart_data = self._create_barchart_data()
     plot.plot_stacked_barchart(
         barchart_data,
         "Number of changed lines",
         "Number of changed lines for most changed files since " +
         self._workspace.since,
         output_dir,
         "most_changed_files.pdf",
     )
Beispiel #10
0
    def write_results(self, output_dir):
        writer.write_dataframe_to_xls(
            self._analysis_result,
            "cognitive_complexity_per_project.xls",
            output_dir,
            "Project Complexity",
        )
        tm_data = self._analysis_result.drop(columns=["Path"])
        tm_data = tm_data[tm_data["Complexity"] > 0]

        plot.plot_treemap(
            tm_data,
            "Cognitive complexity per project",
            output_dir,
            "cognitive_complexity_per_project.pdf",
            "complexity:",
        )