thyrlian/AgileNotifier

View on GitHub

Showing 7 of 7 total issues

Class Configuration has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Configuration
    def initialize(&blk)
      @current_module = Object.const_get(self.class.to_s.split('::').first)
      @its_args = Hash.new
      options = Commander.order(ARGV)
Severity: Minor
Found in lib/agile_notifier/configuration.rb - About 2 hrs to fix

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

        def initialize(url, args = {})
          super
          basic_auth = args.fetch(:basic_auth, nil)
          access_token = args.fetch(:Authorization, nil)
          if basic_auth
    Severity: Minor
    Found in lib/agile_notifier/github.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 get_value_of_key_from_json has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_value_of_key_from_json(key, collection) # only returns the first match if duplicated keys exist
            if collection.respond_to?(:each_pair) # behaves like Hash
              return collection[key] if collection.has_key?(key)
              collection.keys.each do |k|
                value = send(__method__, key, collection[k]) # recursive call
    Severity: Minor
    Found in lib/agile_notifier/response_helper.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def initialize(url, args = {})
          super
          basic_auth = args.fetch(:basic_auth, nil)
          access_token = args.fetch(:Authorization, nil)
          if basic_auth
    Severity: Minor
    Found in lib/agile_notifier/github.rb - About 1 hr to fix

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

              def speak_on_osx(text, language, voice)
                if voice
                  unless osx_speech(voice, text)
                    raise("No available voice found, please check if you have downloaded voice [#{voice}] in System Preferences -> Speech")
                  end
      Severity: Minor
      Found in lib/agile_notifier/tts.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 request_json_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def request_json_response(*args)
              method = ((args[1].respond_to?(:delete) ? args[1].delete(:method) : false) || :get).to_sym
              supported_methods = [:get, :post, :put, :delete, :head, :options]
              unless supported_methods.include?(method)
                raise(RuntimeError, "Unsupported HTTP Method: #{method.to_s}", caller)
      Severity: Minor
      Found in lib/agile_notifier/response_helper.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 get_previous_build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def get_previous_build
                previous_number = @number - 1
                while previous_number > 0
                  previous_url = @url.gsub(/\/#{@number}\//, "/#{previous_number}/")
                  if is_available?(previous_url)
      Severity: Minor
      Found in lib/agile_notifier/jenkins.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