Showing 12 of 21 total issues
File TransactionForm.jsx
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react";
import Select from 'react-select';
import Fuse from 'fuse.js';
Function connect
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect() {
// Initialize the table
const table = $('#transactions').DataTable({
processing: true,
serverSide: true,
Function render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { step, action, peer } = this.state;
const { peers, penning } = this.props;
const errors = this.errors();
Method sanitize_params
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_params(params)
# Parsing according to https://datatables.net/manual/server-side
clean = {
draw: params.require(:draw).to_i,
start: params.require(:start).to_i,
- Read upRead up
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 sanitize_params
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sanitize_params(params)
# Parsing according to https://datatables.net/manual/server-side
clean = {
draw: params.require(:draw).to_i,
start: params.require(:start).to_i,
Function errors
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
errors() {
const { amount, action, message, peer } = this.state;
const { peers, user_name, balance, penning } = this.props;
const errors = {};
- Read upRead up
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 render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { step, action, peer } = this.state;
const { peers, penning } = this.props;
const errors = this.errors();
- Read upRead up
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 errors
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
errors() {
const { amount, action, message, peer } = this.state;
const { peers, user_name, balance, penning } = this.props;
const errors = {};
Function buttonClass
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
buttonClass(action) {
const { action: activeAction, penning } = this.props;
const c = ['inline-flex items-center py-2 px-4 text-sm font-medium focus:outline-none border focus:z-10 focus:ring-4'];
if((penning && (action === ActionType.Take)) || (!penning && (action === ActionType.Request))) {
- Read upRead up
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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@transaction = Transaction.new(transaction_params)
@transaction.reverse if @transaction.amount.negative?
@transaction = Request.new(@transaction.info) if action_param[:action].to_sym == :request
- Read upRead up
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 transaction_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def transaction_params
t = params.require(:transaction).permit(:debtor, :creditor, :message, :euros, :cents, :id_at_client)
{
debtor: t[:debtor] ? User.find_by(name: t[:debtor]) : User.zeus,
- Read upRead up
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 cancel!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cancel!
return unless open?
Notification.create! user: creditor, message: cancelled_message unless issuer == creditor
Notification.create! user: debtor, message: cancelled_message unless issuer == debtor
- Read upRead up
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"