GSA/code-gov-front-end

View on GitHub

Showing 8 of 8 total issues

Function render has 106 lines of code (exceeds 85 allowed). Consider refactoring.
Open

  render() {
    return (
      <footer className="usa-footer" role="contentinfo">
        <div className="grid-container usa-footer__return-to-top">
          <a href="#app" className="text-bold font-body-3xs">
Severity: Major
Found in src/components/footer/footer.component.js - About 1 hr to fix

    Function hydrate has a Cognitive Complexity of 11 (exceeds 6 allowed). Consider refactoring.
    Open

    export function hydrate() {
      const initialState = clone(defaultState)
      const section = getSection()
      if (section) {
        const parsed = getNormalizedURLSearchParams()
    Severity: Minor
    Found in src/hydrator.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

    Avoid deeply nested control flow statements.
    Open

                if (typeof subvalue === 'string') {
                  item[subkey] = adjustAssetPath(subvalue)
                }
    Severity: Major
    Found in src/utils/other.js - About 45 mins to fix

      Function getConfigValue has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring.
      Open

      export function getConfigValue(path) {
        if (SITE_CONFIG) {
          let value = get(SITE_CONFIG, path)
          if (typeof value === 'string') {
            try {
      Severity: Minor
      Found in src/utils/other.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

      Avoid too many return statements within this function.
      Open

                    return false
      Severity: Major
      Found in src/components/search-page/search-page.container.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return true
        Severity: Major
        Found in src/components/search-page/search-page.container.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return false
          Severity: Major
          Found in src/components/search-page/search-page.container.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                          return false
            Severity: Major
            Found in src/components/search-page/search-page.container.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language