Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function ForumsSettingsForm has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumsSettingsForm = (props: ForumsSettingsFormProps): JSX.Element => {
  const { t } = useTranslation();

  return (
    <Form

Function VideoSubmissionsTable has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideoSubmissionsTable: FC<Props> = (props) => {
  const { title, videoSubmissions, intl } = props;

  const options: TableOptions = {
    download: false,

Function PendingRoleRequestsButtons has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PendingRoleRequestsButtons: FC<Props> = (props) => {
  const { roleRequest } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();
  const [isApproving, setIsApproving] = useState(false);

Function default has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (state = {}, action) {
  switch (action.type) {
    case actions.FETCH_SUBMISSION_SUCCESS:
    case actions.FINALISE_SUCCESS:
    case actions.UNSUBMIT_SUCCESS:

Function CodaveriSettingsForm has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CodaveriSettingsForm = (
  props: CodaveriSettingsFormProps,
): JSX.Element => {
  const { settings } = props;
  const { t } = useTranslation();

Function AchievementForm has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AchievementForm: FC<Props> = (props) => {
  const {
    open,
    title,
    conditionAttributes,

Function ProgrammingForm has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ProgrammingForm = (props: ProgrammingFormProps): JSX.Element => {
  const [data, setData] = useState(props.with);

  const { t } = useTranslation();

Function shouldComponentUpdate has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  shouldComponentUpdate(nextProps) {
    if (this.canvas) {
      this.canvas.isDrawingMode = nextProps.scribing.isDrawingMode;
      this.canvas.freeDrawingBrush.color =
        nextProps.scribing.colors[scribingToolColor.DRAW];

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 StudentsStatisticsTable has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const StudentsStatisticsTable: FC<Props> = (props) => {
  const {
    metadata: {
      isCourseGamified,
      showVideo,

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 TimePopupForm has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TimePopupForm = (props: TimePopupFormProps): JSX.Element => {
  const { for: time } = props;

  const { t } = useTranslation();

Function TestCaseComponent has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TestCaseComponent: FC<TestCaseComponentProps> = (props) => {
  const { testCaseResults, testCaseType } = props;
  const { t } = useTranslation();

  const isProgrammingAnswerEvaluated =

Function QuestionFormOption has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const QuestionFormOption = (props) => {
  const {
    fieldsConfig,
    field,
    index,

Function ExperiencePointsTableRow has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ExperiencePointsTableRow: FC<Props> = (props) => {
  const { record, isStudentPage, disabled } = props;
  const [isDirty, setIsDirty] = useState(false);
  const [rowData, setRowData] = useState({
    id: record.id,

Function AchievementShow has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AchievementShow: FC<Props> = (props) => {
  const { intl } = props;
  const courseId = getCourseId();
  const [isLoading, setIsLoading] = useState(true);
  const dispatch = useAppDispatch();
Severity: Major
Found in client/app/bundles/course/achievement/pages/AchievementShow/index.tsx - About 3 hrs to fix

Function FileManager has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

const FileManager = (props: FileManagerProps): JSX.Element => {
  const { disabled, intl } = props;

  const [materials, setMaterials] = useState(props.materials ?? []);
  const [uploadingMaterials, setUploadingMaterials] = useState<Material[]>([]);
Severity: Minor
Found in client/app/bundles/course/assessment/components/FileManager/index.tsx - 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 reducer has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const reducer = produce((draft: UsersState, action: UsersActionType) => {
  switch (action.type) {
    case SAVE_USER_LIST: {
      const userList = action.userList;
      const entityList = userList.map((data) => ({
Severity: Major
Found in client/app/bundles/course/users/store.ts - About 3 hrs to fix

Function InviteUsersFileUpload has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InviteUsersFileUpload: FC<Props> = (props) => {
  const { open, onClose, openResultDialog } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Function TimelinesOverviewItem has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TimelinesOverviewItem = (
  props: TimelinesOverviewItemProps,
): JSX.Element => {
  const { for: timeline } = props;

Function default has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (state = {}, action) {
  switch (action.type) {
    case actions.FETCH_SUBMISSION_SUCCESS: {
      if (action.payload.history) {
        return {

Function CodaveriEvaluatorToggleButton has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CodaveriEvaluatorToggleButton: FC<CodaveriEvaluatorToggleButtonProps> = (
  props,
) => {
  const { assessmentIds, for: title, type } = props;
  const { t } = useTranslation();
Severity
Category
Status
Source
Language