18F/cg-dashboard

View on GitHub

Showing 107 of 108 total issues

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

  render() {
    let content = <div />;
    let controls;

    controls = (
Severity: Major
Found in static_src/components/usage_and_limits.jsx - About 2 hrs to fix

    File usage_and_limits.jsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from "prop-types";
    import React from "react";
    
    import Action from "./action.jsx";
    import { Form, FormNumber } from "./form";
    Severity: Minor
    Found in static_src/components/usage_and_limits.jsx - About 2 hrs to fix

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

        render() {
          let content = <div />;
      
          if (this.state.empty && this.state.hasErrors) {
            content = (
      Severity: Major
      Found in static_src/components/activity_log.jsx - About 2 hrs to fix

        Function spaceDeveloper has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          get spaceDeveloper() {
            const org = this.props.org || {};
            const space = this.props.space || {};
            let content;
        
        
        Severity: Major
        Found in static_src/components/info_app_create.jsx - About 2 hrs to fix

          `` has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default {
            associateApp(routeGuid, appGuid) {
              AppDispatcher.handleViewAction({
                type: routeActionTypes.ROUTE_APP_ASSOCIATE,
                appGuid,
          Severity: Minor
          Found in static_src/actions/route_actions.js - About 2 hrs to fix

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

              render() {
                const { org, spaces, loading, empty } = this.state;
            
                let content = (
                  <div>
            Severity: Major
            Found in static_src/components/org_container.jsx - About 2 hrs to fix

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

                render() {
                  // TODO add back in service instance lists
                  if (this.state.loading) {
                    return <Loading />;
                  }
              Severity: Major
              Found in static_src/components/space_container.jsx - About 2 hrs to fix

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

                  render() {
                    let content = <div />;
                
                    if (this.state.route) {
                      const route = this.state.route;
                Severity: Major
                Found in static_src/components/route.jsx - About 2 hrs to fix

                  Function stateSetter has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function stateSetter() {
                    const currentOrgGuid = OrgStore.currentOrgGuid;
                    const currentSpaceGuid = SpaceStore.currentSpaceGuid;
                    const currentType = UserStore.currentlyViewedType;
                    const currentUser = UserStore.currentUser;
                  Severity: Minor
                  Found in static_src/components/users.jsx - About 1 hr to fix

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

                      render() {
                        const { disabled, onDismiss } = this.props;
                        const { name, value } = this.state;
                    
                        return (
                    Severity: Minor
                    Found in static_src/components/env/env_var_form.js - About 1 hr to fix

                      Method Settings.InitSettings has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (s *Settings) InitSettings(envVars *env.VarSet) (retErr error) {
                          defer func() {
                              // While .MustString() is convenient in readability below, we'd prefer
                              // to convert this to an error for upstream callers.
                              if r := recover(); r != nil {
                      Severity: Minor
                      Found in helpers/settings.go - About 1 hr to fix

                        Function renderContents has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          renderContents() {
                            const { app, envRequest, updateError } = this.props;
                            const { updating } = app;
                            const { isFetching, error } = envRequest;
                            const { showUserEnv, showAddForm, showEnv } = this.state;
                        Severity: Minor
                        Found in static_src/components/env/env_panel/env_panel.js - About 1 hr to fix

                          Function handleAction has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            handleAction(action) {
                              let activity;
                              switch (action.type) {
                                case activityActionTypes.EVENTS_FETCH:
                                  this.isFetchingEvents = true;
                          Severity: Minor
                          Found in static_src/stores/activity_store.js - About 1 hr to fix

                            Function handleAction has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              handleAction(action) {
                                switch (action.type) {
                                  case envActionTypes.ENV_FETCH_ENV_REQUEST: {
                                    const { appGuid } = action;
                                    this.envRequests[appGuid] = {
                            Severity: Minor
                            Found in static_src/stores/env_store.js - About 1 hr to fix

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

                                handleAction(action) {
                                  switch (action.type) {
                                    case orgActionTypes.ORG_RECEIVED: {
                                      const spaces = action.org.spaces || [];
                                      const spacesWithOrgGuid = spaces.map(space => {
                              Severity: Minor
                              Found in static_src/stores/space_store.js - About 1 hr to fix

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

                                  render() {
                                    let content = <div />;
                                
                                    if (this.state.route) {
                                      const route = this.state.route;
                                Severity: Minor
                                Found in static_src/components/route.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 createUserAndAssociate has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  createUserAndAssociate(userGuid) {
                                    const entityType = UserStore.currentlyViewedType;
                                    const orgGuid = OrgStore.currentOrgGuid;
                                    let cfApiRequest;
                                    let entityGuid;
                                Severity: Minor
                                Found in static_src/actions/user_actions.js - About 1 hr to fix

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

                                    render() {
                                      const app = this.props.app;
                                      const info = [];
                                  
                                      if (this.props.extraInfo.includes("state")) {
                                  Severity: Minor
                                  Found in static_src/components/app_quicklook.jsx - About 1 hr to fix

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

                                      handleAction(action) {
                                        switch (action.type) {
                                          case orgActionTypes.ORG_FETCH: {
                                            this.isFetchingOrg = true;
                                            this.emitChange();
                                    Severity: Minor
                                    Found in static_src/stores/org_store.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 validateInteger has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export function validateInteger(options) {
                                      const { max, min } = options || {};
                                      return function _validateInteger(text) {
                                        let value = text || "";
                                        if (!/^-?\d+$/.test(String(value).trim())) {
                                    Severity: Minor
                                    Found in static_src/util/validators.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language