Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function AssessmentEdit has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentEdit = (): JSX.Element => {
  const assessmentId = getAssessmentId();
  if (!assessmentId) {
    return <div />;
  }
Severity: Major
Found in client/app/bundles/course/assessment/pages/AssessmentEdit/index.tsx - About 2 hrs to fix

Function FormDateTimePickerField has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FormDateTimePickerField = (props) => {
  const {
    afterChangeField,
    field,
    fieldState,
Severity: Major
Found in client/app/lib/components/form/fields/DateTimePickerField.jsx - About 2 hrs to fix

Method personal_end_at_hash has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def personal_end_at_hash(assessment_id_array, course_id)
    personal_end_at = Course::PersonalTime.find_by_sql(<<-SQL.squish
      WITH course_user_personal_end_at AS (
        SELECT cpt.course_user_id, cpt.end_at, clpi.actable_id AS assessment_id
        FROM course_personal_times cpt
Severity: Major
Found in app/controllers/concerns/course/statistics/reference_times_concern.rb - About 2 hrs to fix

Function AnnouncementsDisplay has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AnnouncementsDisplay: FC<Props> = (props) => {
  const {
    intl,
    announcements,
    announcementPermissions,

Function MarkAnswerButton has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MarkAnswerButton = (props: Props): JSX.Element | null => {
  const { topic, isAnswer, post } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Function ForumTopicPostManagementButtons has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumTopicPostManagementButtons: FC<Props> = (props) => {
  const { post, topicId, handleEdit, handleReply, isEditing, disabled } = props;
  const dispatch = useAppDispatch();
  const { t } = useTranslation();
  const navigate = useNavigate();

Function addGroup has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const addGroup = (): void => {
    const groupData = data as
      | GroupLeaderboardPoints[]
      | GroupLeaderboardAchievement[];
    columns.push(

Function BulkAssignTimelineButton has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BulkAssignTimelineButton = (
  props: BulkAssignTimelineButtonProps,
): JSX.Element => {
  const { t } = useTranslation();

Function SessionBlobLegend has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SessionBlobLegend = (props: SessionBlobLegendProps): JSX.Element => {
  const { t } = useTranslation();

  return (
    <Tooltip

Function TabbedViewQuestions has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TabbedViewQuestions: FC<Props> = (props) => {
  const { handleNext, maxStep, stepIndex, setStepIndex } = props;

  const assessment = useAppSelector(getAssessment);
  const submission = useAppSelector(getSubmission);

Function InstanceComponentsIndex has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstanceComponentsIndex: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(false);
  const [isUpdating, setIsUpdating] = useState(false);
  const [components, setComponents] = useState<ComponentData[]>([]);

Function IndividualInvitation has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const IndividualInvitation: FC<Props> = (props) => {
  const { fieldsConfig, index, intl } = props;

  const renderInvitationBody = (
    <Grid alignItems="center" container flexWrap="nowrap">

Function RespondButton has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const RespondButton = ({
  courseId,
  surveyId,
  responseId,
  canRespond,
Severity: Minor
Found in client/app/bundles/course/survey/containers/RespondButton/index.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

Method upcoming_items_from_course_by_type_for_course_user has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def self.upcoming_items_from_course_by_type_for_course_user(course_user)
    course = course_user.course
    opening_items = course.lesson_plan_items.published.
                    with_reference_times_for(course_user).
                    with_personal_times_for(course_user).
Severity: Minor
Found in app/models/course/lesson_plan/item.rb - 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 CodaveriCommentCard has a Cognitive Complexity of 17 (exceeds 5 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);

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

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

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

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

const ExplanationPanel: FC<Props> = (props) => {
  const { questionId } = 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 renderRow has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderRow(setting) {
    const componentTitle =
      setting.title ??
      (settingComponents[setting.component] ? (
        <FormattedMessage {...settingComponents[setting.component]} />
Severity: Major
Found in client/app/bundles/course/admin/pages/NotificationSettings/index.jsx - About 2 hrs to fix

Function InviteUsers has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InviteUsers: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(true);
  const [showInvitationResultDialog, setShowInvitationResultDialog] =
    useState(false);

Function AchievementManagementButtons has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AchievementManagementButtons: FC<Props> = (props) => {
  const { achievement, navigateToIndex } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();
  const navigate = useNavigate();
Severity
Category
Status
Source
Language