Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function ScribingQuestionForm has 170 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ScribingQuestionForm = (props) => {
  const { data, initialValues, scribingId } = props;

  const { t } = useTranslation();

Function Solution has 168 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  (props, ref): JSX.Element => {
    const { disabled, for: originalSolution } = props;

    const [solution, setSolution] = useState(originalSolution);
    const [toBeDeleted, setToBeDeleted] = useState(false);

Function AssessmentShowPage has 168 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 DisbursementForm has 166 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DisbursementForm: FC<Props> = (props) => {
  const { intl, courseUsers } = props;

  const courseGroups = useAppSelector(getAllCourseGroupMiniEntities);

Function PendingTodosTable has 165 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PendingTodosTable: FC<Props> = (props) => {
  const { intl, todos, todoType } = props;

  const [shavedTodos, setShavedTodos] = useState(todos.slice(0, 5));
  const [end, setEnd] = useState(10);

Function EmailsList has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EmailsList = (props: EmailCardProps): JSX.Element => {
  const { t } = useTranslation();
  const [emailToRemove, setEmailToRemove] = useState<EmailData>();

  const removeEmail = (email: EmailData): void => {
Severity: Major
Found in client/app/bundles/user/components/EmailsList.tsx - About 6 hrs to fix

Function CodaveriCommentCard has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CodaveriCommentCard = (props) => {
  const {
    editValue,
    handleChange,
    updateComment,

Function SubmissionsTable has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionsTable: FC<Props> = (props) => {
  const {
    intl,
    isGamified,
    submissions,

Function StudentProgressionChart has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const StudentProgressionChart: FC<Props> = (props) => {
  const { assessments, submissions } = props;
  const { t } = useTranslation();
  const [selectedStudentIndex, setSelectedStudentIndex] = useState(null);
  const [showOpeningTimes, setShowOpeningTimes] = useState(true);

Function useTanStackTableBuilder has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useTanStackTableBuilder = <D extends object>(
  props: TableTemplate<D>,
): TanStackTableProps<D> => {
  const [columns, getRealColumn] = buildTanStackColumns(
    props.columns,

Function SubmissionTabs has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionTabs: FC<Props> = (props) => {
  const {
    intl,
    canManage,
    isTeachingStaff,

Function Dashboard has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Dashboard = (props) => {
  const { dispatch, intl, isLoading, nodes, response, selectedElement } = props;

  const [deleteArrowConfirmation, setDeleteArrowConfirmation] = useState(false);
  const isEmptyResponse =
Severity: Major
Found in client/app/bundles/course/learning-map/containers/Dashboard/index.jsx - About 6 hrs to fix

Function VideoForm has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideoForm: FC<Props> = (props) => {
  const {
    open,
    editing,
    title,
Severity: Major
Found in client/app/bundles/course/video/components/forms/VideoForm.tsx - About 6 hrs to fix

Function LeaderboardIndex has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LeaderboardIndex: FC<Props> = (props) => {
  const { intl } = props;
  const dispatch = useAppDispatch();
  const tabView = useMedia.MinWidth('lg');
  const [isLoading, setIsLoading] = useState(true);

Function ForumTable has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumTable: FC<Props> = (props) => {
  const { forums } = props;
  const { t } = useTranslation();
  if (forums && forums.length === 0) {
    return <Note message={t(translations.noForum)} />;
Severity: Major
Found in client/app/bundles/course/forum/components/tables/ForumTable.tsx - About 6 hrs to fix

Function ForumDisbursementTable has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumDisbursementTable: FC<Props> = (props: Props) => {
  const { intl, forumUsers, onPostClick } = props;

  const columns: TableColumns[] = [
    {

Function Tab has 153 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Tab = (props: TabProps): JSX.Element => {
  const { tab, index, stationary, disabled } = props;
  const { t } = useTranslation();
  const { settings, deleteTabInCategory, moveAssessments } =
    useAssessmentSettings();

Function ForumPostTable has 153 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumPostTable: FC<Props> = (props: Props) => {
  const { intl, posts: data } = props;

  const columns: TableColumns[] = [
    {

Function StudentPerformanceTable has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

const StudentPerformanceTable: FC<Props> = (props) => {
  const {
    students,
    hasPersonalizedTimeline,
    isCourseGamified,

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 152 lines of code (exceeds 25 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: Major
Found in client/app/bundles/course/discussion/topics/store.ts - About 6 hrs to fix
Severity
Category
Status
Source
Language