Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function PackageUploader has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PackageUploader = (props: PackageUploaderProps): JSX.Element => {
  const { control } = useFormContext<ProgrammingFormData>();

  const { t } = useTranslation();

Function CourseStatistics has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CourseStatistics: FC = () => {
  return (
    <>
      <Preload
        render={<LoadingIndicator />}

Function AlgorithmMenu has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AlgorithmMenu = (props: AlgorithmMenuProps): JSX.Element => {
  const { for: user } = props;

  const dispatch = useAppDispatch();

Function Comment has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Comment: FC<Props> = (props) => {
  const { comments } = props;
  const { t } = useTranslation();

  return (

Function InstanceAnnouncementsIndex has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstanceAnnouncementsIndex: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(true);
  const [isOpen, setIsOpen] = useState(false);

Function submitAnswer has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function submitAnswer(questionId, answerId, rawAnswer, resetField) {
  const currentTime = Date.now();
  const answer = formatAnswer(rawAnswer, currentTime);
  const payload = { answer };

Function uploadTextResponseFiles has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function uploadTextResponseFiles(answerId, answer, resetField) {
  const payload = {
    answer: {
      id: answerId,
      files: answer.files,

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

  render() {
    const { dispatch, visibility } = this.props;
    const itemTypes = Object.keys(visibility);

    if (itemTypes.length < 1) {

Function Levels has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Levels = (props) => {
  const {
    gateInputSizeThreshold,
    getGateConnectionPointId,
    getGateId,
Severity: Minor
Found in client/app/bundles/course/learning-map/containers/Levels/index.jsx - About 1 hr to fix

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

const reducer = produce((draft: FoldersState, action: FoldersActionType) => {
  switch (action.type) {
    case SAVE_FOLDER: {
      draft.currFolderInfo = action.currFolderInfo;

Severity: Minor
Found in client/app/bundles/course/material/folders/store.ts - About 1 hr to fix

Function BrandingHead has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BrandingHead = (props: BrandingHeadProps): JSX.Element => {
  const { t } = useTranslation();

  const courseSwitcherRef =
    useRef<ComponentRef<typeof CourseSwitcherPopupMenu>>(null);
Severity: Minor
Found in client/app/lib/components/navigation/BrandingHead.tsx - About 1 hr to fix

Function ItemsSidebar has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ItemsSidebar = (props: ItemsSidebarProps): JSX.Element => {
  const { for: items, within: timelines } = props;

  return (
    <aside className={`h-fit shrink-0 ${props.className ?? ''}`}>

Method find_compre_keyword_in_answer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def find_compre_keyword_in_answer(answer_text_lemma_array, lifted_word_status, hash)
    keyword_status = Array.new(answer_text_lemma_array.length, nil)

    answer_text_lemma_array.each_with_index do |answer_text_lemma_word, index|
      next unless lifted_word_status[index].nil? ||

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

  def create # rubocop:disable Metrics/AbcSize
    authorize! :access, @assessment

    existing_submission = @assessment.submissions.find_by(creator: current_user)
    create_success_response(existing_submission) and return if existing_submission

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 CommentCard has a Cognitive Complexity of 14 (exceeds 5 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);

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

const TimePopup = (props: TimePopupProps): JSX.Element => {
  const {
    anchorsOn: anchorElement,
    for: time,
    assignedIn: timeline,

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

const DurationBar = (props: DurationBarProps): JSX.Element => {
  const start = moment(props.starts).startOf('day');
  const bonus = props.bonusEnds && moment(props.bonusEnds).startOf('day');
  const end = props.ends && moment(props.ends).startOf('day');

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

const AssessmentForm = (props: AssessmentFormProps): JSX.Element => {
  const {
    conditionAttributes,
    disabled,
    editing,

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

const SubmissionsIndex = (): JSX.Element => {
  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 AssessmentsTable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const AssessmentsTable = (props: AssessmentsTableProps): JSX.Element => {
  const { display, assessments } = props.assessments;
  const { t } = useTranslation();

  const columns: ColumnTemplate<AssessmentListData>[] = [

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

Severity
Category
Status
Source
Language