Showing 19 of 62 total issues
Function render
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const props = this.props;
return (
File FormDemo.story.tsx
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import { FormContainer } from '../src/components/form/FormContainer';
import { FormItem } from '../src/components/form/FormItem';
Function createIconToggle
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function createIconToggle(activeIcon: string, inactiveIcon: string) {
return class extends React.Component<ToggleFormProps> {
getColorType(): ColorType {
if (this.props.disabled) {
- 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 createIconToggle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createIconToggle(activeIcon: string, inactiveIcon: string) {
return class extends React.Component<ToggleFormProps> {
getColorType(): ColorType {
if (this.props.disabled) {
Function wrapWithContainer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wrapWithContainer<T>(node: React.ReactNode, props: ListFormProps<T>) {
const hasAddButton =
props.addText !== undefined &&
props.default !== undefined &&
!props.readonly && !props.disabled;
Function getColorContext
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
getColorContext(type: ColorType): ColorContext {
if (type === 'primary') {
return {
color: this.white,
backgroundColor: this.primary,
Function createTextForm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const createTextForm = (textType: TextType) =>
(props: TextFormProps) => {
if (props.readonly && !props.disabled) {
return <div>{props.value}</div>;
}
- 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 getIconText
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getIconText(config: StyleConfig, props: IconTextProps) {
const iconCell = (
<FixedCell>
<Row>
{props.icon}
Function getFloatStyle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function getFloatStyle(level: FloatLevel): object {
if (level === 1) {
return LEVEL1_STYLE;
}
- 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 wrapWithContainer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function wrapWithContainer<T>(node: React.ReactNode, props: ListFormProps<T>) {
const hasAddButton =
props.addText !== undefined &&
props.default !== undefined &&
!props.readonly && !props.disabled;
- 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
Avoid too many return
statements within this function. Open
return LEVEL7_STYLE;
Avoid too many return
statements within this function. Open
return {
color: 'inherit',
backgroundColor: 'transparent',
};
Avoid too many return
statements within this function. Open
return LEVEL6_STYLE;
Avoid too many return
statements within this function. Open
return 'inherit';
Avoid too many return
statements within this function. Open
return LEVEL5_STYLE;
Avoid too many return
statements within this function. Open
return this.fontColor;
Avoid too many return
statements within this function. Open
return getHeading1Style(config, props);
Avoid too many return
statements within this function. Open
return {};
Avoid too many return
statements within this function. Open
return LEVEL8_STYLE;