Showing 150 of 150 total issues
Function delay
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.List.prototype.plugins.delay = function(locals, options) {
var list = this;
this.searchTimeout = undefined;
Method update_order_amounts
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_order_amounts
return if not params[:order_articles]
# where to leave remainder during redistribution
rest_to = []
rest_to << :tolerance if params[:rest_to_tolerance]
Method finish
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def finish
@order = Order.find params[:id]
@order_info = params[:order_info] || {}
@order_info[:sender_name] ||= @current_user.name
@order_info[:order_contact_name] ||= @current_user.name
- 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_article_and_price!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_article_and_price!(order_article_attributes, article_attributes, price_attributes = nil)
OrderArticle.transaction do
# Updates self
self.update_attributes!(order_article_attributes)
- 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 parse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(file, opts={})
articles, outlisted_articles = Array.new, Array.new
row_index = 2
data = read_file file, opts
col_sep = csv_guess_col_sep data
- 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 units_history_line
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def units_history_line(order_article, order=nil, options={})
order ||= order_article.order
if order.open?
nil
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 update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
# turn recurring rules into something palatable
if p = params[:config][:order_schedule]
for k in [:pickup, :ends] do
if p[k] and p[k][:recurr]
- 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 ensure_file_format
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.ensure_file_format(file, opts={})
# catch original filename from uploaded files (see `Http::UploadedFile`)
if file.respond_to?(:tempfile)
filename = file.original_filename
file = file.tempfile
Method parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(file, opts={})
articles, outlisted_articles = Array.new, Array.new
row_index = 2
data = read_file file, opts
col_sep = csv_guess_col_sep data
Method show
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@order= Order.find(params[:id])
@view = (params[:view] or 'default').gsub(/[^-_a-zA-Z0-9]/, '')
@partial = case @view
when 'default' then 'articles'
Function reset
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.List.prototype.plugins.reset = function(locals, options) {
var list = this;
var init = {
start: function(options) {
Method update_synchronized
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_synchronized
begin
Article.transaction do
# delete articles
if params[:outlisted_articles]
Method export
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.export(article_data, search_path=[])
begin
src = check_export article_data, search_path
rescue OrderdocException => e
return {error: e.message}
Method shared_article_changed?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def shared_article_changed?(supplier = self.supplier)
# skip early if the timestamp hasn't changed
shared_article = self.shared_article(supplier)
unless shared_article.nil? or self.shared_updated_on == shared_article.updated_on
- 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
Function autologin_foodsoft
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function autologin_foodsoft()
{
global $db;
$foodsoftUser = get_foodsoft_user();
- 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 []=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def []=(key, value)
key = key.to_sym
return false unless allowed_key?(key)
value = normalize_value value
# then update database
- 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 ordergroup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ordergroup
@user = @current_user
@ordergroup = @user.ordergroup
unless @ordergroup.nil?
- 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 notify
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def notify
notification = AdyenNotification.log(params)
logger.debug 'foodsoft_adyen: notify'
if notification.successful_authorisation?
data = decode_notification_data(notification.merchant_reference)
Method shared_article_changed?
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shared_article_changed?(supplier = self.supplier)
# skip early if the timestamp hasn't changed
shared_article = self.shared_article(supplier)
unless shared_article.nil? or self.shared_updated_on == shared_article.updated_on
Method sum
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sum(type = :gross)
total = 0
if type == :net || type == :gross || type == :fc
for oa in order_articles.ordered.includes(:article, :article_price)
quantity = oa.units * oa.price.unit_quantity