shammond42/higgins-catalog

View on GitHub

Showing 5 of 5 total issues

Method temporal_facet_menu_item has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def temporal_facet_menu_item(params, low, high, text=nil, default_menu_item=false)
Severity: Minor
Found in app/helpers/artifacts_helper.rb - About 35 mins to fix

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

      def question_byline(question)
        who = question.nickname.present? ? h(question.nickname) : "Anonymous"
    
        # respond_to is for ActionMailer which doesn't
        if self.respond_to?(:user_signed_in?) && user_signed_in?
    Severity: Minor
    Found in app/helpers/questions_helper.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 filter_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def filter_params
        if(params[:query] =~ DATE_RANGE_REGEX)
          params[:low_date] = $2
          params[:high_date] = $3
          params[:keyword] = params[:query].sub(DATE_RANGE_REGEX,'')
    Severity: Minor
    Found in app/controllers/artifacts_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 show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
        @artifact = Artifact.includes(:questions, :artifact_images).find_by_accession_number(params[:id])
    
        if @artifact.nil?
          not_found
    Severity: Minor
    Found in app/controllers/artifacts_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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        query = params[:query].present? ? params[:query] : ''
        # filter_params
        low_date = params[:low_date].present? ? params[:low_date].to_i : -10_000
        high_date = params[:high_date].present? ? params[:high_date].to_i : 10_000
    Severity: Minor
    Found in app/controllers/artifacts_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

    Severity
    Category
    Status
    Source
    Language