esigler/lita-locker

View on GitHub

Showing 9 of 15 total issues

Class Label has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Label
      include Redis::Objects

      value :state
      value :owner_id
Severity: Minor
Found in lib/locker/label.rb - About 2 hrs to fix

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

          def remove(response)
            results = []
            resource_names = response.match_data['resources'].split(/,\s*/)
            label_name = response.match_data['label']
            return response.reply(failed(t('label.does_not_exist', name: label_name))) unless Label.exists?(label_name)
    Severity: Minor
    Found in lib/lita/handlers/locker_labels.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 give has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def give(response)
            name = response.match_data['label'].rstrip
    
            return response.reply(failed(t('subject.does_not_exist', name: name))) unless Label.exists?(name)
            l = Label.new(name)
    Severity: Minor
    Found in lib/lita/handlers/locker.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 status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def status(response)
            name = response.match_data['label']
            unless name.match(/\*/)
              # Literal query
              return response.reply(status_label(name)) if Label.exists?(name)
    Severity: Minor
    Found in lib/lita/handlers/locker_misc.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 unlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def unlock(response)
            name = response.match_data['label'].rstrip
    
            return response.reply(failed(t('subject.does_not_exist', name: name))) unless Label.exists?(name)
            l = Label.new(name)
    Severity: Minor
    Found in lib/lita/handlers/locker.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 lock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def lock(response)
            name = response.match_data['label'].rstrip
    
            return response.reply(failed(t('label.does_not_exist', name: name))) unless Label.exists?(name)
            l = Label.new(name)
    Severity: Minor
    Found in lib/lita/handlers/locker.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 lock! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def lock!(owner_id)
            if locked?
              wait_queue << owner_id if wait_queue.last != owner_id
              return false
            end
    Severity: Minor
    Found in lib/locker/label.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def list(response)
            begin
              list = ::Locker::List.new(Resource, config.per_page, response.extensions[:kwargs][:page])
            rescue ArgumentError
              return response.reply(t('list.invalid_page_type'))
    Severity: Minor
    Found in lib/lita/handlers/locker_resources.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def list(response)
            begin
              list = ::Locker::List.new(Label, config.per_page, response.extensions[:kwargs][:page])
            rescue ArgumentError
              return response.reply(t('list.invalid_page_type'))
    Severity: Minor
    Found in lib/lita/handlers/locker_labels.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