sharetribe/sharetribe

View on GitHub

Showing 700 of 1,230 total issues

File transaction_helper.rb has 460 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module TransactionHelper

  def icon_for(status)
    case status
    when "confirmed"
Severity: Minor
Found in app/helpers/transaction_helper.rb - About 7 hrs to fix

    File community.rb has 455 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Community < ApplicationRecord # rubocop:disable Metrics/ClassLength
    
      require 'compass'
      require 'sass/plugin'
    
    
    Severity: Minor
    Found in app/models/community.rb - About 6 hrs to fix

      Function initializeManageMembers has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

      window.ST.initializeManageMembers = function() {
        var DELAY = 800;
      
        function createCheckboxAjaxRequest(streams, url, allowedKey, disallowedKey) {
          var ajaxRequest = Bacon.combineAsArray(streams).changes().debounce(DELAY).skipDuplicates(_.isEqual).map(function(valueObjects) {
      Severity: Minor
      Found in app/assets/javascripts/admin/manage_members.js - About 6 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 initializeSenderEmailForm has 170 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        module.initializeSenderEmailForm = function(userEmail, statusCheckUrl, resendVerificationEmailUrl) {
          var lastEmailState;
      
          var updateState = function(currentEmailState) {
            return ST.utils.baconStreamFromAjaxPolling(
      Severity: Major
      Found in app/assets/javascripts/admin/emails.js - About 6 hrs to fix

        Function add_validator_methods has 167 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function add_validator_methods() {
        
          /**
            Take string representing number with either dot (.) or comma (,)
            as decimal separator and get back number
        Severity: Major
        Found in app/assets/javascripts/kassi.js - About 6 hrs to fix

          Class TransactionsPresenter has 47 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Admin2::TransactionsPresenter
            include Collator
          
            private
          
          
          Severity: Minor
          Found in app/presenters/admin2/transactions_presenter.rb - About 6 hrs to fix

            File image_uploader.js has 434 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            window.ST = window.ST || {};
            
            /**
              Returns a new element for image uploading/preview
            */
            Severity: Minor
            Found in app/assets/javascripts/image_uploader.js - About 6 hrs to fix

              Function initializeListingShapeForm has 157 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              window.ST.initializeListingShapeForm = function(formId) {
                $(formId).validate({
                  errorPlacement: function(error, element) {
                    if (element.hasClass("js-custom-unit-kind-radio")) {
                      error.appendTo($(".js-custom-unit-kind-container"));
              Severity: Major
              Found in app/assets/javascripts/admin/listing_shapes.js - About 6 hrs to fix

                Class TransactionsPresenter has 45 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Admin::TransactionsPresenter
                  include Collator
                
                  private
                
                
                Severity: Minor
                Found in app/presenters/admin/transactions_presenter.rb - About 6 hrs to fix

                  Function render has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const { location, marketplace_color1: marketplaceColor1 } = { ...DEFAULT_CONTEXT, ...this.props.marketplace };
                      const { loggedInUsername } = this.props.user || {};
                      const isAdmin = !!(this.props.user && this.props.user.isAdmin && loggedInUsername);
                  
                  
                  Severity: Major
                  Found in client/app/components/sections/Topbar/Topbar.js - About 6 hrs to fix

                    Method conversation_icon_and_status has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def conversation_icon_and_status(status, is_author, other_party_name, waiting_feedback, status_meta)
                        icon_waiting_you = icon_tag("alert", ["icon-fix-rel", "waiting-you"])
                        icon_waiting_other = icon_tag("clock", ["icon-fix-rel", "waiting-other"])
                    
                        # Split "confirmed" status into "waiting_feedback" and "completed"
                    Severity: Major
                    Found in app/helpers/transaction_helper.rb - About 6 hrs to fix

                      File application_controller.rb has 422 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'will_paginate/array'
                      
                      class ApplicationController < ActionController::Base
                      
                        module DefaultURLOptions
                      Severity: Minor
                      Found in app/controllers/application_controller.rb - About 6 hrs to fix

                        File person.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'json'
                        require 'rest_client'
                        require "open-uri"
                        
                        # This class represents a person (a user of Sharetribe).
                        Severity: Minor
                        Found in app/models/person.rb - About 6 hrs to fix

                          File transactions_controller.rb has 418 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class TransactionsController < ApplicationController
                          
                            before_action only: [:show] do |controller|
                              controller.ensure_logged_in t("layouts.notifications.you_must_log_in_to_view_your_inbox")
                            end
                          Severity: Minor
                          Found in app/controllers/transactions_controller.rb - About 6 hrs to fix

                            File stripe_form3.js has 416 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /* jshint sub: false */
                            /* Sripe API version 2019-02-19 */
                            window.ST = window.ST || {};
                            window.ST.stripe_form_i18n = window.ST.stripe_form_i18n || {
                              'account_number' : 'Account number',
                            Severity: Minor
                            Found in app/assets/javascripts/stripe_form3.js - About 6 hrs to fix

                              Function initializeListingShapeForm has 148 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              window.ST.initializeListingShapeForm = function(formId) {
                                  $(formId).validate({
                                      errorPlacement: function(error, element) {
                                          if (element.hasClass("js-custom-unit-kind-radio")) {
                                              error.appendTo($(".js-custom-unit-kind-container"));
                              Severity: Major
                              Found in app/assets/javascripts/admin2/listing_shapes.js - About 5 hrs to fix

                                Function initialize has 148 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        function initialize() {
                                
                                            if (IE) {
                                                container.find("*:not(input)").attr("unselectable", "on");
                                            }
                                Severity: Major
                                Found in app/assets/javascripts/admin2/spectrum.js - About 5 hrs to fix

                                  File merchant_actions.rb has 405 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  module PaypalService
                                    module MerchantActions
                                  
                                      module_function
                                  
                                  
                                  Severity: Minor
                                  Found in app/services/paypal_service/merchant_actions.rb - About 5 hrs to fix

                                    File fastclick.js has 401 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    ;(function () {
                                        'use strict';
                                    
                                        /**
                                         * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
                                    Severity: Minor
                                    Found in app/assets/javascripts/fastclick.js - About 5 hrs to fix

                                      File listing_form.js has 400 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      window.ST = window.ST || {};
                                      
                                      (function(module) {
                                        /* global disable_submit_button */
                                        /* global set_textarea_maxlength */
                                      Severity: Minor
                                      Found in app/assets/javascripts/listing_form.js - About 5 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language