ossert/ossert

View on GitHub
lib/ossert/classifiers/cluster.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method train_section_metrics_thresholds has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

      def self.train_section_metrics_thresholds(section_klass, period)
        raise ArgumentError unless PERIODS.include?(period)

        # TODO: move demodulize and whole logic to Utils somewhere
        section = section_klass.to_s.demodulize.underscore.split('_').first.to_sym
Severity: Minor
Found in lib/ossert/classifiers/cluster.rb - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method train_section_metrics_thresholds has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.train_section_metrics_thresholds(section_klass, period)
        raise ArgumentError unless PERIODS.include?(period)

        # TODO: move demodulize and whole logic to Utils somewhere
        section = section_klass.to_s.demodulize.underscore.split('_').first.to_sym
Severity: Minor
Found in lib/ossert/classifiers/cluster.rb - About 1 hr to fix

    Method run_reverse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def run_reverse
            CLASSIFIERS.each do |classifier_name|
              classifier = @classifiers[classifier_name]
              reversed_metrics.each do |reversed_metric|
                GRADES.first(GRADES.count / 2).each do |grade|
    Severity: Minor
    Found in lib/ossert/classifiers/cluster.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status