sharetribe/sharetribe

View on GitHub

Showing 700 of 1,230 total issues

Function draggable has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function draggable(element, onmove, onstart, onstop) {
        onmove = onmove || function () { };
        onstart = onstart || function () { };
        onstop = onstop || function () { };
        var doc = document;
Severity: Major
Found in app/assets/javascripts/admin2/spectrum.js - About 2 hrs to fix

    File report.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class StripeService::Report
    
      private
    
      attr_reader :tx, :exception
    Severity: Minor
    Found in app/services/stripe_service/report.rb - About 2 hrs to fix

      Method msg_type has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def msg_type(txn_type, payment_status, pending_reason, invoice_num)
              txn_type = txn_type.to_s.downcase
              status, reason = payment_status.to_s.downcase, pending_reason.to_s.downcase
              inv_type = Invnum.type(invoice_num) if invoice_num
      
      
      Severity: Minor
      Found in app/services/paypal_service/data_types/ipn.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 availability_per_hour_calculate_blocked_dates has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def availability_per_hour_calculate_blocked_dates
          return @availability_per_hour_raw_blocked_dates if defined?(@availability_per_hour_raw_blocked_dates)
      
          all_options = availability_per_hour_calculate_options_for_select
          result = []
      Severity: Minor
      Found in app/presenters/concerns/listing_availability_manage.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 availability_per_hour_calculate_options_for_select has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def availability_per_hour_calculate_options_for_select
          return @availability_per_hour_raw_options_for_select if defined?(@availability_per_hour_raw_options_for_select)
      
          result = {}
          current_day = nil
      Severity: Minor
      Found in app/presenters/concerns/listing_availability_manage.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 FastClick has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function FastClick(layer, options) {
              var oldOnClick;
      
              options = options || {};
      
      
      Severity: Major
      Found in app/assets/javascripts/fastclick.js - About 2 hrs to fix

        Function imageUploadElementManager has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        window.ST.imageUploadElementManager = function($container) {
          var empties = [];
          var uploadings = [];
          var previews = [];
        
        
        Severity: Major
        Found in app/assets/javascripts/image_uploader.js - About 2 hrs to fix

          Class PreauthorizeTransactionsController has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class PreauthorizeTransactionsController < ApplicationController
          
            before_action do |controller|
             controller.ensure_logged_in t("layouts.notifications.you_must_log_in_to_do_a_transaction")
            end
          Severity: Minor
          Found in app/controllers/preauthorize_transactions_controller.rb - About 2 hrs to fix

            Class TestimonialsService has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Admin::TestimonialsService
              attr_reader :community, :params
            
              def initialize(community:, params:)
                @params = params
            Severity: Minor
            Found in app/services/admin/testimonials_service.rb - About 2 hrs to fix

              Class TestimonialsService has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Admin2::TestimonialsService
                attr_reader :community, :params
              
                def initialize(community:, params:)
                  @params = params
              Severity: Minor
              Found in app/services/admin2/testimonials_service.rb - About 2 hrs to fix

                Function createOptionOrder has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var createOptionOrder = function(rowSelector) {
                
                    /**
                      Fetch all custom field rows and save them to a variable
                    */
                Severity: Major
                Found in app/assets/javascripts/admin/landing_page_editor.js - About 2 hrs to fix

                  Method topbar_props has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def topbar_props(community:, path_after_locale_change:, user: nil, search_placeholder: nil,
                                     locale_param: nil, current_path: nil, landing_page: false, host_with_port:)
                  
                      links = links(community: community, user: user, locale_param: locale_param, host_with_port: host_with_port)
                  
                  
                  Severity: Major
                  Found in app/view_utils/topbar_helper.rb - About 2 hrs to fix

                    Function initialize_update_account_info_form has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function initialize_update_account_info_form(locale, change_text, cancel_text, email_in_use_message, one_email_must_receive_notifications_message) {
                      $('.account-new-email-link').click(
                        function(event) {
                          event.preventDefault();
                          $('.account-new-email-link').hide();
                    Severity: Major
                    Found in app/assets/javascripts/kassi.js - About 2 hrs to fix

                      Function createOptionOrder has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        var createOptionOrder = function(rowSelector) {
                      
                          /**
                            Fetch all custom field rows and save them to a variable
                          */
                      Severity: Major
                      Found in app/assets/javascripts/admin/custom_fields.js - About 2 hrs to fix

                        Function orderManager has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        window.ST.orderManager = function(fieldMap) {
                          var utils = ST.utils;
                        
                          var byFieldId = _.curry(function(id, field) {
                            return field.id === id;
                        Severity: Major
                        Found in app/assets/javascripts/order_manager.js - About 2 hrs to fix

                          Function initFooter has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function initFooter() {
                          
                              $(document).off('click', '#new-footerLink-trigger');
                              $(document).on('click', '#new-footerLink-trigger', function(event) {
                                  var time = new Date().getTime(),
                          Severity: Major
                          Found in app/assets/javascripts/admin2/landing_pages.js - About 2 hrs to fix

                            Method marketplace_data has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def marketplace_data(cid, locale)
                                  community = Community.find(cid)
                                  primary_color = community.custom_color1
                                  twitter_handle = community.twitter_handle
                                  name_display_type = community.name_display_type
                            Severity: Major
                            Found in app/services/custom_landing_page/marketplace_data_store.rb - About 2 hrs to fix

                              Method do_create_preauth_payment has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def do_create_preauth_payment(tx, gateway_fields, seller_account)
                                      seller_id  = seller_account[:stripe_seller_id]
                                      payment_method_id = gateway_fields[:stripe_payment_method_id]
                              
                                      subtotal   = order_total(tx)
                              Severity: Major
                              Found in app/services/stripe_service/api/payments.rb - About 2 hrs to fix

                                Function utils has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                ST.utils = (function(_) {
                                
                                  function findNextIndex(arr, fn) {
                                    if(arr.length < 2) {
                                      return -1;
                                Severity: Minor
                                Found in app/assets/javascripts/utils.js - 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 update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def update
                                    if (params[:listing][:origin] && (params[:listing][:origin_loc_attributes][:address].empty? || params[:listing][:origin].blank?))
                                      params[:listing].delete("origin_loc_attributes")
                                      if @listing.origin_loc
                                        @listing.origin_loc.delete
                                Severity: Minor
                                Found in app/controllers/listings_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

                                Severity
                                Category
                                Status
                                Source
                                Language