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
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);
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"
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
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).
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
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',
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"));
Function initialize
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initialize() {
if (IE) {
container.find("*:not(input)").attr("unselectable", "on");
}
File merchant_actions.rb
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
module PaypalService
module MerchantActions
module_function
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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.
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 */
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]
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';
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
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;
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: [
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