optittm / bugprediction

A CLI tool to assess the risk of releasing your next version. Can generate a comprehensive dataset for testing your bug prediction models.
MIT License
0 stars 1 forks source link

CK Error causes statistics package to raise an exception #26

Closed bbalet closed 1 year ago

bbalet commented 1 year ago

While analyzing https://github.com/ReactiveX/RxJava project, CK tool failed and caused an error utils/math.py", line 8, in get_rounded_mean Either try to fix CK tool by collaborating with CK team or ignore the analysis in case of failure (in this case columns will be NULL and later ignored).

ERROR:root:An error occurred while reading CK report for version v2.0.0-DP0
ERROR:root:mean requires at least one data point
INFO:root:Function compute_metrics took 0.6126251679997949 seconds
INFO:root:CK::analyze_repo
INFO:root:Adding Lizard analysis for this version
Traceback (most recent call last):
  File "/root/projects/bugprediction/main.py", line 381, in <module>
    cli(obj={})
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "src/dependency_injector/_cwiring.pyx", line 28, in dependency_injector._cwiring._get_sync_patched._patched
  File "/root/projects/bugprediction/main.py", line 314, in populate
    lizard.analyze_source_code()
  File "/root/projects/bugprediction/connectors/fileanalyzer.py", line 64, in analyze_source_code
    self.complete_metric_values(metric)
  File "/root/projects/bugprediction/utils/timeit.py", line 9, in timeit_wrapper
    result = func(*args, **kwargs)
  File "/root/projects/bugprediction/connectors/fileanalyzer.py", line 86, in complete_metric_values
    new_metric = self.__transform_values_into_metric(metric)
  File "/root/projects/bugprediction/connectors/fileanalyzer.py", line 204, in __transform_values_into_metric
    new_metric.lizard_avg_complexity = Math.get_rounded_mean(self.__average_complexities_values)
  File "/root/projects/bugprediction/utils/math.py", line 8, in get_rounded_mean
    values_mean = mean(values)
  File "/usr/lib/python3.10/statistics.py", line 328, in mean
    raise StatisticsError('mean requires at least one data point')
statistics.StatisticsError: mean requires at least one data point
FredericDymko commented 1 year ago

PR Merge