sharetribe/sharetribe

View on GitHub

Showing 1,230 of 1,230 total issues

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

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

                          it('allows an initially blocked day', () => {
                            const state = reducer(stateTodayBlocked(), actions.unblockDay(TODAY));
                            expect(state.get('initial_blocked_dates').length).to.equal(1);
                            expect(state.get('blocked_dates').length).to.equal(1);
                            expect(hasChanges(state)).to.equal(true);
                      Severity: Major
                      Found in client/app/specs/ManageAvailabilityReducer.spec.js and 1 other location - About 5 hrs to fix
                      client/app/specs/ManageAvailabilityReducer.spec.js on lines 124..130

                      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 148.

                      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

                          it('allows an initially allowed day', () => {
                            const state = reducer(stateEmpty(), actions.unblockDay(TODAY));
                            expect(state.get('initial_blocked_dates').length).to.equal(0);
                            expect(state.get('blocked_dates').length).to.equal(0);
                            expect(hasChanges(state)).to.equal(false);
                      Severity: Major
                      Found in client/app/specs/ManageAvailabilityReducer.spec.js and 1 other location - About 5 hrs to fix
                      client/app/specs/ManageAvailabilityReducer.spec.js on lines 102..108

                      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 148.

                      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

                      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

                          File listings_controller.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class ListingsController < ApplicationController
                            class ListingDeleted < StandardError; end
                          
                            # Skip auth token check as current jQuery doesn't provide it automatically
                            skip_before_action :verify_authenticity_token, :only => [:close, :update, :follow, :unfollow]
                          Severity: Minor
                          Found in app/controllers/listings_controller.rb - About 5 hrs to fix

                            File form.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { Component } from 'react';
                            import PropTypes from 'prop-types';
                            import { Form, StyledSelect, FormField, Checkbox } from 'react-form';
                            import merge from 'lodash.merge';
                            import { t } from '../../../utils/i18n';
                            Severity: Minor
                            Found in client/app/components/sections/ListingWorkingHours/form.js - About 5 hrs to fix

                              Function thumbnailStripe has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ST.thumbnailStripe = function(images, opts) {
                                var container = $("#thumbnail-stripe");
                                var thumbnailTmpl = _.template($("#image-thumbnail-template").html());
                              
                                // Options
                              Severity: Major
                              Found in app/assets/javascripts/thumbnail_stripe.js - About 5 hrs to fix

                                Function utils has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                ST.utils = (function(_) {
                                
                                  function findNextIndex(arr, fn) {
                                    if(arr.length < 2) {
                                      return -1;
                                Severity: Major
                                Found in app/assets/javascripts/utils.js - About 5 hrs to fix

                                  Method get_conversation_statuses has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def get_conversation_statuses(conversation, is_author)
                                      statuses = if conversation.listing && !conversation.status.eql?("free")
                                        status_hash = {
                                          paid: -> { {
                                            both: [
                                  Severity: Major
                                  Found in app/helpers/transaction_helper.rb - About 5 hrs to fix

                                    File preauthorize_transactions_controller.rb has 383 lines of code (exceeds 250 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 5 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language