Showing 12 of 32 total issues
Class SMACSSResolver
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class SMACSSResolver
def initialize(element_string = "", options = {})
log_with_prefix :input, "#{element_string} (options: #{options})", true
@skip_element = !! options[:skip_element]
Method index
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@ordered_entries = Entry.order("delivery_date desc")
unless params[:search].blank?
@ordered_entries = @ordered_entries.where('title LIKE ?', "%#{params[:search]}%")
Method import
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
@current_page = 1
@entry = Entry.find(params[:id])
wsid = Rails.application.secrets.toggle_workspace_id
api_token = Rails.application.secrets.toggle_api_token
Method index
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def index
@ordered_entries = Entry.order("delivery_date desc")
unless params[:search].blank?
@ordered_entries = @ordered_entries.where('title LIKE ?', "%#{params[:search]}%")
- 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 import
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import
@current_page = 1
@entry = Entry.find(params[:id])
wsid = Rails.application.secrets.toggle_workspace_id
api_token = Rails.application.secrets.toggle_api_token
- 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 update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@entry = Entry.find(params[:id])
if entry_params["customer_attributes"]["id"].present?
@customer = Customer.find(entry_params["customer_attributes"]["id"])
@entry.customer = @customer
Function onchange
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
document.getElementById('bill_image').onchange = function(i) {
if (this.files && this.files[0]) {
var reader = new FileReader();
Method update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
@entry = Entry.find(params[:id])
if entry_params["customer_attributes"]["id"].present?
@customer = Customer.find(entry_params["customer_attributes"]["id"])
@entry.customer = @customer
- 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 get_items_total
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_items_total(entry)
entry.items.map{|i| ((( i.id.present? ? (i.price * ( i.count == 0 ? 60 : i.count)) : 0 )/ 60.00) ).to_s.to_f.round(2)}.inject(0, :+)
end
- 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 get_tax_items_total
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_tax_items_total(entry)
entry.items.select { |item| !item.expense}.map{|i| ((( i.id.present? ? (i.price * ( i.count == 0 ? 60 : i.count)) : 0 )/ 60.00) ).to_s.to_f.round(2)}.inject(0, :+)
end
- 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 init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init
if self.has_attribute?(:item_date) && self.item_date.nil?
if self.entry.present? && self.entry.delivery_date.month != Date.today.month
self.item_date = self.entry.delivery_date
else
- 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 index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index
@customers = Customer.all.order('name asc')
@grouped_customers = @customers.group_by{|x| x.name[0,1]}
@customer_count = Customer.all.map{|e| e.entries.count}.max
@title = "Customers"
- 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"