e1-bsd/omni-common-ui

View on GitHub

Showing 62 of 222 total issues

Function testButtonClick has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function testButtonClick(props = {}) {
  describe('when clicked', () => {
    test('calls onClick', () => {
      const onClick = jest.fn();
      const wrapper = shallow(<Button {...props} onClick={onClick} />);
Severity: Major
Found in src/components/Button/button.spec.jsx - About 2 hrs to fix

    File index.jsx has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import styles from './style.postcss';
    
    import React, { PureComponent } from 'react';
    import PropTypes from 'prop-types';
    import { Set } from 'immutable';
    Severity: Minor
    Found in src/containers/Header/NotificationsTray/index.jsx - About 2 hrs to fix

      Function render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          if (! this.props.items || this.props.items.length < 1) return null;
      
          // make a copy of props.items so that we can mangle it
          let itemsToRender = this.props.items;
      Severity: Major
      Found in src/components/Breadcrumbs/index.jsx - About 2 hrs to fix

        Function fetchPrivilegesIfNeeded has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function fetchPrivilegesIfNeeded() {
          return (dispatch, getState) => {
            const state = getState();
            const userId = getSSOUserId(state);
            if (! userId) return false;
        Severity: Major
        Found in src/containers/Privileges/actions.js - About 2 hrs to fix

          Function render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const {
                optionKeys,
                optionList,
                className,
          Severity: Major
          Found in src/components/InputSelect/index.jsx - About 2 hrs to fix

            Function postImpersonate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function postImpersonate(email, token) {
              return (dispatch) => {
                const url = getTokenEndPoint();
                const method = 'POST';
            
            
            Severity: Minor
            Found in src/containers/Impersonate/actions.js - About 2 hrs to fix

              Function create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              const create = (apiResponse) => {
                if (apiResponse instanceof ApiResponse) {
                  return apiResponse;
                }
              
              
              Severity: Minor
              Found in src/domain/ApiResponseHelper/index.js - 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 _renderCalloutPopupContent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _renderCalloutPopupContent() {
                  const { notifications } = this.props;
                  const { viewingNotification } = this.state;
                  const headerBtnClassName = classnames(styles.NotificationsTray_popup_heading_btn,
                    testClass('mark-as-read'),
              Severity: Minor
              Found in src/containers/Header/NotificationsTray/index.jsx - About 1 hr to fix

                Function _renderHeading has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _renderHeading() {
                    const { title, rootLinkTitle, hideRootLink } = this.props;
                    const headerClassName = classnames(this.props.headerClassName,
                      styles.SelectionTable_header);
                    const routes = this._cloneArray(this.state.route);
                Severity: Minor
                Found in src/components/SelectionTable/component.jsx - About 1 hr to fix

                  Function Field has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Field = (props) => {
                    const classes = classnames(styles.Field, props.className, getValidationClasses(), {
                      [styles.__stackedHorizontally]: props.neighborStackMode === 'horizontal',
                    });
                    if (props.useLabel === true) {
                  Severity: Minor
                  Found in src/components/Form/Field/index.jsx - About 1 hr to fix

                    Function create has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      static create(originalAction) {
                        const action = Object.assign({}, originalAction);
                        if (is.not.object(action)) {
                          throw new InvalidAction('An action should be an object');
                        }
                    Severity: Minor
                    Found in src/containers/ApiCalls/ApiAction.js - About 1 hr to fix

                      Function render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render() {
                          const {
                            optionKeys,
                            optionList,
                            className,
                      Severity: Minor
                      Found in src/components/InputSelect/index.jsx - 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 render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render() {
                          const inputBorderStyle = classnames(styles.CalendarPicker,
                            this.props.isValid ? '' : styles.CalendarPicker_error);
                          return (
                            <div onMouseDown={this.handleContainerMouseDown}
                      Severity: Minor
                      Found in src/components/CalendarPicker/index.jsx - About 1 hr to fix

                        Function render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render() {
                            const { suffix } = this.props;
                            const _this = this;
                            const classes = classnames(styles.TextInput, this.props.className);
                            const inputClasses = ! suffix ?
                        Severity: Minor
                        Found in src/components/TextInput/TextInput.jsx - About 1 hr to fix

                          Function createNotificationsMiddleware has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function createNotificationsMiddleware(config = {}) {
                            invariant(is.string(config.strategy), 'trigger strategy must be a string');
                            invariant(is.object(config.dispatch), 'trigger dispatch must be an object');
                            invariant(is.string(config.dispatch.apiUrl), 'dispatch apiUrl must be a string');
                          
                          
                          Severity: Minor
                          Found in src/domain/createNotificationsMiddleware/index.js - About 1 hr to fix

                            Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const { children, isAnyApiCallSaving } = this.props;  // eslint-disable-line
                                const { isVisible } = this.state;
                                const barClasses = {
                                  [styles.SaveBar]: true,
                            Severity: Minor
                            Found in src/containers/SaveBarHandler/index.jsx - About 1 hr to fix

                              Function create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                static create(originalAction) {
                                  const action = Object.assign({}, originalAction);
                                  if (is.not.object(action)) {
                                    throw new InvalidAction('An action should be an object');
                                  }
                              Severity: Minor
                              Found in src/containers/ApiCalls/ApiAction.js - 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 buildWithProps has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                buildWithProps: (props) => {
                                  const { params, routes, buildRoute } = props;
                              
                                  const getRouteSegments = () =>
                                    routes.filter((route) => is.string(route.path));
                              Severity: Minor
                              Found in src/domain/BreadcrumbsBuilder/index.js - About 1 hr to fix

                                Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  render() {
                                    const inputValue = this._getValidNumber(this._value, this._defaultValue);
                                    const classes = classnames(styles.NumberInput_inputContainer,
                                        this.props.className,
                                        { [styles.__focused]: this.state.focused });
                                Severity: Minor
                                Found in src/components/NumberInput/index.jsx - About 1 hr to fix

                                  Function createApiActionCreator has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    (dispatch) => {
                                      const prefix = (() => {
                                        switch (method.toUpperCase()) {
                                          case 'DELETE': return 'DELETE_';
                                          case 'POST': case 'PUT': return 'SUBMIT_';
                                  Severity: Minor
                                  Found in src/domain/createApiActionCreator/index.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language