Coursemology/coursemology2

View on GitHub

Showing 1,122 of 3,261 total issues

Function render has 524 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { scribing } = this.props;
    const toolBarStyle = !scribing.isCanvasLoaded
      ? styles.disabledToolbar
      : styles.toolBar;

Function SubmissionEditStepForm has 511 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionEditStepForm = (props) => {
  const {
    attachments,
    allConsideredCorrect,
    allowPartialSubmission,

Function SubmissionEditStepForm has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
Open

const SubmissionEditStepForm = (props) => {
  const {
    attachments,
    allConsideredCorrect,
    allowPartialSubmission,

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

const EnrolRequestsTable: FC<Props> = (props) => {
  const {
    title,
    enrolRequests,
    pendingEnrolRequests = false,

Function WorkbinTable has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
Open

const WorkbinTable: FC<Props> = (props) => {
  const {
    currFolderId,
    subfolders,
    materials,

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

const LeaderboardTable: FC<Props> = (props: Props) => {
  const { data, id: tableType } = props;
  const tabletView = useMedia.MinWidth('sm');
  const phoneView = useMedia.MinWidth('xs');
  const [maxAvatars, setMaxAvatars] = useState(6);

Function UsersTable has 302 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UsersTable: FC<Props> = (props) => {
  const { title, renderRowActionComponent, intl, filter, users, userCounts } =
    props;
  const [isLoading, setIsLoading] = useState(false);
  const dispatch = useAppDispatch();

Function InstanceUserRoleRequestsTable has 300 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstanceUserRoleRequestsTable: FC<Props> = (props) => {
  const {
    title,
    roleRequests,
    pendingRoleRequests = false,

Function CourseSettingsForm has 294 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CourseSettingsForm = (props: CourseSettingsFormProps): JSX.Element => {
  const { t } = useTranslation();
  const [offsetTimesPrompt, setOffsetTimesPrompt] = useState(false);
  const [deletingCourse, setDeletingCourse] = useState(false);
  const [stagedLogo, setStagedLogo] = useState<File>();

Function StudentPerformanceTable has 282 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function UsersTable has 270 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UsersTable: FC<Props> = (props) => {
  const { title, renderRowActionComponent, intl, users, userCounts, filter } =
    props;
  const [isLoading, setIsLoading] = useState(false);
  const dispatch = useAppDispatch();

Function SkillsTable has 267 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SkillsTable: FC<Props> = (props: Props) => {
  const {
    data,
    intl,
    tableType,

Function QuestionForm has 256 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const QuestionForm = (props) => {
  const { disabled, initialValues, onSubmit, intl } = props;
  const {
    control,
    handleSubmit,

Function ResponseIndex has 254 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ResponseIndex = (props) => {
  const { dispatch, survey, responses, isLoading } = props;
  const { palette } = useTheme();
  const { NOT_STARTED, RESPONDING, SUBMITTED } = responseStatus;
  const dataColor = {
Severity: Major
Found in client/app/bundles/course/survey/pages/ResponseIndex/index.jsx - About 1 day to fix

Function SubmissionsTableRow has 254 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionsTableRow = (props) => {
  const { assessment, assessmentId, courseId, dispatch, submission } = props;
  const palette = useTheme().palette;
  const [state, setState] = useState({
    unsubmitConfirmation: false,

Function AccountSettingsForm has 254 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AccountSettingsForm = (props: AccountSettingsFormProps): JSX.Element => {
  const { t } = useTranslation();
  const [stagedImage, setStagedImage] = useState<File>();
  const [requirePasswordConfirmation, setRequirePasswordConfirmation] =
    useState(true);
Severity: Major
Found in client/app/bundles/user/AccountSettings/AccountSettingsForm.tsx - About 1 day to fix

Function AchievementAwardManager has 245 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AchievementAwardManager: FC<Props> = (props) => {
  const { achievement, isLoading, handleClose, intl, setIsDirty } = props;
  const achievementUsers = achievement.achievementUsers;

  const [openConfirmation, setOpenConfirmation] = useState(false);

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

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

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);
Severity
Category
Status
Source
Language