Showing 90 of 90 total issues
Class AbstractFlight
has 69 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractFlight < ActiveRecord::Base
Purposes = ['training', 'exercise', 'tow']
IncludeAll = [:liabilities]
before_save :replace_duplicates
before_save :destroy_launch
Class Person
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Person < ActiveRecord::Base
MemberStates = [ :active, :passive, :passive_with_voting_right, :donor ]
include UuidHelper
include Membership
File abstract_flight.rb
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "digest/sha2"
class AbstractFlight < ActiveRecord::Base
Purposes = ['training', 'exercise', 'tow']
IncludeAll = [:liabilities]
Method export
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def export(from, to)
CSV do |csv|
csv << ["callsign", "pilotname", "attendantname", "departuretime", "departurelocation", "arrivaltime", "arrivallocation", "flighttime", "landingcount", "starttype", "flightmode", "motorstart", "motorend", "towheight", "towtime", "chargemode", "invoiced", "comment", "towcallsign", "towpilotname", "ftid", "km", "planewkz", "planedesignation", "wid", "uidwinch", "attendantname2", "attendantname3", "offblock", "onblock"]
Flight.where("departure_date between ? and ?", from, to).order(:departure_date, :departure_i).each do |flight|
#callsign pilotname attendantname departuretime departurelocation arrivaltime arrivallocation
- 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 export
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export(from, to)
CSV do |csv|
csv << ["callsign", "pilotname", "attendantname", "departuretime", "departurelocation", "arrivaltime", "arrivallocation", "flighttime", "landingcount", "starttype", "flightmode", "motorstart", "motorend", "towheight", "towtime", "chargemode", "invoiced", "comment", "towcallsign", "towpilotname", "ftid", "km", "planewkz", "planedesignation", "wid", "uidwinch", "attendantname2", "attendantname3", "offblock", "onblock"]
Flight.where("departure_date between ? and ?", from, to).order(:departure_date, :departure_i).each do |flight|
#callsign pilotname attendantname departuretime departurelocation arrivaltime arrivallocation
Class AccountingSession
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class AccountingSession < ActiveRecord::Base
has_many :accounting_entries
has_many :flights, :order => "departure_date ASC, departure_date ASC"
has_many :first_debit_financial_accounts, class_name: 'FinancialAccount', foreign_key: 'first_debit_accounting_session_id'
Method initialize
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def initialize(airfield, date)
@no = NoController.new(I18n.t("views.no_controller"))
@controllers = []
@airfield = airfield
flights = airfield.flights.where(:departure_date => date).order("departure_i ASC")
- 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
Class ApplicationController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
layout 'application'
helper :all # include all helpers, all the time
#protect_from_forgery # See ActionController::RequestForgeryProtection for details
Method create
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create
model_new
authorize! :create, @model
if nested && nested_id
@model.send(:"#{nested}=", find_nested)
- 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 scrollintoview
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollintoview: function (options) {
/// <summary>Scrolls the first element in the set into view by scrolling its closest scrollable parent.</summary>
/// <param name="options" type="Object">Additional options that can configure scrolling:
/// duration (default: "fast") - jQuery animation speed (can be a duration string or number of milliseconds)
/// direction (default: "both") - select possible scrollings ("vertical" or "y", "horizontal" or "x", "both")
File person.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'csv'
class Person < ActiveRecord::Base
MemberStates = [ :active, :passive, :passive_with_voting_right, :donor ]
File app.js
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Parse = {
time_pattern: /([0-9]{1,2})(\.|:){0,1}([0-9]{2})/,
date_pattern_de: /([0-9]+)\.([0-9]+)\.([0-9]+)/,
date_pattern_en: /([0-9]+)(-|\/)([0-9]+)(-|\/)([0-9]+)/,
date_pattern_to_s: /([0-9]+)-([0-9]+)-([0-9]+)/,
Method initialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def initialize(account)
if account
if account.admin?
can :manage, :all
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 accepts_string_for
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def accepts_string_for(method, args = {})
class_name = self.reflect_on_association(method).class_name
method = method.to_s
options = { :parent_method => "name", :create => true, :ignore_case => true, :may_nil => true }.merge(args)
if options[:parent_method].is_a?(Array) && options[:parent_method].size > 1
Method manifest
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def manifest
record do |m|
#just so you can see what the variables are
# => "yoda/bob"
#p @name # yoda/bob
Method import
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def import
@accounting_session = AccountingSession.find(params[:accounting_session_id])
authorize! :update, @accounting_session
if file = params[:file]
begin
- 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 accepts_string_for
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def accepts_string_for(method, args = {})
class_name = self.reflect_on_association(method).class_name
method = method.to_s
options = { :parent_method => "name", :create => true, :ignore_case => true, :may_nil => true }.merge(args)
if options[:parent_method].is_a?(Array) && options[:parent_method].size > 1
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def self.import(hashes)
ActiveRecord::Base.transaction do
hashes.each do |hash|
begin
import_group(hash)
- 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_date_time_rec
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_date_time_rec(h)
add = {}
h.each do |k, v|
if v.is_a?(Hash)
parse_date_time_rec(v)
- 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 initialize
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(airfield, date)
@no = NoController.new(I18n.t("views.no_controller"))
@controllers = []
@airfield = airfield
flights = airfield.flights.where(:departure_date => date).order("departure_i ASC")