Coursemology/coursemology2

View on GitHub
client/app/bundles/course/survey/pages/ResponseIndex/index.jsx

Summary

Maintainability
D
2 days
Test Coverage

Function ResponseIndex has 254 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ResponseIndex = (props) => {
  const { dispatch, survey, responses, isLoading } = props;
  const { palette } = useTheme();
  const { NOT_STARTED, RESPONDING, SUBMITTED } = responseStatus;
  const dataColor = {
Severity: Major
Found in client/app/bundles/course/survey/pages/ResponseIndex/index.jsx - About 1 day to fix

Function ResponseIndex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const ResponseIndex = (props) => {
  const { dispatch, survey, responses, isLoading } = props;
  const { palette } = useTheme();
  const { NOT_STARTED, RESPONDING, SUBMITTED } = responseStatus;
  const dataColor = {
Severity: Minor
Found in client/app/bundles/course/survey/pages/ResponseIndex/index.jsx - About 3 hrs 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 renderStats has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderStats = (realResponsesStatuses, phantomResponsesStatuses) => {
    const chartData = [NOT_STARTED, RESPONDING, SUBMITTED].map((data) => {
      const count = state.includePhantomsInStats
        ? realResponsesStatuses[data] + phantomResponsesStatuses[data]
        : realResponsesStatuses[data];
Severity: Minor
Found in client/app/bundles/course/survey/pages/ResponseIndex/index.jsx - About 1 hr to fix

Function renderBody has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderBody = () => {
    if (isLoading) {
      return <LoadingIndicator />;
    }

Severity: Minor
Found in client/app/bundles/course/survey/pages/ResponseIndex/index.jsx - About 1 hr to fix

There are no issues that match your filters.

Category
Status