Skookum/bamboozled

View on GitHub

Showing 5 of 5 total issues

Method all_names has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.all_names # rubocop:disable Metrics/MethodLength
        %w[
          address1
          address2
          age
Severity: Major
Found in lib/bamboozled/api/field_collection.rb - About 3 hrs to fix

    Method request has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def request(method, path, options = {})
            params = {
              path:    path,
              options: options,
              method:  method
    Severity: Major
    Found in lib/bamboozled/api/base.rb - About 2 hrs to fix

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

      def employees_on_date(employees, date)
        employees.map do |e|
          hire_date = Date.parse(e["hireDate"]) rescue nil
          termination_date = Date.parse(e["terminationDate"]) rescue nil
          (hire_date <= date && (termination_date.nil? || termination_date >= date)) ? 1 : 0
      Severity: Minor
      Found in examples/employees_over_time.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def request(method, path, options = {})
              params = {
                path:    path,
                options: options,
                method:  method
      Severity: Minor
      Found in lib/bamboozled/api/base.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 photo_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def photo_url(employee)
              if (Float(employee) rescue false)
                e = find(employee, ['workEmail', 'homeEmail'])
                employee = e['workEmail'].nil? ? e['homeEmail'] : e['workEmail']
              end
      Severity: Minor
      Found in lib/bamboozled/api/employee.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