Class Pantograph
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Pantograph < ActiveRecord::Base
include Pantographable
belongs_to :pantographer
- Create a ticketCreate a ticket
Method calculate_after
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate_after(current)
return last_text if current == last_text
alphabet = self.alphabet.split('')
alphabet_without_space = alphabet - [' ']
- Read upRead up
- Create a ticketCreate a ticket
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 calculate_before
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate_before(current)
return first_text if current == first_text
alphabet = self.alphabet.split('')
return alphabet.first if current.blank?
- Read upRead up
- Create a ticketCreate a ticket
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 calculate_after
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.calculate_after(current)
return last_text if current == last_text
alphabet = self.alphabet.split('')
alphabet_without_space = alphabet - [' ']
- Create a ticketCreate a ticket
Method tweet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.tweet(text)
# Replace @ and # characters before tweeting to avoid spamming other users
# These characters are unchanged as far as Pantography itself goes; they are stored intact.
text = self.unspamify(text)
tweet = authenticated_twitter_client.update(text)
- Read upRead up
- Create a ticketCreate a ticket
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 skipped
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.skipped(text)
# Calculate the number of pantographs that have been skipped due to repeated spaces.
# This is basically a triangular function on the length of the string - 1.
# So, for a string that is five letters long, we do 4 + 3 + 2 + 1.
return 0 if text.length == 1 && alphabet.index(text.last) > alphabet.index(' ')
- Read upRead up
- Create a ticketCreate a ticket
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"