Showing 102 of 102 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    def rsync_section
      @rsync_label = Qt::Label.new "<b>rsync</b><br>(folder synchronization)"
      @layout.addWidget @rsync_label, 7, 0

      if $device.rsync_installed?
Severity: Major
Found in lib/gui/device_status_dialog.rb and 3 other locations - About 1 hr to fix
lib/gui/device_status_dialog.rb on lines 92..112
lib/gui/device_status_dialog.rb on lines 129..150
lib/gui/device_status_dialog.rb on lines 248..268

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    def initialize *args
      super *args

      @url_handler_list = Qt::GroupBox.new self
      @url_handler_list.setTitle "List of registered URL Handlers"
Severity: Minor
Found in lib/gui/url_scheme_widget.rb - About 1 hr to fix

    Method stream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def stream function
          puts "Starting"
          @id = 0
    
    
    
    Severity: Minor
    Found in lib/gui/snoop_it_update_thread.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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize *args
          super *args
    
          @pbs_to_watch = Hash.new
          @pbs_to_watch["general"] = ""
    Severity: Minor
    Found in lib/gui/pasteboard_monitor_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 decrypt_binary! has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def decrypt_binary!
          $log.info "Running '#{binary_path}'"
          full_remote_path = binary_path
          $log.error "Decryption failed. Trying using dumpdecrypted..."
    
    
    Severity: Minor
    Found in lib/lib/app.rb - About 1 hr to fix

      Method run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.run
      
            # initialize log
            $log = Log4r::Logger.new 'port_forward'
            outputter = Log4r::Outputter.stdout
      Severity: Minor
      Found in lib/helper/ssh_port_forwarder.rb - About 1 hr to fix

        Method parse_event has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def parse_event e
              row = Array.new
              row <<   Qt::StandardItem.new(e.value["id"].value.to_s)
        
              row <<   Qt::StandardItem.new(Time.at(e.value["timestamp"].value).to_s)
        Severity: Minor
        Found in lib/gui/snoop_it_fs_events_widget.rb - About 1 hr to fix

          Method start_pbwatcher_thread has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def start_pbwatcher_thread pbs
                @pbwatcher_thread = Thread.new do
                  channel = $device.ssh.open_channel do |ch|
                    ch.request_pty do |ch, success|
                    cmd = "/var/root/pbwatcher 1 #{pbs}"
          Severity: Minor
          Found in lib/gui/pb_watcher_thread.rb - About 1 hr to fix

            Method populate_table has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def populate_table
                  @keychain = KeychainWrapper.new
                  @keychain.parse
                  @keychain_tab_widget.clear
                  @model.clear
            Severity: Minor
            Found in lib/gui/keychain_widget.rb - About 1 hr to fix

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

                  def initialize *args
                    super *args
              
                    @snoop = SnoopItWrapper.new
              
              
              Severity: Minor
              Found in lib/gui/snoop_it_sensitive_api_widget.rb - About 1 hr to fix

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

                    def initialize
                      super
                
                      # initialize log
                      $log = Log4r::Logger.new 'idb'
                Severity: Minor
                Found in lib/idb.rb - About 1 hr to fix

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

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

                        def start_pbwatcher_thread pbs
                          @pbwatcher_thread = Thread.new do
                            channel = $device.ssh.open_channel do |ch|
                              ch.request_pty do |ch, success|
                              cmd = "/var/root/pbwatcher 1 #{pbs}"
                    Severity: Minor
                    Found in lib/gui/pb_watcher_thread.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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        def start_stream
                    
                    
                          @thread = SnoopItUpdateThread.new
                          @thread.connect(SIGNAL('new_events(QVariant)')) { |events|
                    Severity: Minor
                    Found in lib/gui/snoop_it_sensitive_api_widget.rb and 1 other location - About 1 hr to fix
                    lib/gui/snoop_it_fs_events_widget.rb on lines 79..99

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        def start_stream
                    
                    
                          @thread = SnoopItUpdateThread.new
                          @thread.connect(SIGNAL('new_events(QVariant)')) { |events|
                    Severity: Minor
                    Found in lib/gui/snoop_it_fs_events_widget.rb and 1 other location - About 1 hr to fix
                    lib/gui/snoop_it_sensitive_api_widget.rb on lines 59..79

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Method parse_load_commands has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def parse_load_commands
                          if @otool_path.nil?
                            @load_commands = nil
                            return
                          end
                    Severity: Minor
                    Found in lib/lib/otool_wrapper.rb - About 55 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 update_device has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def update_device
                          if $device.device?
                            @connect.hide
                            if $device.mode == "usb"
                              usb_mode_text = "<b>USB device:</b> Manually connect via SSH as " \
                    Severity: Minor
                    Found in lib/gui/device_info_group_box.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def initialize *args
                          super *args
                    
                          @layout = Qt::GridLayout.new
                          setLayout(@layout)
                    Severity: Minor
                    Found in lib/gui/settings_dialog.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def initialize *args
                          super *args
                    
                          @refresh = Qt::PushButton.new "Refresh"
                          @refresh.connect(SIGNAL :released) {
                    Severity: Minor
                    Found in lib/gui/sqlite_widget.rb - About 55 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

                    Severity
                    Category
                    Status
                    Source
                    Language