huerlisi/bookyt

View on GitHub

Showing 54 of 54 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    left: dim.e.rect.left - (dim.s.rect.left + dim.s.border.left) - options.viewPadding.x,
Severity: Major
Found in app/assets/javascripts/jquery.scrollintoview.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jquery.scrollintoview.js on lines 118..118

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    top: dim.e.rect.top - (dim.s.rect.top + dim.s.border.top) - options.viewPadding.y - 600,
Severity: Major
Found in app/assets/javascripts/jquery.scrollintoview.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jquery.scrollintoview.js on lines 120..120

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function updateLineItemPrice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function updateLineItemPrice(lineItem) {
  var list = lineItem.parent();
  var reference_code = lineItem.find(":input[name$='[reference_code]']").val();
  var quantity = lineItem.find(":input[name$='[quantity]']").val();
  var after_saldo_line_item = lineItem.prev().hasClass('saldo_line_item');
Severity: Minor
Found in app/assets/javascripts/bookyt.js - 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 price has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def price
    # If a price is set, use it
    return self[:price] unless self[:price].blank?

    # If a reference_code is given...
Severity: Minor
Found in app/models/line_item.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 overdue? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def overdue?
    return true if state == 'booked' and due_date < Date.today
    return true if state == 'reminded' and (reminder_due_date.nil? or reminder_due_date < Date.today)
    return true if state == '2xreminded' and (second_reminder_due_date.nil? or second_reminder_due_date < Date.today)
    return true if state == '3xreminded' and (third_reminder_due_date.nil? or third_reminder_due_date < Date.today)
Severity: Minor
Found in app/models/invoice.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 to_csv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def to_csv(options={})
    self.class.csv_columns(options).map { |curr_col|
      curr_col = curr_col.to_s

      #Its a chain of method calls, on intermediary nil, just return nil
Severity: Minor
Found in lib/acts_as_csv.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 xbooking_parameters has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def xbooking_parameters(params = {})
    # Prepare parameters set by template
    booking_params = attributes.reject!{|key, value| !["title", "comments", "credit_account_id", "debit_account_id"].include?(key)}

    # Calculate amount
Severity: Minor
Found in app/models/charge_booking_template.rb - About 1 hr to fix

    Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        @booking = Booking.new(params[:booking])
    
        if current_tenant.vat_obligation?
          @vat_full_booking = Booking.new(params[:vat_full_booking])
    Severity: Minor
    Found in app/controllers/expenses_controller.rb - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                              fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal));
      Severity: Minor
      Found in app/assets/javascripts/accounting.js and 1 other location - About 55 mins to fix
      app/assets/javascripts/accounting.js on lines 305..305

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              var opts = defaults(
                      (isObject(symbol) ? symbol : {
                          symbol : symbol,
                          precision : precision,
                          thousand : thousand,
      Severity: Minor
      Found in app/assets/javascripts/accounting.js and 1 other location - About 55 mins to fix
      app/assets/javascripts/accounting.js on lines 325..334

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              var opts = defaults(
                      (isObject(symbol) ? symbol : {
                          symbol : symbol,
                          precision : precision,
                          thousand : thousand,
      Severity: Minor
      Found in app/assets/javascripts/accounting.js and 1 other location - About 55 mins to fix
      app/assets/javascripts/accounting.js on lines 287..296

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal));
      Severity: Minor
      Found in app/assets/javascripts/accounting.js and 1 other location - About 55 mins to fix
      app/assets/javascripts/accounting.js on lines 358..358

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

            def render(item_container)
              if options[:is_subnavigation]
                ul_class = "dropdown-menu"
              else
                ul_class = "nav"
      Severity: Minor
      Found in lib/simple_navigation/renderer/bootstrap_topbar_list.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

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

        def xbooking_parameters(params = {})
          # Prepare parameters set by template
          booking_params = attributes.reject!{|key, value| !["title", "comments", "credit_account_id", "debit_account_id"].include?(key)}
      
          # Calculate amount
      Severity: Minor
      Found in app/models/charge_booking_template.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

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

        def update
          @user = User.find(params[:id])
      
          # Don't try to update password if not provided
          if params[:user][:password].blank?
      Severity: Minor
      Found in app/controllers/users_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

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

        def to_s(format = :default)
          return "" if (title.blank? or rate_to_s.blank?)
      
          case format
            when :long
      Severity: Minor
      Found in app/models/charge_rate.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

      Function formatMoney has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          var formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) {
      Severity: Minor
      Found in app/assets/javascripts/accounting.js - About 45 mins to fix

        Function formatColumn has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            lib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {
        Severity: Minor
        Found in app/assets/javascripts/accounting.js - About 45 mins to fix

          Method footer has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def footer(sender, bank_account, vat_number, uid_number, vesr_included)
          Severity: Minor
          Found in app/prawn/debit_invoice_document.rb - About 35 mins to fix

            Method set_by_date has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def set_by_date
                return unless user_signed_in?
            
                return if params[:years]
            
            
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 35 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