AyuntamientoMadrid/transparencia

View on GitHub

Showing 28 of 58 total issues

Avoid too many return statements within this method.
Open

    return 'V' if spokesperson?
Severity: Major
Found in app/models/person.rb - About 30 mins to fix

    Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        attrs = profile_upload_params.merge(author: current_administrator,
                                            check_for_file: true)
        @profile_upload = ProfileUpload.new(attrs)
    
    
    Severity: Minor
    Found in app/controllers/admin/profile_uploads_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

    Method job_level_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def job_level_code
        return 'C' if councillor?
        return 'D' if director?
        return 'E' if temporary_worker?
        return 'F' if public_worker?
    Severity: Minor
    Found in app/models/person.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

    Method breadcrumb_person_title_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def breadcrumb_person_title_link(person)
        if person.councillor?
          link_to t("people.councillors.title"), councillors_people_path
        elsif person.director?
          link_to t("people.directors.title"), directors_people_path
    Severity: Minor
    Found in app/helpers/people_helper.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

    Method sortable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def sortable(column, title = nil)
        title ||= column.titleize
        css_class = column == sort_column ? "current #{sort_direction}" : nil
        direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
        link_to title, {:sort => column, :direction => direction}, {:class => css_class}
    Severity: Minor
    Found in app/helpers/application_helper.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

    Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        attrs = activities_upload_params.merge(author: current_administrator,
                                               check_for_file: true)
        @activities_upload = ActivitiesUpload.new(attrs)
    
    
    Severity: Minor
    Found in app/controllers/admin/activities_uploads_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

    Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        attrs = assets_upload_params.merge(author: current_administrator,
                                           check_for_file: true)
        @assets_upload = AssetsUpload.new(attrs)
    
    
    Severity: Minor
    Found in app/controllers/admin/assets_uploads_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

    Method parse_spanish_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_spanish_date(str)
          return nil if str.blank?
          day, month, year = str.to_s.split('/')
          return nil unless day.present? && month.present? && year.present?
    
    
    Severity: Minor
    Found in lib/importers/base_importer.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