turboladen/tailor

View on GitHub
lib/tailor/rulers/indentation_spaces_ruler.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class IndentationSpacesRuler has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class IndentationSpacesRuler < Tailor::Ruler
      def initialize(config, options)
        super(config, options)
        add_lexer_observers(
          :comment,
Severity: Minor
Found in lib/tailor/rulers/indentation_spaces_ruler.rb - About 2 hrs to fix

    Method ignored_nl_update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def ignored_nl_update(current_lexed_line, lineno, column)
            log "indent reasons on entry: #{@manager.indent_reasons}"
    
            if current_lexed_line.only_spaces?
              log 'Line of only spaces.  Moving on.'
    Severity: Minor
    Found in lib/tailor/rulers/indentation_spaces_ruler.rb - About 1 hr 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 comment_update has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def comment_update(token, lexed_line, file_text, lineno, column)
    Severity: Minor
    Found in lib/tailor/rulers/indentation_spaces_ruler.rb - About 35 mins to fix

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

            def tstring_end_update(current_line)
              unless @tstring_nesting.empty?
                tstring_start_line = @tstring_nesting.pop
      
                if tstring_start_line < current_line
      Severity: Minor
      Found in lib/tailor/rulers/indentation_spaces_ruler.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