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
Class ArticlesController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ArticlesController < ApplicationController
before_action :find_article_by_params, only: [
:show,
:edit,
:update,
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
- Read upRead up
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
- Read upRead up
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}/
- Read upRead up
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"