CartoDB/cartodb20

View on GitHub
app/controllers/admin/organizations_controller.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method settings_update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_update
    valid_password_confirmation
    attributes = params[:organization]

    if attributes.include?(:avatar_url) && valid_avatar_file?(attributes[:avatar_url])
Severity: Minor
Found in app/controllers/admin/organizations_controller.rb - About 1 hr to fix

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

      def settings_update
        valid_password_confirmation
        attributes = params[:organization]
    
        if attributes.include?(:avatar_url) && valid_avatar_file?(attributes[:avatar_url])
    Severity: Minor
    Found in app/controllers/admin/organizations_controller.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 display_signup_warnings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def display_signup_warnings
        warning = []
        warning << "Your organization has run out of quota" unless @organization.valid_disk_quota?
        warning << "Your organization has run out of seats" unless @organization.valid_builder_seats?
        unless warning.empty?
    Severity: Minor
    Found in app/controllers/admin/organizations_controller.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

    There are no issues that match your filters.

    Category
    Status