Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function PersonalTimeEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const PersonalTimeEditor: FC<Props> = (props) => {
  const { item, intl } = props;
  const initialValues = {
    fixed: item.fixed,
    startAt: item.personalStartAt,
Severity: Minor
Found in client/app/bundles/course/users/components/misc/PersonalTimeEditor.tsx - About 35 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

Function CoursesIndex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const CoursesIndex: FC = () => {
  const { t } = useTranslation();

  const [params] = useSearchParams();

Severity: Minor
Found in client/app/bundles/course/courses/pages/CoursesIndex/index.tsx - About 35 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

Function McqWidget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const McqWidget = (props: McqWidgetProps): JSX.Element | null => {
  const { for: question } = props;
  const { t } = useTranslation();
  const [expanded, setExpanded] = useState(false);

Severity: Minor
Found in client/app/bundles/course/assessment/pages/AssessmentShow/McqWidget.tsx - About 35 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

Function FinaliseButton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const FinaliseButton: FC = () => {
  const { t } = useTranslation();
  const assessment = useAppSelector(getAssessment);
  const submission = useAppSelector(getSubmission);
  const questions = useAppSelector(getQuestions);

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 { ...state, isUnsubmittingResponse: false };
Severity: Major
Found in client/app/bundles/course/survey/reducers/surveysFlags.js - 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/submission/reducers/answers.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

      return { ...state, isQuestionMoved: true };
Severity: Major
Found in client/app/bundles/course/survey/reducers/surveysFlags.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return { ...state, isQuestionMoved: false, disableSurveyShow: false };
Severity: Major
Found in client/app/bundles/course/survey/reducers/surveysFlags.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return (
    <Typography color="error" variant="body2">
      <FormattedMessage
        defaultMessage="Failed submitting this form. Please try again."
        id="lib.components.core.ErrorText.error"
Severity: Major
Found in client/app/lib/components/core/ErrorText.jsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return { ...state, isUnsubmittingResponse: true };
Severity: Major
Found in client/app/bundles/course/survey/reducers/surveysFlags.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return { ...state, confirmationOpen: true };
Severity: Major
Found in client/app/bundles/course/duplication/store.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return { ...state, confirmationOpen: false };
Severity: Major
Found in client/app/bundles/course/duplication/store.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return produce(state, (draft) => {
        draft.clientVersionByAnswerId[answerId] = clientVersion;
      });
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/answers.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return { ...state, isDuplicating: false, isDuplicationSuccess: true };
Severity: Major
Found in client/app/bundles/course/duplication/store.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        isUpdatingComment: false,
        posts: {
          ...state.posts,
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/commentForms.js - 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/submission/reducers/annotations.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        milestones,
        groups: groupItemsUnderMilestones(state.items, milestones),
      };
Severity: Major
Found in client/app/bundles/course/lesson-plan/reducers/lessonPlan.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        response: action.response,
        flags: { ...state.flags, ...action.flags },
      };
Severity: Major
Found in client/app/bundles/course/survey/reducers/responseForm.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return {
        ...state,
        [questionId]: {
          ...state[questionId],
          isResetting: false,
Severity
Category
Status
Source
Language