lib/gui/fs_viewer_tab_widget.rb

Summary

Maintainability
D
1 day
Test Coverage

Method initialize has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize *args
      super *args

      @icons = Qt::FileIconProvider.new

Severity: Major
Found in lib/gui/fs_viewer_tab_widget.rb - About 3 hrs to fix

    File fs_viewer_tab_widget.rb has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative '../lib/rsync_git_manager'
    module Idb
    
      class FSViewerControlGroupBox < Qt::GroupBox
        def initialize *args
    Severity: Minor
    Found in lib/gui/fs_viewer_tab_widget.rb - About 2 hrs to fix

      Method initialize has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize *args
            @layout = Qt::GridLayout.new
            super *args
            setLayout @layout
      
      
      Severity: Minor
      Found in lib/gui/fs_viewer_tab_widget.rb - About 1 hr to fix

        Method populate_files has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def populate_files path
              @model.clear
              @model.setHorizontalHeaderItem(0, Qt::StandardItem.new("filename"))
              @model.setHorizontalHeaderItem(1, Qt::StandardItem.new("size"))
              @model.setHorizontalHeaderItem(2, Qt::StandardItem.new("permissions"))
        Severity: Minor
        Found in lib/gui/fs_viewer_tab_widget.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 populate_files has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def populate_files path
              @model.clear
              @model.setHorizontalHeaderItem(0, Qt::StandardItem.new("filename"))
              @model.setHorizontalHeaderItem(1, Qt::StandardItem.new("size"))
              @model.setHorizontalHeaderItem(2, Qt::StandardItem.new("permissions"))
        Severity: Minor
        Found in lib/gui/fs_viewer_tab_widget.rb - About 1 hr to fix

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

              def initialize *args
                super *args
          
                @icons = Qt::FileIconProvider.new
          
          
          Severity: Minor
          Found in lib/gui/fs_viewer_tab_widget.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 add_dirs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_dirs parent, cur_dir
                if parent.text(2) == "true"
                  # we added children for this already
                  return
                end
          Severity: Minor
          Found in lib/gui/fs_viewer_tab_widget.rb - About 35 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

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

              def has_subdirs? dir
                files = $device.ops.list_dir_full dir
                if files.length == 2
                  # only "." and ".."
                  return false
          Severity: Minor
          Found in lib/gui/fs_viewer_tab_widget.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