frc-frecon/frecon

View on GitHub
lib/frecon/routes.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method has too many lines. [35/30]
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 by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

      There are no issues that match your filters.

      Category
      Status