moser/foxtrot_mike

View on GitHub

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
Severity: Major
Found in app/models/abstract_flight.rb - About 1 day to fix

    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
    Severity: Minor
    Found in app/models/person.rb - About 5 hrs to fix

      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]
      Severity: Minor
      Found in app/models/abstract_flight.rb - About 4 hrs to fix

        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
        Severity: Minor
        Found in app/models/vereinsflieger_export.rb - About 4 hrs to fix

        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
        Severity: Major
        Found in app/models/vereinsflieger_export.rb - About 3 hrs to fix

          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'
          
          
          Severity: Minor
          Found in app/models/accounting_session.rb - About 3 hrs to fix

            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")
            Severity: Minor
            Found in app/models/controller_log.rb - About 2 hrs to fix

            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
            
            
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 2 hrs to fix

              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)
              Severity: Minor
              Found in app/controllers/resource_controller.rb - About 2 hrs to fix

              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")
              Severity: Major
              Found in app/assets/javascripts/jquery_scrollintoview.js - About 2 hrs to fix

                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 ]
                
                
                Severity: Minor
                Found in app/models/person.rb - About 2 hrs to fix

                  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]+)/,
                  Severity: Minor
                  Found in app/assets/javascripts/app.js - About 2 hrs to fix

                    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
                    Severity: Minor
                    Found in app/models/ability.rb - About 2 hrs to fix

                    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
                    Severity: Major
                    Found in lib/string_acceptance.rb - About 2 hrs to fix

                      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
                      Severity: Minor
                      Found in lib/generators/rspec_haml_scaffold/rspec_haml_scaffold_generator.rb - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in app/controllers/manual_accounting_entries_controller.rb - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in lib/string_acceptance.rb - About 1 hr to fix

                        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)
                        Severity: Minor
                        Found in app/models/person.rb - About 1 hr to fix

                        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)
                        Severity: Minor
                        Found in app/controllers/application_controller.rb - About 1 hr to fix

                        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")
                        Severity: Minor
                        Found in app/models/controller_log.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language