fedux-org/proxy_rb

View on GitHub

Showing 11 of 11 total issues

Method constantize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        def constantize(camel_cased_word)
          names = camel_cased_word.split('::')

          # Trigger a built-in NameError exception including the ill-formed constant in the message.
          Object.const_get(camel_cased_word) if names.empty?
Severity: Minor
Found in lib/proxy_rb/event_bus/name_resolver.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 start has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start
      # Start IRB with current context:
      # http://stackoverflow.com/questions/4189818/how-to-run-irb-start-in-context-of-current-class
      ARGV.clear
      IRB.setup nil
Severity: Minor
Found in lib/proxy_rb/console.rb - About 1 hr to fix

    Method events has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def events
          runtime.event_bus.register(
            :proxy_set,
            proc do |event|
              runtime.announcer.announce :proxy, event.entity
    Severity: Minor
    Found in lib/proxy_rb/setup.rb - About 1 hr to fix

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

          def url?(u)
            url = Addressable::URI.parse(u)
      
            return false if url.nil?
            return false unless /\A[[:alnum:]]+\Z/ === url.scheme
      Severity: Minor
      Found in lib/proxy_rb/proxy_url_parser.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 fetch_password_for_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def fetch_password_for_user(user_name)
              result = nil
      
              fetchers.each do |f|
                begin
      Severity: Minor
      Found in lib/proxy_rb/password_fetchers/chaining_password_fetcher.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 register has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def register(proxy)
              if proxy.empty?
                ::Capybara.current_driver = :poltergeist
                return
              end
      Severity: Minor
      Found in lib/proxy_rb/drivers/poltergeist_driver.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

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

        failure_message do |actual|
          msg = []
      
          msg << %(expected that response of "#{resource}" has status code 2xx, but has #{actual.status_code}.)
      
      
      Severity: Minor
      Found in lib/proxy_rb/matchers/be_successful.rb and 1 other location - About 30 mins to fix
      lib/proxy_rb/matchers/be_forbidden.rb on lines 10..21

      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 32.

      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

        failure_message do |actual|
          msg = []
      
          msg << %(expected that response of "#{resource}" has status code 403, but has #{actual.status_code}.)
      
      
      Severity: Minor
      Found in lib/proxy_rb/matchers/be_forbidden.rb and 1 other location - About 30 mins to fix
      lib/proxy_rb/matchers/be_successful.rb on lines 10..21

      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 32.

      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 announce has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def announce(channel, *args, &_block)
            channel = channel.to_sym
      
            the_output_format = if output_formats.key? channel
                                  output_formats[channel]
      Severity: Minor
      Found in lib/proxy_rb/announcer.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

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

        failure_message_when_negated do
          msg = []
      
          msg << %(expected that response of "#{resource}" does not have status code 2xx.)
      
      
      Severity: Minor
      Found in lib/proxy_rb/matchers/be_successful.rb and 1 other location - About 20 mins to fix
      lib/proxy_rb/matchers/be_forbidden.rb on lines 24..35

      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 27.

      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

        failure_message_when_negated do
          msg = []
      
          msg << %(expected that response of "#{resource}" does not have status code 403.)
      
      
      Severity: Minor
      Found in lib/proxy_rb/matchers/be_forbidden.rb and 1 other location - About 20 mins to fix
      lib/proxy_rb/matchers/be_successful.rb on lines 24..35

      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 27.

      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

      Severity
      Category
      Status
      Source
      Language