madebyhiro/codem-schedule

View on GitHub

Showing 4 of 6 total issues

Method search has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def search(jobs, query)
      query.split(' ').each do |part|
        field, value = part.split(':')
        value = value.to_s

Severity: Minor
Found in app/models/job_search.rb - About 1 hr to fix

    Method search has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def search(jobs, query)
          query.split(' ').each do |part|
            field, value = part.split(':')
            value = value.to_s
    
    
    Severity: Minor
    Found in app/models/job_search.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 wrapped_button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def wrapped_button(*args, &block)
        template.content_tag :div, class: 'form-actions' do
          options = args.extract_options!
          loading = object.new_record? ? I18n.t('simple_form.creating') : I18n.t('simple_form.updating')
          options[:"data-loading-text"] = [loading, options[:"data-loading-text"]].compact
    Severity: Minor
    Found in lib/simple_form_extensions.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, q: params[:q] },  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

    Severity
    Category
    Status
    Source
    Language