Coursemology/coursemology2

View on GitHub

Showing 1,214 of 1,261 total issues

Function StudentsStatisticsTable has 219 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function ForumTopicTable has 217 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumTopicTable: FC<Props> = (props) => {
  const { forum, forumTopics } = props;
  const { t } = useTranslation();

  if (!forum || forumTopics.length === 0) {
Severity: Major
Found in client/app/bundles/course/forum/components/tables/ForumTopicTable.tsx - About 1 day to fix

Function CommentCard has 213 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CommentCard: FC<Props> = (props) => {
  const { intl, post } = props;
  const dispatch = useAppDispatch();
  const [editMode, setEditMode] = useState(false);
  const [isSaving, setIsSaving] = useState(false);

Function UserInvitationsTable has 211 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UserInvitationsTable: FC<Props> = (props) => {
  const {
    title,
    invitations,
    pendingInvitations = false,

Function Category has 209 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Category = (props: CategoryProps): JSX.Element => {
  const { category, index } = props;
  const { t } = useTranslation();
  const { settings, createTabInCategory, deleteCategory, moveTabs } =
    useAssessmentSettings();

Function VideoTable has 209 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideoTable: FC<Props> = (props) => {
  const { videos, permissions, onTogglePublished, intl } = props;
  const videoMetadata = useAppSelector(getVideoMetadata);

  if (videos && videos.length === 0) {
Severity: Major
Found in client/app/bundles/course/video/components/tables/VideoTable.tsx - About 1 day to fix

Function PersonalTimeEditor has 207 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PersonalTimeEditor: FC<Props> = (props) => {
  const { item, intl } = props;
  const initialValues = {
    fixed: item.fixed,
    startAt: item.personalStartAt,

Function QuestionGrade has 206 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const QuestionGrade: FC<QuestionGradeProps> = (props) => {
  const { questionId, isSaving } = props;

  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Function TopicCard has 204 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TopicCard: FC<TopicCardProps> = (props) => {
  const { topic } = props;
  const { t } = useTranslation();

  const dispatch = useAppDispatch();

Function AssessmentsStatisticsTable has 204 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentsStatisticsTable: FC<Props> = (props) => {
  const { numStudents, assessments } = props;
  const courseId = getCourseId();
  const { t } = useTranslation();

Function reducer has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

const reducer = produce((draft: CommentState, action: CommentActionType) => {
  switch (action.type) {
    case SAVE_COMMENT_TAB: {
      draft.permissions = { ...action.permissions };
      draft.settings = { ...action.settings };
Severity: Minor
Found in client/app/bundles/course/discussion/topics/store.ts - About 1 day 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 SurveyForm has 200 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SurveyForm = (props) => {
  const { intl, onSubmit, disabled, disableAnonymousToggle, initialValues } =
    props;
  const {
    control,

Function SkillDialog has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

const SkillDialog: FC<Props> = (props) => {
  const {
    open,
    onClose,
    dialogType,

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

const StudentAttemptCountTable: FC<Props> = (props) => {
  const { t } = useTranslation();
  const { courseId, assessmentId } = useParams();
  const { includePhantom } = props;

Function AchievementTable has 192 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AchievementTable: FC<Props> = (props) => {
  const { achievements, permissions, onTogglePublished, isReordering } = props;

  if (achievements && achievements.length === 0) {
    return (

Function SubmissionForm has 192 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionForm: FC<Props> = (props) => {
  const { step } = props;

  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Function SurveyDetails has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SurveyDetails = (props) => {
  const { survey, courseId, disabled } = props;
  const navigate = useNavigate();

  const dispatch = useAppDispatch();
Severity: Major
Found in client/app/bundles/course/survey/pages/SurveyShow/SurveyDetails.jsx - About 7 hrs to fix

Function AssessmentShowPage has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentShowPage = (props: AssessmentShowPageProps): JSX.Element => {
  const { for: assessment } = props;
  const { t } = useTranslation();

  const isKoditsu = assessment.isKoditsuAssessmentEnabled;

Function UserInvitationsTable has 173 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UserInvitationsTable: FC<Props> = (props) => {
  const {
    title,
    invitations,
    pendingInvitations = false,

Function ManageUsersTable has 171 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ManageUsersTable = (props: ManageUsersTableProps): JSX.Element => {
  const { users, manageStaff, timelinesMap, renderRowActionComponent } = props;

  const { t } = useTranslation();

Severity
Category
Status
Source
Language