18F/cg-dashboard

View on GitHub

Showing 107 of 108 total issues

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

  get spaceDeveloper() {
    const org = this.props.org || {};
    const space = this.props.space || {};
    let content;

Severity: Minor
Found in static_src/components/info_app_create.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 stateSetter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function stateSetter() {
  const appGuid = AppStore.currentAppGuid;
  const activity = ActivityStore.getAll()
    .filter(item => {
      if (item.activity_type === "log") {
Severity: Minor
Found in static_src/components/activity_log.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 appHealth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function appHealth(app) {
  if (!app) {
    throw new Error("`app` must be provided.");
  }

Severity: Minor
Found in static_src/util/health.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 mapStoreToState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function mapStoreToState() {
  let route;
  const { currentAppGuid } = AppStore;
  const app = AppStore.get(currentAppGuid);
  const envRequest = EnvStore.getEnvRequest(currentAppGuid);
Severity: Minor
Found in static_src/components/app_container.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 parseError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function parseError(resultOrError) {
  if (resultOrError instanceof Error) {
    // Leave it alone
    return resultOrError;
  }
Severity: Minor
Found in static_src/util/cf_api.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

Method Settings.InitSettings has 6 return statements (exceeds 4 allowed).
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: Major
Found in helpers/settings.go - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

        if (this.props.brief) {
          const cliLink = config.docs.cli ? (
            <a href={config.docs.cli}>command line interface (CLI)</a>
          ) : (
            <span>Command line interface (CLI)</span>
    Severity: Major
    Found in static_src/components/info_app_create.jsx - About 40 mins to fix

      Method UAAContext.InviteUserToOrg has 6 return statements (exceeds 4 allowed).
      Open

      func (c *UAAContext) InviteUserToOrg(rw web.ResponseWriter, req *web.Request) {
          // parse the request
          inviteUserToOrgRequest, err := c.ParseInviteUserToOrgReq(req.Request)
          if err != nil {
              err.writeTo(rw)
      Severity: Major
      Found in controllers/uaa.go - About 40 mins to fix

        Function addUserRoles has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          addUserRoles(role, resource, userGuid, entityGuid, entityType) {
        Severity: Minor
        Found in static_src/actions/user_actions.js - About 35 mins to fix

          Method SecureContext.submitRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (c *SecureContext) submitRequest(rw http.ResponseWriter, req *http.Request, url string, client *http.Client, responseHandler ResponseHandler) {
          Severity: Minor
          Found in controllers/secure.go - About 35 mins to fix

            Function PrepareExternalServerCall has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func PrepareExternalServerCall(t *testing.T, c *controllers.SecureContext, testServer *httptest.Server, fullURL string, test BasicProxyTest) (*httptest.ResponseRecorder, *http.Request, *web.Router) {
            Severity: Minor
            Found in helpers/testhelpers/testhelpers.go - About 35 mins to fix

              Function deleteUserRoles has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                deleteUserRoles(roles, apiKey, userGuid, entityGuid, entityType) {
              Severity: Minor
              Found in static_src/actions/user_actions.js - About 35 mins to fix

                Function CreateExternalServer has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                Open

                func CreateExternalServer(t *testing.T, test *BasicProxyTest) *httptest.Server {
                    return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                        foundHandler := false
                        for _, handler := range test.Handlers {
                            if r.URL.RequestURI() == handler.ExpectedPath && r.Method == handler.RequestMethod {
                Severity: Minor
                Found in helpers/testhelpers/testhelpers.go - 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 handleAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  handleAction(action) {
                    switch (action.type) {
                      case appActionTypes.APP_FETCH:
                        this.isFetchingApp = true;
                        this.emitChange();
                Severity: Minor
                Found in static_src/stores/app_store.js - 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 stateSetter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function stateSetter() {
                  const appGuid = AppStore.currentAppGuid;
                  const orgGuid = OrgStore.currentOrgGuid;
                  const spaceGuid = SpaceStore.currentSpaceGuid;
                
                
                Severity: Minor
                Found in static_src/components/routes_panel.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

                Method UAAContext.GetUAAUserByEmail has 5 return statements (exceeds 4 allowed).
                Open

                func (c *UAAContext) GetUAAUserByEmail(email string) (
                    userResponse GetUAAUserResponse, err *UaaError) {
                    // Per https://tools.ietf.org/html/rfc7644#section-3.4.2.2, the value format in a SCIM query is JSON format
                    emailJSONBytes, mErr := json.Marshal(email)
                    if mErr != nil {
                Severity: Major
                Found in controllers/uaa.go - About 35 mins to fix

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

                    merge(mergeKey, dataToMerge, cb = defaultChangedCallback.bind(this)) {
                      const toMerge = Immutable.fromJS(dataToMerge);
                      const oldDataItem = this.storeData.find(
                        d => d.get(mergeKey) === toMerge.get(mergeKey)
                      );
                  Severity: Minor
                  Found in static_src/stores/base_store.js - 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() {
                      let content = <div />;
                      const serviceInstance = this.props.serviceInstance;
                  
                      if (serviceInstance) {
                  Severity: Minor
                  Found in static_src/components/service_instance.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 OPERATION_RUNNING;
                  Severity: Major
                  Found in static_src/stores/service_instance_store.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return entityHealth.unknown;
                    Severity: Major
                    Found in static_src/util/health.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language