e1-bsd/omni-common-ui

View on GitHub

Showing 62 of 222 total issues

Function mediaQuery has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const mediaQuery = (media) => {
  const mql = localMatchMedia(media);
  const listeners = [];
  let index = 0;

Severity: Minor
Found in src/domain/MediaQuery/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 _disabledDay has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  _disabledDay(day) {
    let disabled = false;
    if (this.props.isDisablePastDay) {
      disabled = DateUtils.isPastDay(day);
    }
Severity: Minor
Found in src/components/CalendarPicker/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 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { postImpersonateState } = this.props;
    const errorCode = postImpersonateState ? postImpersonateState.get('error') : undefined;
    const data = postImpersonateState ? postImpersonateState.get('data') : undefined;

Severity: Minor
Found in src/containers/Impersonate/component.jsx - About 1 hr to fix

    Function _getButtonsToDisplay has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _getButtonsToDisplay(props = this.props) {
        const currentRoute = SaveBarHandler.getCurrentRouteSegment(props);
        const currentModeName = props.params &&
            props.params.mode &&
            props.params.mode.length ?
    Severity: Minor
    Found in src/containers/SaveBarHandler/index.jsx - About 1 hr to fix

      Function Select has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Select = (props) => {
        const arrowRenderer = () =>
          <span className={styles.Select_icon}>
            <Icon id="chevron-small-down" />
          </span>;
      Severity: Minor
      Found in src/components/Form/Select/index.jsx - About 1 hr to fix

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

          render() {
            const { user } = this.props;
            if (! user || user.expired) return null;
        
            return <div className={classnames(styles.App, testClass('app'))}>
        Severity: Minor
        Found in src/components/App/index.jsx - About 1 hr to fix

          Function ColourLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const ColourLabel = (props) => {
            const { text, initial, colour } = props;
          
            if (is.string(initial) && is.not.empty(initial)) {
              return renderSmall();
          Severity: Minor
          Found in src/components/ColourLabel/index.jsx - About 1 hr to fix

            Function createSignInRedirectMiddleware has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function createSignInRedirectMiddleware() {
              return (store) => (next) => (action) => {
                // bounce any 401s to the login page
                if (ApiCall.Action.isApiAction(action) &&
                    ApiCall.Action.isFailure(action) &&
            Severity: Minor
            Found in src/domain/createSignInRedirectMiddleware/index.js - About 1 hr to fix

              Function _renderNotificationFooter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _renderNotificationFooter(notifications) {
                  const markBtnClassName = classnames(styles.NotificationsTray_notification_footer_mark,
                    testClass('notification-mark'));
                  if (this.state.isMarkingMode) {
                    return <div className={styles.NotificationsTray_notification_footer}>
              Severity: Minor
              Found in src/containers/Header/NotificationsTray/index.jsx - About 1 hr to fix

                Function fetch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const fetch = (url, options = {}) => {
                  invariant(is.string(url), 'url must be a string');
                  invariant(is.object(options), 'options must be a plain object');
                
                  const user = Store.get().getState().get('singleSignOn').get('user') || {};
                Severity: Minor
                Found in src/domain/Api/index.js - About 1 hr to fix

                  Function _getButtonsToDisplay has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _getButtonsToDisplay(props = this.props) {
                      const currentRoute = SaveBarHandler.getCurrentRouteSegment(props);
                      const currentModeName = props.params &&
                          props.params.mode &&
                          props.params.mode.length ?
                  Severity: Minor
                  Found in src/containers/SaveBarHandler/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 _updateIntermediateCrumbsCollapsedState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _updateIntermediateCrumbsCollapsedState() {
                      if (! this.props.singleLineMode || ! this.listNode) return;
                  
                      const navBoxSizing = this.navNode.style.boxSizing;
                      this.navNode.style.boxSizing = 'content-box';  // to get width without padding
                  Severity: Minor
                  Found in src/components/Breadcrumbs/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 _renderHeading has a Cognitive Complexity of 10 (exceeds 5 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

                  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 mapDispatchToProps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function mapDispatchToProps(dispatch) {
                    const markAsReadDispatchConfig = Config.get('notificationsTray').markAsRead.dispatch;
                    const apiUrl = buildUrl(markAsReadDispatchConfig.apiUrl);
                    const method = markAsReadDispatchConfig.method;
                    return {
                  Severity: Minor
                  Found in src/containers/Header/NotificationsTray/index.jsx - About 1 hr to fix

                    Function mediaQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const mediaQuery = (media) => {
                      const mql = localMatchMedia(media);
                      const listeners = [];
                      let index = 0;
                    
                    
                    Severity: Minor
                    Found in src/domain/MediaQuery/index.js - About 1 hr to fix

                      Function AuthorizationHandler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const AuthorizationHandler = (props) => {
                        const { user, permissionChecks, children, havePrivilegesLoaded } = props;
                      
                        const spinner = <PageLoadingSpinner />;
                      
                      
                      Severity: Minor
                      Found in src/containers/AuthorizationHandler/index.jsx - About 1 hr to fix

                        Function _updateIntermediateCrumbsCollapsedState has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _updateIntermediateCrumbsCollapsedState() {
                            if (! this.props.singleLineMode || ! this.listNode) return;
                        
                            const navBoxSizing = this.navNode.style.boxSizing;
                            this.navNode.style.boxSizing = 'content-box';  // to get width without padding
                        Severity: Minor
                        Found in src/components/Breadcrumbs/index.jsx - About 1 hr to fix

                          Function Field has a Cognitive Complexity of 9 (exceeds 5 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 55 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 fetch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const fetch = (url, options = {}) => {
                            invariant(is.string(url), 'url must be a string');
                            invariant(is.object(options), 'options must be a plain object');
                          
                            const user = Store.get().getState().get('singleSignOn').get('user') || {};
                          Severity: Minor
                          Found in src/domain/Api/index.js - 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 _onValueChanged has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            _onValueChanged({ target: { value: newValue } }) {
                              if (is.empty(newValue)) {
                                return this._sendCallbackWithNewValue(null);
                              }
                          
                          
                          Severity: Minor
                          Found in src/components/NumberInput/index.jsx - 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

                          Severity
                          Category
                          Status
                          Source
                          Language