Showing 76 of 76 total issues
Function Update
has 245 lines of code (exceeds 50 allowed). Consider refactoring. Open
const Update = (props) => {
const [loading, setLoading] = useState(false);
const [color, setColor] = useState(props.color.color);
const [confirmDelete, setConfirmDelete] = useState(false);
const [confirmLogout, setConfirmLogout] = useState(false);
Identical blocks of code found in 2 locations. Consider refactoring. Open
const mapStateToProps = (state) => {
return {
businessName: state.onboard.businessName,
ownerName: state.onboard.ownerName,
address: state.onboard.address,
- 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 160.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
const mapStateToProps = (state) => {
return {
businessName: state.onboard.businessName,
ownerName: state.onboard.ownerName,
address: state.onboard.address,
- 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 160.
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
Function AddLogo
has 178 lines of code (exceeds 50 allowed). Consider refactoring. Open
const AddLogo = (props) => {
const dispatch = useDispatch();
const [imageUrl, setImageUrl] = useState('');
const [loading, setLoading] = useState(false);
Function SaveCart
has 178 lines of code (exceeds 50 allowed). Consider refactoring. Open
const SaveCart = (props) => {
const dispatch = useDispatch()
useEffect(() => {
dispatch(actionCreators.getCurrentUser())
Function RegistrationForm
has 174 lines of code (exceeds 50 allowed). Consider refactoring. Open
const RegistrationForm = (props) => {
const [confirmDirty, setConfirmDirty] = useState(false);
const handleSubmit = (e) => {
e.preventDefault();
props.form.validateFieldsAndScroll((err, values) => {
Function WelcomeScreen
has 158 lines of code (exceeds 50 allowed). Consider refactoring. Open
const WelcomeScreen = (props) => {
return (
<div className='welcomeForm' data-testid='welcomeFormWrapper'>
<img src={logo} alt='logo' />
<h1 data-testid='welcomeHeader'>Welcome</h1>
Function Stripe
has 153 lines of code (exceeds 50 allowed). Consider refactoring. Open
const Stripe = (props) => {
const { cartId } = props;
const [clientId, setClientId] = useState('');
const [stripeId, setStripeId] = useState('');
const cartContents = useSelector((state) => state.savedCart);
Function SetNewPassword
has 153 lines of code (exceeds 50 allowed). Consider refactoring. Open
const SetNewPassword = (props) => {
const dispatch = useDispatch();
const { isLoading } = useSelector((state) => state.user);
const [confirmDirty, setConfirmDirty] = useState(false);
Function Login
has 152 lines of code (exceeds 50 allowed). Consider refactoring. Open
const Login = (props) => {
const handleSubmit = (e) => {
e.preventDefault();
props.form.validateFieldsAndScroll((err, values) => {
const payload = {
Function SingleProductView
has 141 lines of code (exceeds 50 allowed). Consider refactoring. Open
function SingleProductView(props) {
//productState is used only for the values that is submitted to the cart
const [fullProduct, setFullProduct] = useState([])
const [productState, setProductState] = useState([
{
Function UpdateItem
has 129 lines of code (exceeds 50 allowed). Consider refactoring. Open
function UpdateItem(props) {
const dispatch = useDispatch();
const itemId = props.match.params.id;
const sellerId = localStorage.getItem('sellerId');
const [message, setMessage] = useState();
File Update.js
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { withFormik, Form, Field, ErrorMessage } from 'formik';
import * as Yup from 'yup';
import { connect } from 'react-redux';
File actionCreators.js
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as types from './actionTypes';
import AxiosAuth from '../components/Auth/axiosWithAuth';
import axios from 'axios';
const getUserUrl = 'https://shopping-cart-be.herokuapp.com/api/store/';
export const updateForm = (details) => ({
Function AddVariants
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const AddVariants = ({
formData,
setFormData,
productData,
setProductData,
- 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 ProfileView
has 114 lines of code (exceeds 50 allowed). Consider refactoring. Open
const ProfileView = () => {
const [ logo, setLogo ] = useState();
const [ address, setAddress ] = useState();
const [ secondAddress, setSecondAddress ] = useState();
const [ businessName, setBusinessName ] = useState();
Function ResetPassword
has 109 lines of code (exceeds 50 allowed). Consider refactoring. Open
const ResetPassword = (props) => {
const dispatch = useDispatch();
const { isLoading } = useSelector((state) => state.user);
const handleSubmit = (e) => {
Identical blocks of code found in 2 locations. Consider refactoring. Open
AxiosAuth()
.get('https://shopping-cart-be.herokuapp.com/api/store/sales')
.then((res) => {
setLoading(false);
dispatch({ type: types.GET_SALES_HISTORY, payload: res.data });
- 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 101.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
AxiosAuth()
.get('https://shopping-cart-be.herokuapp.com/api/store/sales')
.then((res) => {
setLoading(false);
dispatch({ type: types.GET_SALES_HISTORY, payload: res.data });
- 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 101.
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 CartTable.js
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState, useCallback, useEffect } from 'react';
import * as creators from '../../state/actionCreators';
import { useDispatch } from 'react-redux';
import times_icon from '../../images/times-icon.svg';
import equals_icon from '../../images/equals-icon.svg';