18F/cg-dashboard

View on GitHub

Showing 108 of 108 total issues

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

  handleAction(action) {
    switch (action.type) {
      case userActionTypes.ORG_USERS_FETCH: {
        this.loadingRequests.entityUsers = true;
        break;
Severity: Major
Found in static_src/stores/user_store.js - About 1 day to fix

    File cf_api.js has 552 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import http from "axios";
    import queryString from "query-string";
    
    import { noticeError } from "../util/analytics.js";
    import domainActions from "../actions/domain_actions.js";
    Severity: Major
    Found in static_src/util/cf_api.js - About 1 day to fix

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

      export default {
        version: APIV,
      
        formatSplitResponse(resource) {
          return Object.assign({}, resource.entity, resource.metadata);
      Severity: Major
      Found in static_src/util/cf_api.js - About 1 day to fix

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

          handleAction(action) {
            switch (action.type) {
              case serviceActionTypes.SERVICE_INSTANCES_FETCH: {
                this.isFetchingAll = true;
                this.emitChange();
        Severity: Major
        Found in static_src/stores/service_instance_store.js - About 7 hrs to fix

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

            handleAction(action) {
              switch (action.type) {
                case routeActionTypes.ROUTES_RECEIVED: {
                  const routes = action.routes;
                  this.mergeRoutes(routes);
          Severity: Major
          Found in static_src/stores/route_store.js - About 6 hrs to fix

            File user_actions.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * Actions for user entities. Any actions such as fetching, creating, updating,
             * etc should go here.
             */
            
            
            Severity: Minor
            Found in static_src/actions/user_actions.js - About 6 hrs to fix

              File user_store.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * Store for user data. Will store and update user data on changes from UI and
               * server.
               */
              
              
              Severity: Minor
              Found in static_src/stores/user_store.js - About 5 hrs to fix

                userActions has 38 functions (exceeds 20 allowed). Consider refactoring.
                Open

                const userActions = {
                  fetchOrgUsers(orgGuid) {
                    AppDispatcher.handleViewAction({
                      type: userActionTypes.ORG_USERS_FETCH,
                      orgGuid
                Severity: Minor
                Found in static_src/actions/user_actions.js - About 5 hrs to fix

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

                    handleAction(action) {
                      switch (action.type) {
                        case appActionTypes.APP_FETCH:
                          this.isFetchingApp = true;
                          this.emitChange();
                  Severity: Major
                  Found in static_src/stores/app_store.js - About 4 hrs to fix

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

                      render() {
                        const route = this.props.route;
                        const domains = this.props.domains;
                        const routeLimit = this.props.routeLimit;
                        let limit;
                    Severity: Major
                    Found in static_src/components/route_form.jsx - About 4 hrs to fix

                      File service_instance_store.js has 319 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       * Store for services data. Will store and update services data on changes from
                       * UI and server.
                       */
                      import AppDispatcher from "../dispatcher";
                      Severity: Minor
                      Found in static_src/stores/service_instance_store.js - About 3 hrs to fix

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

                          handleAction(action) {
                            switch (action.type) {
                              case orgActionTypes.ORG_FETCH: {
                                this.isFetchingOrg = true;
                                this.emitChange();
                        Severity: Major
                        Found in static_src/stores/org_store.js - About 3 hrs to fix

                          serviceActions has 28 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          const serviceActions = {
                            fetchAllServices(orgGuid) {
                              AppDispatcher.handleViewAction({
                                type: serviceActionTypes.SERVICES_FETCH,
                                orgGuid
                          Severity: Minor
                          Found in static_src/actions/service_actions.js - About 3 hrs to fix

                            File service_actions.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /*
                             * Actions for service entities. Any actions such as fetching, creating,
                             * updating, etc should go here.
                             */
                            
                            
                            Severity: Minor
                            Found in static_src/actions/service_actions.js - About 2 hrs to fix

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

                                handleAction(action) {
                                  switch (action.type) {
                                    case serviceActionTypes.SERVICE_INSTANCES_FETCH: {
                                      this.isFetchingAll = true;
                                      this.emitChange();
                              Severity: Minor
                              Found in static_src/stores/service_instance_store.js - 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 CreateExternalServerForPrivileged has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                              Open

                              func CreateExternalServerForPrivileged(t *testing.T, test BasicProxyTest) *httptest.Server {
                                  return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                                      privilegedToken := "90d64460d14870c08c81352a05dedd3465940a7c"
                                      if r.URL.String() == "/oauth/token" {
                              
                              
                              Severity: Minor
                              Found in helpers/testhelpers/testhelpers.go - 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 formContent has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                get formContent() {
                                  const serviceName = this.serviceName;
                                  if (CF_CLI_SERVICE_DETAILS.hasOwnProperty(serviceName)) {
                                    return (
                                      <Form
                              Severity: Major
                              Found in static_src/components/create_service_instance.jsx - About 2 hrs to fix

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

                                  render() {
                                    let buttonText;
                                    let content = (
                                      <div>
                                        <Loading text="Loading users" />
                                Severity: Major
                                Found in static_src/components/user_list.jsx - About 2 hrs to fix

                                  Function reduce has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    reduce(action) {
                                      switch (action.type) {
                                        case upsiActionTypes.UPSI_FETCH_ALL_REQUEST: {
                                          this.allRequest = {
                                            ...this.allRequest,
                                  Severity: Major
                                  Found in static_src/stores/upsi_store.js - About 2 hrs to fix

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

                                      render() {
                                        const {
                                          org,
                                          space,
                                          app,
                                    Severity: Major
                                    Found in static_src/components/app_container.jsx - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language