robdbirch/snoopit

View on GitHub

Showing 10 of 10 total issues

Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(comment, pre_before, after, match, file, line_no)
Severity: Minor
Found in lib/snoopit/detected.rb - About 45 mins to fix

    Method get_snoopers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_snoopers(names=[])
          snoopers = []
          use_names = (names.size == 0 ? false : true)
          snoopies.each do |key, snooper|
            if use_names
    Severity: Minor
    Found in lib/snoopit/snooper.rb - About 45 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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def post(conn, request)
            response = conn.request(request)
            case response.code
              when 200..299, 300..399
                logger.debug 'Posted notification to: ' + response.uri.to_s
    Severity: Minor
    Found in lib/snoopit/notifiers/http.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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def send(msg, notifier_params)
            begin
              auth = notifier_params['authentication'].nil? ? :login : notifier_params['authentication'].to_sym
              from = notifier_params['from'].nil? ? 'snoopit@snooper.notifier.com' : notifier_params['from']
              formatted = build_msg from, notifier_params['to'], msg
    Severity: Minor
    Found in lib/snoopit/notifiers/email.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

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

        def create_default_notifiers
          Snoopit::Notifiers.constants.select do  |c|
            if Class === Snoopit::Notifiers.const_get(c)
              config = @config[c.to_s.downcase]
              unless config.nil?
    Severity: Minor
    Found in lib/snoopit/notification_manager.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

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

        def snoop(names=[])
          snoopers = get_snoopers names
          snoopers.each do |snoopy|
            if (!snoopy.dir.nil?) && (snoopy.dir?)
              snoop_dir snoopy
    Severity: Minor
    Found in lib/snoopit/snooper.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

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

        def load_db(db_file)
          if (! db_file.nil?) && (File.exist? db_file)
            Snoopit.logger.debug 'Loading from db file: ' + db_file
            hash_db = JSON.parse(IO.read db_file)
            hash_db.each do |key, file_info|
    Severity: Minor
    Found in lib/snoopit/file_tracker.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

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

          def updated?(file_handle)
            c_stat = File.stat @file
            if (c_stat.size == @size) && (c_stat.mtime.to_i == @mtime.to_i) && (! @init_stat)
              Snoopit.logger.debug 'FileTracker.updated? file has not changed: ' + @file
              updated = false
    Severity: Minor
    Found in lib/snoopit/file_info.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

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

        def load_files(load)
          load.keys.each do |key|
            entry = load[key]
            next if entry['file'].nil?
            next if entry['class'].nil?
    Severity: Minor
    Found in lib/snoopit/notification_manager.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

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

          def notify(found, notify_params)
            conn = get_connection
            send_message(conn, found, notify_params) unless conn.nil?
          rescue => e
              Snoopit.logger.warn e.message
    Severity: Minor
    Found in lib/snoopit/notifiers/stomp.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

    Severity
    Category
    Status
    Source
    Language