frc-frecon/frecon

View on GitHub

Showing 12 of 31 total issues

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

        def initialize(args)
            if args.is_a?(String)
                # Match `args' against the regular expression, described below.
                #
                # This regular expression matches all values where the first group of
Severity: Minor
Found in lib/frecon/match_number.rb - About 1 day 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 a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(*args)
            if args.length == 1
                # Match `string' against the regular expression, described below.
                #
                # This regular expression matches all values for `string' where
Severity: Minor
Found in lib/frecon/position.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 read has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        def read(data, context = {})
            # `data` will be a string, so we need to convert it from JSON.
            data = JSON.parse(data)

            if context[:type] == :single && data.empty?
Severity: Minor
Found in lib/frecon/scraper.rb - About 2 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 create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def self.create(request, params, post_data = nil)
            post_data ||= process_json_request request

            if post_data.is_an? Array
                results = post_data.map do |post_data_item|
Severity: Minor
Found in lib/frecon/controller.rb - About 2 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 initialize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def initialize(args)
            if args.is_a?(String)
                # Match `args' against the regular expression, described below.
                #
                # This regular expression matches all values where the first group of
Severity: Minor
Found in lib/frecon/match_number.rb - About 1 hr to fix

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

            def self.resource_routes(base, name, controller)
                base.post "/#{name}" do
                    begin
                        controller.create request, params
                    rescue RequestError => e
    Severity: Minor
    Found in lib/frecon/routes.rb - About 1 hr to fix

      Method included has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def self.included(base)
                  resource_routes base, 'teams', TeamsController
                  resource_routes base, 'competitions', CompetitionsController
                  resource_routes base, 'matches', MatchesController
                  resource_routes base, 'records', RecordsController
      Severity: Minor
      Found in lib/frecon/routes.rb - About 1 hr to fix

        Method resource_routes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.resource_routes(base, name, controller)
                    base.post "/#{name}" do
                        begin
                            controller.create request, params
                        rescue RequestError => e
        Severity: Minor
        Found in lib/frecon/routes.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 create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def self.create(request, params, post_data = nil)
                    post_data ||= process_json_request request
        
                    if post_data.is_an? Array
                        results = post_data.map do |post_data_item|
        Severity: Minor
        Found in lib/frecon/controller.rb - About 1 hr to fix

          Method attribute_routes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.attribute_routes(base, name, controller)
                      model = controller.model
          
                      model_attribute_methods = model.class_variable_get(:@@attributes)
          
          
          Severity: Minor
          Found in lib/frecon/routes.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.update(request, params, post_data = nil)
                      raise RequestError.new(400, "Must supply a #{model_name.downcase} id!") unless params[:id]
          
                      post_data ||= process_json_request request
          
          
          Severity: Minor
          Found in lib/frecon/controller.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def get(model = nil, query = {})
                      # Turns something like 'team' into Team.
                      model = ('FReCon::' + model.capitalize).constantize if model.is_a?(String)
          
                      # The route name for the model branch.
          Severity: Minor
          Found in lib/frecon/scraper.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