moser/foxtrot_mike

View on GitHub

Showing 69 of 90 total issues

Function insert has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  insert: function(h, target, link) {
    h.find('a.inline_form_hide').bind('click', function(e) {
      target.show();
      h.remove();
      return false;
Severity: Minor
Found in app/assets/javascripts/inline_form.js - About 1 hr to fix

    Method group has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def group(flights, enable, &block)
        if enable
          flights = flights.dup
          while !flights.empty? do
            current = flights.first.aggregation_id
    Severity: Minor
    Found in app/helpers/filtered_flights_helper.rb - About 1 hr to fix

      Method create_accounting_entries has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def create_accounting_entries
          accounting_entries_without_validity_check.destroy_all
          if cost && cost_responsible
            plane_account = plane.financial_account_at(departure_date)
            flight_sum = cost.free_sum
      Severity: Minor
      Found in app/models/flight.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 soft_validate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def soft_validate
          self.problems = {}
          problems[:too_many_people] = {} if too_many_people_for_plane?
          problems[:seat2_is_not_an_instructor] = {} if seat2_not_an_instructor?
          problems[:launch_method_impossible] = {} if launch_method_impossible?
      Severity: Minor
      Found in app/models/abstract_flight.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 group has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def group(flights, enable, &block)
          if enable
            flights = flights.dup
            while !flights.empty? do
              current = flights.first.aggregation_id
      Severity: Minor
      Found in app/helpers/filtered_flights_helper.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

      Function parseUri has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function parseUri(str) {
          var    o   = parseUri.options,
              m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
              uri = {},
              i   = 14;
      Severity: Minor
      Found in app/assets/javascripts/app.js - About 1 hr to fix

        Method lvb_member_state has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def lvb_member_state(date = Date.today)
            unless primary_member
              :secondary
            else
              if active?
        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 format_currency has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def format_currency(i, show_unit = true)
            "#{(i < 0) ? '-' : ''}#{(i.abs/100.0).to_i},#{i.abs%100 < 10 ? "0" : ""}#{i.abs%100}#{ show_unit ? ' €' : ''}" unless i.nil? #TODO i18n/configurable
          end
        Severity: Minor
        Found in app/helpers/application_helper.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 distance has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def distance(str2)
            str1 = self.downcase
            str2 = str2.downcase
            if $KCODE =~ /^U/i
              unpack_rule = 'U*'
        Severity: Minor
        Found in lib/core_ext.rb - About 1 hr to fix

          Method show has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def show
              @airfield = Airfield.find(params[:airfield_id])
              authorize! :read, @airfield
              @date = parse_date(params[:filter], :date) || AbstractFlight.latest_departure(@airfield.flights).to_date
              if params[:as] == 'controller_log'
          Severity: Minor
          Found in app/controllers/main_log_books_controller.rb - About 1 hr to fix

            Function scrollable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    scrollable: function (element, index, meta, stack) {
                        var direction = converter[typeof (meta[3]) === "string" && meta[3].toLowerCase()] || converter.both;
                        var styles = (document.defaultView && document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(element, null) : element.currentStyle);
                        var overflow = {
                            x: scrollValue[styles.overflowX.toLowerCase()] || false,
            Severity: Minor
            Found in app/assets/javascripts/jquery_scrollintoview.js - About 1 hr to fix

              Method initialize has 28 lines of code (exceeds 25 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 1 hr to fix

                Method init has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def init
                    self.default_launch_method ||= "self_launch"
                    self.competition_sign ||= ""
                    self.seat_count = 1 if seat_count.nil?
                    self.has_engine = false if has_engine.nil?
                Severity: Minor
                Found in app/models/plane.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 finished= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def finished=(b)
                    unless !b || finished?
                      flights.each do |f|
                        f.update_attribute :accounting_session, self
                        f.accounting_entries.each do |e|
                Severity: Minor
                Found in app/models/accounting_session.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_json_dates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def parse_json_dates(obj)
                   if obj.is_a?(Hash)
                      obj.keys.each do |k|
                        obj[k] = parse_json_dates(obj[k])
                      end
                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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def update
                    model_by_id
                    authorize! :update, @model
                    if @model.update_attributes(params[model_name.underscore.to_sym])
                      unless request.xhr?
                Severity: Minor
                Found in app/controllers/resource_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 matches? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def matches?(flight, conditions = nil)
                    if flight.launch && flight.launch.is_a?(WireLaunch)
                      unless conditions
                        valid_at?(flight.departure) && matches?(flight, [ person_cost_category, wire_launcher_cost_category, cost_rule_conditions ].flatten)
                      else
                Severity: Minor
                Found in app/models/wire_launch_cost_rule.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 26 lines of code (exceeds 25 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

                  Consider simplifying this complex logical expression.
                  Open

                      if not_between_sr_and_ss?
                        sr = (from && from.srss? && from.srss.sunrise_i(departure_date)) ||-1
                        ss = (to && to.srss? && to.srss.sunset_i(departure_date)) ||-1
                        problems[:not_between_sr_and_ss] = { :sr => DayTime.format(sr), :ss => DayTime.format(ss) }
                      end
                  Severity: Major
                  Found in app/models/abstract_flight.rb - About 1 hr to fix

                    Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def create
                        @accounting_session = AccountingSession.find(params[:accounting_session_id])
                        authorize! :update, @accounting_session
                        if @accounting_session.finished?
                          redirect_to [ @accounting_session, :manual_accounting_entries ]
                    Severity: Minor
                    Found in app/controllers/manual_accounting_entries_controller.rb - About 55 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language