e1-bsd/omni-common-ui

View on GitHub

Showing 62 of 222 total issues

Function Profile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const Profile = (props, { backgroundless, vertical }) => {
  const { status, statusHighlighted, isPlaceholder } = props;

  const renderName = (prop, name, nameClasses, nameLink) => {
    if (! name) {
Severity: Minor
Found in src/components/StudentCard/Profile/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

Function _updateState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  _updateState(props = this.props) {
    const { isAnyApiCallLoadingBeyondThreshold, isAnyApiCallLoading } = props;
    if (! IS_ACTIVE) return; // CONFIG flag check
    if (isAnyApiCallLoadingBeyondThreshold) {
      this.setState({ isThrobberVisible: true });
Severity: Minor
Found in src/containers/LoadingOverlayHandler/index.jsx - About 35 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 HistoryLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const HistoryLink = (props) => {
  const currentRoute = props.routes[props.routes.length - 1];
  let history = currentRoute.history;

  if (is.function(currentRoute.canAccess) && (! (currentRoute.canAccess(props)))) return null;
Severity: Minor
Found in src/components/HistoryLink/index.jsx - About 35 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 _setPageTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  _setPageTitle(props) {
    this._breadcrumbs = BreadcrumbsBuilder.buildWithProps(props);
    const visibleBreadcrumbCount =
        this._breadcrumbs && this._breadcrumbs.filter((bc) => ! bc.hidden).length;
    if (! this._breadcrumbs || visibleBreadcrumbCount <= 0) {
Severity: Minor
Found in src/components/App/index.jsx - About 35 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 handleChange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  handleChange(e) {
    if (this.props.acceptedChars) {
      if (this.props.acceptedChars.type === 'number' &&
          e.target.value.match(/\D/g)
          ) {
Severity: Minor
Found in src/components/TextInput/TextInput.jsx - About 35 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 mapStateToProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function mapStateToProps(state, { routes }) {
  const user = state.get('singleSignOn').get('user');
  const permissionChecks = routes.filter((route) => {
    if (is.not.existy(route.canAccess)) {
      return false;
Severity: Minor
Found in src/containers/AuthorizationHandler/index.jsx - About 35 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 AuthorizationHandler has a Cognitive Complexity of 7 (exceeds 5 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 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const props = this.props;
    const type = props.type || Type.default;

    validateType(type);
Severity: Minor
Found in src/components/Button/button.jsx - About 35 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 new ApiResponse({ data: apiResponse.data });
Severity: Major
Found in src/domain/ApiResponseHelper/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return new ApiResponse({ error: apiResponse.error });
    Severity: Major
    Found in src/domain/ApiResponseHelper/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return children;
      Severity: Major
      Found in src/containers/AuthorizationHandler/index.jsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return new ApiResponse({ error: new Error(apiResponse.error) });
        Severity: Major
        Found in src/domain/ApiResponseHelper/index.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return state;
          Severity: Major
          Found in src/containers/ApiCalls/reducer.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return state.set(key, newState);
            Severity: Major
            Found in src/containers/ApiCalls/reducer.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return new ApiResponse({ data: apiResponse });
              Severity: Major
              Found in src/domain/ApiResponseHelper/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return this._sendCallbackWithNewValue(this._max);
                Severity: Major
                Found in src/components/NumberInput/index.jsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return <AuthorisationErrorPage {...props} />;
                  Severity: Major
                  Found in src/containers/AuthorizationHandler/index.jsx - About 30 mins to fix

                    Function createApiActionCreator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const createApiActionCreator = (actionObjectName,
                        url, method = 'GET',
                        requestExtras = {}, successExtras = {}, failureExtras = {}) =>  // these are optional!
                    
                      (dispatch) => {
                    Severity: Minor
                    Found in src/domain/createApiActionCreator/index.js - About 25 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 ErrorPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const ErrorPage = (props) => {
                      const { config } = props;
                    
                      return <div className={styles.ErrorPage}>
                        <div className={styles.ErrorPage_content}>
                    Severity: Minor
                    Found in src/components/ErrorPage/index.jsx - About 25 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 parseRoutes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function parseRoutes(routes, store) {
                      if (is.array(routes)) {
                        return routes.map((route) => parseRoutes(route, store));
                      }
                    
                    
                    Severity: Minor
                    Found in src/domain/parseRoutes/index.js - About 25 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