Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function CourseEnrolOptions has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CourseEnrolOptions: FC<Props> = (props) => {
  const { intl, registrationInfo } = props;

  const dispatch = useAppDispatch();

Function FormSelectField has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FormSelectField = (props) => {
  const {
    field,
    fieldState,
    disabled,
Severity: Major
Found in client/app/lib/components/form/fields/SelectField.jsx - About 3 hrs to fix

Function MilestoneForm has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function ColorPickerField has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ColorPickerField = (props) => {
  const {
    intl,
    colorPickerColor,
    onClickColorPicker,

Function AvatarSelector has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AvatarSelector = (props: AvatarSelectorProps): JSX.Element => {
  const { t } = useTranslation();
  const [selectedImage, setSelectedImage] = useState<File>();
  const [cropping, setCropping] = useState(false);

Severity: Major
Found in client/app/lib/components/core/AvatarSelector.tsx - About 3 hrs to fix

Function mapDispatchToProps has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mapDispatchToProps(dispatch, ownProps) {
  const {
    match: {
      params: { submissionId },
    },

Function MaterialUpload has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MaterialUpload: FC<Props> = (props) => {
  const { intl, isOpen, handleClose, currFolderId } = props;

  const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);
  const [isSubmitting, setIsSubmitting] = useState(false);

Function AllAttemptsDisplay has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AllAttemptsDisplay: FC<Props> = (props) => {
  const { allAnswers, question, questionNumber, submissionEditUrl } = props;

  const { t } = useTranslation();

Function DuplicationPrompt has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DuplicationPrompt = (props: DuplicationPromptProps): JSX.Element => {
  const { for: question } = props;

  const { t } = useTranslation();
  const [duplicating, setDuplicating] = useState(false);

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

  render() {
    const { forumTopicPostPack } = this.props;
    const postPackIds = new Set(
      this.props.selectedPostPacks.map((pack) => pack.corePost.id),
    );

Function reducer has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const reducer = produce((draft: CoursesState, action: CoursesActionType) => {
  switch (action.type) {
    case SAVE_COURSE_LIST: {
      const courseList = action.courseList;
      const entityList = courseList.map((data) => ({
Severity: Major
Found in client/app/bundles/course/courses/store.ts - About 2 hrs to fix

Function HeartbeatDetailCard has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const HeartbeatDetailCard = (props: HeartbeatDetailCardProps): JSX.Element => {
  const { of: heartbeat } = props;

  const { t } = useTranslation();

Function LiveFeedbackHistoryPage has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LiveFeedbackHistoryPage: FC<Props> = (props) => {
  const { t } = useTranslation();
  const { questionNumber } = props;
  const allLiveFeedbackHistory = useAppSelector(getLiveFeedbackHistory);
  const nonEmptyLiveFeedbackHistory = allLiveFeedbackHistory.filter(

Function processColumns has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const processColumns = (includeRowNumber, columns) => {
  if (!columns.length) return columns;

  const processed = columns.map((column) => {
    if (!column.options?.alignCenter && !column.options?.hideInSmallScreen)
Severity: Minor
Found in client/app/lib/components/core/layouts/DataTable.jsx - About 2 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 ManageUsersTable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

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

  const { t } = useTranslation();

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

const HeartbeatsTimelineChart = (
  props: HeartbeatsTimelineChartProps,
): JSX.Element => {
  const { in: heartbeats } = props;

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

const PendingEnrolRequestsButtons: FC<Props> = (props) => {
  const { intl, enrolRequest } = props;
  const dispatch = useAppDispatch();
  const [isApproving, setIsApproving] = useState(false);
  const [isDeleting, setIsDeleting] = useState(false);

Function StoriesSettings has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const StoriesSettings = (): JSX.Element => {
  const { t } = useTranslation();
  const [form, setForm] = useState<FormEmitter<StoriesSettingsData>>();
  const [submitting, setSubmitting] = useState(false);

Severity: Major
Found in client/app/bundles/course/admin/pages/StoriesSettings/index.tsx - About 2 hrs to fix

Function PendingInvitationsButtons has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PendingInvitationsButtons: FC<Props> = (props) => {
  const { intl, invitation } = props;
  const dispatch = useAppDispatch();
  const [isResending, setIsResending] = useState(false);
  const [isDeleting, setIsDeleting] = useState(false);

Function renderButtons has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderButtons = (todo: TodoData): JSX.Element => {
    let accessButtonText = '';
    let accessButtonLink = '';

    // TODO: Refactor below by changing switch to dictionary
Severity
Category
Status
Source
Language