Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          isEnableObjectSelection: false,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          isCanvasSave: false,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          isRedo: false,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return { ...state, disabled: false };
Severity: Major
Found in client/app/bundles/course/assessment/reducers/editPage.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          fontSize,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          hasNoFill,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          colors: { ...colors, [coloringTool]: color },
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return produce(state, (draft) => {
        const currentState = draft[answerId];
        if (!currentState) throw new Error(`currentState is ${currentState}`);

        const currentStateIndex = currentState.currentStateIndex;
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          activeObject,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          isDelete: false,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [answerId]: {
          ...state[answerId],
          isEnableObjectSelection: true,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/scribing.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return redirect(`/courses/${courseId}/videos`);
Severity: Major
Found in client/app/bundles/course/video/attemptLoader.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return state;
Severity: Major
Found in client/app/bundles/course/assessment/question/scribing/store.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return a.updatedAt > b.updatedAt ? -1 : 1;

Avoid too many return statements within this function.
Open

            return a.updatedAt > b.updatedAt ? 1 : -1;

Avoid too many return statements within this function.
Open

    return drafting ? value : parsedValue;

Avoid too many return statements within this function.
Open

          return INVALID_HEARTBEAT_COLOR;

Avoid too many return statements within this function.
Open

            return VALID_HEARTBEAT_COLOR;

Avoid too many return statements within this function.
Open

    return t(translations.wrong);

Function formatErrorMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const formatErrorMessage = (errorOrWarning, intl = false) => {
  if (!errorOrWarning || typeof errorOrWarning === 'string') {
    return errorOrWarning;
  }
  if (Array.isArray(errorOrWarning)) {
Severity: Minor
Found in client/app/lib/components/form/fields/utils/mapError.js - About 25 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

Severity
Category
Status
Source
Language