stephan-nordnes-eriksen/feather_watch

View on GitHub

Showing 6 of 6 total issues

Method setup_notifier has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

        def setup_notifier(directories, callback, verbose, silence_exceptions)
            directories.each do |dir|
                notifier = INotify::Notifier.new
                @notifiers << notifier
                #Avaliable events: :access, :attrib, :close_write, :close_nowrite, :create, :delete, :delete_self, :ignored, :modify, :move_self, :moved_from, :moved_to, :open
Severity: Minor
Found in lib/feather_watch/core/linux_watcher.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 setup_watcher has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        def setup_watcher(directories, callback, verbose, silence_exceptions)
            @fs_event = FSEvent.new
            options = { :no_defer => true,
                        :file_events => true }

Severity: Minor
Found in lib/feather_watch/core/darwin_watcher.rb - About 2 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 setup_monitor has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        def setup_monitor(directories, callback, verbose, silence_exceptions)
            @monitors = []
            directories.each do |dir|
                monitor = WDM::Monitor.new
                @monitors << monitor
Severity: Minor
Found in lib/feather_watch/core/windows_watcher.rb - About 2 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 setup_notifier has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def setup_notifier(directories, callback, verbose, silence_exceptions)
            directories.each do |dir|
                notifier = INotify::Notifier.new
                @notifiers << notifier
                #Avaliable events: :access, :attrib, :close_write, :close_nowrite, :create, :delete, :delete_self, :ignored, :modify, :move_self, :moved_from, :moved_to, :open
Severity: Minor
Found in lib/feather_watch/core/linux_watcher.rb - About 1 hr to fix

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

            def setup_monitor(directories, callback, verbose, silence_exceptions)
                @monitors = []
                directories.each do |dir|
                    monitor = WDM::Monitor.new
                    @monitors << monitor
    Severity: Minor
    Found in lib/feather_watch/core/windows_watcher.rb - About 1 hr to fix

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

              def initialize(directories, callback, verbose= false, silence_exceptions= false)
                  @verbose = verbose
                  dir = directories
                  dir = [directories] if directories.is_a?(String)
                  raise "Unknown datatype for directories. Was: #{dir}" unless dir.is_a?(Array)
      Severity: Minor
      Found in lib/feather_watch/watcher.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