concord-consortium/rigse

View on GitHub
rails/react-components/src/library/helpers/standards-helpers.tsx

Summary

Maintainability
D
3 days
Test Coverage

Function NgssHelper has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

const NgssHelper = function () {
  const PE = "Performance Expectations";
  const DCI = "Disciplinary Core Ideas";
  const PRACTICES = "Science and Engineering Practices";
  const CONCEPTS = "Crosscutting Concepts";
Severity: Minor
Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 1 day 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 NgssHelper has 175 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NgssHelper = function () {
  const PE = "Performance Expectations";
  const DCI = "Disciplinary Core Ideas";
  const PRACTICES = "Science and Engineering Practices";
  const CONCEPTS = "Crosscutting Concepts";
Severity: Major
Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 7 hrs to fix

    Function getDiv has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.getDiv = function () {
        if (this.pe.length === 0 &&
            this.dci.length === 0 &&
            Object.keys(this.practicesGroup).length === 0 &&
            Object.keys(this.conceptsGroup).length === 0) {
    Severity: Major
    Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 3 hrs to fix

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

        this.getGradeLevel = function (gradeArray: any) {
          // some gradeArrays have been null
          if (!gradeArray) {
            return "UNKNOWN";
          }
      Severity: Minor
      Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 1 hr to fix

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

            const getGroupedDiv = function (groupMap: any, heading: any) {
              if (Object.keys(groupMap).length > 0) {
                //
                // For each statement display:
                //
        Severity: Minor
        Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 1 hr to fix

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

            this.add = function (statement: any) {
              const descArr = statement.description;
          
              const arrMap: any = {};
              arrMap[DCI] = this.dci;
          Severity: Minor
          Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 1 hr to fix

            Avoid too many return statements within this function.
            Open

                if (isSubset(ES, gradeArray)) { return "ES"; }
            Severity: Major
            Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return "UNKNOWN";
              Severity: Major
              Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status