rails/react-components/src/library/helpers/standards-helpers.tsx
Function NgssHelper
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
Open
const NgssHelper = function () {
const PE = "Performance Expectations";
const DCI = "Disciplinary Core Ideas";
const PRACTICES = "Science and Engineering Practices";
const CONCEPTS = "Crosscutting Concepts";
- Read upRead up
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
Open
const NgssHelper = function () {
const PE = "Performance Expectations";
const DCI = "Disciplinary Core Ideas";
const PRACTICES = "Science and Engineering Practices";
const CONCEPTS = "Crosscutting Concepts";
Function getDiv
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function getGradeLevel
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.getGradeLevel = function (gradeArray: any) {
// some gradeArrays have been null
if (!gradeArray) {
return "UNKNOWN";
}
Function getGroupedDiv
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getGroupedDiv = function (groupMap: any, heading: any) {
if (Object.keys(groupMap).length > 0) {
//
// For each statement display:
//
Function add
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.add = function (statement: any) {
const descArr = statement.description;
const arrMap: any = {};
arrMap[DCI] = this.dci;
Avoid too many return
statements within this function. Open
Open
if (isSubset(ES, gradeArray)) { return "ES"; }
Avoid too many return
statements within this function. Open
Open
return "UNKNOWN";