koiketakayuki/great-work

View on GitHub

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 (
Severity: Major
Found in stories/FormDemo.story.tsx - About 4 hrs to fix

    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';
    Severity: Minor
    Found in stories/FormDemo.story.tsx - About 2 hrs to fix

      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) {
      Severity: Minor
      Found in src/components/form/createIconToggle.tsx - About 2 hrs to fix

      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) {
      Severity: Minor
      Found in src/components/form/createIconToggle.tsx - About 1 hr to fix

        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;
        Severity: Minor
        Found in src/components/form/ListForm.tsx - About 1 hr to fix

          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,
          Severity: Minor
          Found in src/config/DefaultStyleConfig.ts - About 1 hr to fix

            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>;
                }
            Severity: Minor
            Found in src/components/form/createTextForm.tsx - About 1 hr to fix

            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}
            Severity: Minor
            Found in src/components/IconText.tsx - About 1 hr to fix

              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;
                }
              
              
              Severity: Minor
              Found in src/lib/getFloatStyle.ts - About 45 mins to fix

              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;
              Severity: Minor
              Found in src/components/form/ListForm.tsx - About 45 mins to fix

              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;
              Severity: Major
              Found in src/lib/getFloatStyle.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return {
                      color: 'inherit',
                      backgroundColor: 'transparent',
                    };
                Severity: Major
                Found in src/config/DefaultStyleConfig.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return LEVEL6_STYLE;
                  Severity: Major
                  Found in src/lib/getFloatStyle.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return 'inherit';
                    Severity: Major
                    Found in src/config/DefaultStyleConfig.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return LEVEL5_STYLE;
                      Severity: Major
                      Found in src/lib/getFloatStyle.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return this.fontColor;
                        Severity: Major
                        Found in src/config/DefaultStyleConfig.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return getHeading1Style(config, props);
                          Severity: Major
                          Found in src/components/Heading.tsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              return {};
                            Severity: Major
                            Found in src/lib/getFloatStyle.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return LEVEL8_STYLE;
                              Severity: Major
                              Found in src/lib/getFloatStyle.ts - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language