Showing 6 of 8 total issues
Class Edition
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Edition
include Widgets
attr_writer :day_of_the_week
Class Ticker
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Ticker
attr_writer :request, :name, :price
attr_reader :symbol, :key
ALIAS = {
Function handler
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.handler = async event => {
const key = process.env["MAILERLITE_API_KEY"];
const request = require("axios");
const Sentry = require("@sentry/node");
Method post
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def post
return unless edition.send?
retries ||= 0
- 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 variant1
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def variant1(stock)
variant = ''
stock.stats.each do |key, value|
next if value == '—'
- 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 build_index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_index(filename = 'index.html')
s3 = Services::S3.new(@bucket)
archive = s3.list({ prefix: FOLDER }).map do |file|
next if file.key == "#{FOLDER}/index.html"
- 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"