orientation/orientation

View on GitHub

Showing 5 of 5 total issues

Class Article has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

class Article < ApplicationRecord
  include Dateable
  include PgSearch

  extend ActionView::Helpers::DateHelper
Severity: Minor
Found in app/models/article.rb - About 4 hrs to fix

    Class ArticlesController has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ArticlesController < ApplicationController
      before_action :find_article_by_params, only: [
        :show,
        :edit,
        :update,
    Severity: Minor
    Found in app/controllers/articles_controller.rb - About 3 hrs to fix

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

        def valid_article?(link)
          link = safe_url_parser.path unless internal_link?(link)
          return false if link.nil?
      
          slug = link.split('/').last
      Severity: Minor
      Found in app/helpers/html_with_rouge.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 link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def link(link, title, content)
          if internal_link?(link) && !valid_article?(link)
            class_attribute = "class='#{article_status(link)}'"
          end
          title_attribute = "title='#{title}'" if title
      Severity: Minor
      Found in app/helpers/html_with_rouge.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 preprocess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def preprocess(full_document)
          # matches [[Article Title]] or [[article-title]] relative
          # links, see https://regex101.com/r/aR5bS0/1
          pattern = /\[{2}(.*?)\]{2}/
      
      
      Severity: Minor
      Found in app/helpers/html_with_rouge.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