Showing 35 of 163 total issues
File posts_test.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { expect, sinon } from '../../helpers/utility';
import {
fetchPosts,
fetchEditPost,
fetchNewPost,
File projects_test.js
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { expect, sinon } from '../../helpers/utility';
import {
fetchProjects,
fetchProject,
fetchNewProject,
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<AppBar
showMenuIconButton={false}
title={config.authorName}
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (this.state.loading) {
return <section />;
}
Function default
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (state = [], action) {
switch (action.type) {
case FETCH_ITEMS:
return action.payload.items;
Function render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const headerLabel = this.props.params.id ? 'Update Project' : 'Create New Project';
const submitLabel = this.props.params.id ? 'Update' : 'Create';
const { handleSubmit, submitting, fields: { title, caption, sourceUrl, image, description } } = this.props;
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let publishActionIcon;
if (this.props.accepted) {
publishActionIcon = <ActionVisibilityOff name="in-visible-icon" />;
} else {
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (this.state.loading) {
return <section />;
}
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className={styles.root}>
<IconMenu
className={styles.list}
Function default
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (state = INITIAL_STATE, action) {
switch (action.type) {
case FETCH_POSTS_INFINITELY.REQUEST:
return { ...state, loading: true };
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const submitLabel = this.props.params.id ? 'Update' : 'Create';
const { handleSubmit, submitting, fields: { title, publishedAt, leadSentence } } = this.props;
return (
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { handleSubmit, submitting, fields: { name, image, description, introduction } } = this.props;
return (
<form className={styles.root} onSubmit={handleSubmit(this.handleSubmit)}>
Function render
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { handleSubmit, submitting, fields: { name, password, passwordConfirmation, email } } = this.props;
return(
<form onSubmit={handleSubmit(this.handleSubmit)} className={styles.root}>
<h2 className={styles.heading}>Sign Up</h2>
Function default
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (ComposedComponent) {
function mapStateToProps(state) {
return {
hasAlert: state.error.hasAlert,
message: state.error.message,
Function renderComponent
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderComponent() {
switch (this.props.item.targetType) {
case TARGET_TYPES.IMAGE:
return (
<Image
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<AppBar
showMenuIconButton={false}
title={config.authorName}
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let publishActionIcon;
let statusIcon;
if (this.props.accepted) {
publishActionIcon = <ActionVisibilityOff name="in-visible-icon" />;
Function default
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function(ComposedComponent) {
function mapStateToProps(state) {
return {
authenticated: state.auth.authenticated
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { handleSubmit, submitting, fields: { image, caption } } = this.props;
return (
<div className={styles.root}>
Function default
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function (state = [], action) {
switch (action.type) {
case FETCH_ITEMS:
return action.payload.items;
- 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"