18F/cg-dashboard

View on GitHub

Showing 107 of 108 total issues

Function emptyState has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  get emptyState() {
    let content;
    let callout;

    if (this.state.currentUserCanViewSpace) {
Severity: Minor
Found in static_src/components/org_container.jsx - About 1 hr to fix

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

      addUserRole(user, entityType, entityGuid, addedRole, cb) {
        const updatedUser = user;
        if (updatedUser) {
          if (entityType === "space") {
            if (!updatedUser.space_roles) updatedUser.space_roles = {};
    Severity: Minor
    Found in static_src/stores/user_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 handleAction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      handleAction(action) {
        switch (action.type) {
          case userActionTypes.ORG_USERS_FETCH: {
            this.loadingRequests.entityUsers = true;
            break;
    Severity: Minor
    Found in static_src/stores/user_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 handleAction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      handleAction(action) {
        switch (action.type) {
          case routeActionTypes.ROUTES_RECEIVED: {
            const routes = action.routes;
            this.mergeRoutes(routes);
    Severity: Minor
    Found in static_src/stores/route_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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { instance } = this.props;
        const { last_operation: lastOp } = instance;
        const lastOpTime = lastOp.updated_at || lastOp.created_at;
        const specialtdStyles = {
    Severity: Minor
    Found in static_src/components/service_instance_table_row.jsx - About 1 hr to fix

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

        fetchAllInstances(spaceGuid) {
          AppDispatcher.handleViewAction({
            type: serviceActionTypes.SERVICE_INSTANCES_FETCH,
            spaceGuid
          });
      Severity: Minor
      Found in static_src/actions/service_actions.js - About 1 hr to fix

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

          render() {
            let content = <Loading text="Loading service instances" />;
        
            if (this.state.empty) {
              content = <h4 className="test-none_message">No service instances</h4>;
        Severity: Minor
        Found in static_src/components/service_instance_table.jsx - About 1 hr to fix

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

            get actions() {
              let content;
          
              if (this.props.serviceInstance.loading) {
                content = (
          Severity: Minor
          Found in static_src/components/service_instance.jsx - About 1 hr to fix

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

              handleAction(action) {
                switch (action.type) {
                  case errorActionTypes.NOTIFY: {
                    const err = Object.assign({}, action.err);
                    // Put this error at the top, since it is considered higher priority
            Severity: Minor
            Found in static_src/stores/error_store.js - About 1 hr to fix

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

              const userProvider = Component => {
                class UserProvider extends React.Component {
                  constructor(props) {
                    super(props);
              
              
              Severity: Minor
              Found in static_src/components/user_provider.jsx - About 1 hr to fix

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

                  handleAction(action) {
                    switch (action.type) {
                      case quotaActionTypes.ORGS_QUOTAS_FETCH: {
                        this.load([cfApi.fetchOrgsQuotas()]);
                        this.emitChange();
                Severity: Minor
                Found in static_src/stores/quota_store.js - About 1 hr to fix

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

                    deleteUserRole(user, entityType, entityGuid, deletedRole, cb) {
                      const updatedUser = user;
                      if (updatedUser) {
                        let roles;
                        if (entityType === "space") {
                  Severity: Minor
                  Found in static_src/stores/user_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 fetchAllPages has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    fetchAllPages(url, ...args) {
                      let [data, action] = args;
                      if (typeof data === "function") {
                        action = data;
                        data = {};
                  Severity: Minor
                  Found in static_src/util/cf_api.js - About 1 hr to fix

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

                    module.exports = function(config) {
                      config.set({
                        browsers: ["Chrome"],
                    
                        frameworks: ["jasmine", "jasmine-matchers", "jasmine-sinon"],
                    Severity: Minor
                    Found in karma.conf.js - About 1 hr to fix

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

                        get memory() {
                          const memory = this.state.editing
                            ? this.state.form.fields.memory.value
                            : this.props.app.memory;
                          const maxMemory = Math.floor(
                      Severity: Minor
                      Found in static_src/components/usage_and_limits.jsx - About 1 hr to fix

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

                          get eventContent() {
                            const { domain, item, route } = this.props;
                            const itemType = item.type;
                            const metadata = item.metadata;
                        
                        
                        Severity: Minor
                        Found in static_src/components/app_activity/app_activity.jsx - About 1 hr to fix

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

                            get scale() {
                              const instanceCount = this.state.editing
                                ? this.state.form.fields.instances.value
                                : this.props.app.instances;
                          
                          
                          Severity: Minor
                          Found in static_src/components/usage_and_limits.jsx - About 1 hr to fix

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

                              render() {
                                let removeHandler;
                            
                                if (this.isOrganization) {
                                  removeHandler = this.handleRemoveUser;
                            Severity: Minor
                            Found in static_src/components/users.jsx - About 1 hr to fix

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

                                render() {
                                  const err = this.props.err;
                                  const link = config.docs.status && (
                                    <span>
                                      {" "}
                              Severity: Minor
                              Found in static_src/components/global_error.jsx - About 1 hr to fix

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

                                  render() {
                                    let error;
                                
                                    if (this.state.err) {
                                      error = <FormError message={this.state.err.message} />;
                                Severity: Minor
                                Found in static_src/components/form/form_select.jsx - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language