Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function ForumPostResponse has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumPostResponse = (props) => {
  const [errorMessage, setErrorMessage] = useState('');
  const { question, readOnly, answerId, saveAnswerAndUpdateClientVersion } =
    props;
  const { control } = useFormContext();

Function buildGenerateRequestPayload has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const buildGenerateRequestPayload = (
  codaveriData: CodaveriGenerateFormData,
  questionData: QuestionPrototypeFormData,
): FormData => {
  const data = new FormData();

Function ForumForm has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumForm: FC<Props> = (props) => {
  const { open, editing, title, onClose, initialValues, onSubmit } = props;
  const { t } = useTranslation();

  return (
Severity: Major
Found in client/app/bundles/course/forum/components/forms/ForumForm.tsx - About 2 hrs to fix

Function DeleteTimelinePrompt has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DeleteTimelinePrompt = (
  props: DeleteTimelinePromptProps,
): JSX.Element => {
  const { deletes: timeline } = props;

Function ForumTopicPostEditActionButtons has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumTopicPostEditActionButtons: FC<Props> = (props) => {
  const { post, editValue, setIsEditing } = props;
  const [discardEditPrompt, setDiscardEditPrompt] = useState(false);
  const dispatch = useAppDispatch();
  const { t } = useTranslation();

Function NodeToGateArrows has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NodeToGateArrows = (props) => {
  const {
    arrowAnchorPositions,
    arrowProperties,
    canModify,

Function renderSubmissionTable has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderSubmissionTable() {
    const {
      submission: {
        workflowState,
        bonusEndAt,

Function shouldComponentUpdate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  shouldComponentUpdate(nextProps) {
    if (this.canvas) {
      this.canvas.isDrawingMode = nextProps.scribing.isDrawingMode;
      this.canvas.freeDrawingBrush.color =
        nextProps.scribing.colors[scribingToolColor.DRAW];

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

  render() {
    const {
      submissionState,
      showPrivate,
      showEvaluation,

Function VideosSettings has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideosSettings = (): JSX.Element => {
  const reloadItems = useItemsReloader();
  const { t } = useTranslation();
  const [form, setForm] = useState<FormEmitter<VideosSettingsData>>();
  const [submitting, setSubmitting] = useState(false);
Severity: Major
Found in client/app/bundles/course/admin/pages/VideosSettings/index.tsx - About 2 hrs to fix

Function SubmissionTimeAndGradeChart has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionTimeAndGradeChart: FC<Props> = (props) => {
  const { t } = useTranslation();
  const { submissions } = props;
  const { labels, lineData, barData } = processSubmissionsIntoChartData(
    submissions.map(processSubmission),

Function CoursesIndex has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CoursesIndex: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(false);
  const [filter, setFilter] = useState({ active: false });
  const courseCounts = useAppSelector(getAdminCounts);
Severity: Major
Found in client/app/bundles/system/admin/admin/pages/CoursesIndex.tsx - About 2 hrs to fix

Function TopicCard has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const TopicCard: FC<TopicCardProps> = (props) => {
  const { topic } = 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 render has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      src,
      alt,
      file,
Severity: Major
Found in client/app/lib/components/core/Thumbnail.jsx - About 2 hrs to fix

Function Node has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Node = (props) => {
  const { canModify, getNodeConnectionPointId, node } = props;

  const [isNodeMenuDisplayed, setIsNodeMenuDisplayed] = useState(false);
  const zIndex = isNodeMenuDisplayed ? 999 : node.depth + 2;
Severity: Major
Found in client/app/bundles/course/learning-map/components/Node/index.jsx - About 2 hrs to fix

Function SessionDetailsPopup has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SessionDetailsPopup = (props: SessionDetailsPopupProps): JSX.Element => {
  const {
    anchorsOn: anchorElement,
    for: name,
    showing: heartbeats,

Function AddEmailSubsection has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AddEmailSubsection = (props: AddEmailSubsectionProps): JSX.Element => {
  const { t } = useTranslation();
  const [email, setEmail] = useState('');
  const [error, setError] = useState('');
  const [expanded, setExpanded] = useState(false);
Severity: Major
Found in client/app/bundles/user/components/AddEmailSubsection.tsx - About 2 hrs to fix

Function SectionForm has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function onload has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.image.onload = () => {
      // Get the calculated width of canvas, 800 is min width for scribing toolbar
      const element = document.getElementById(`canvas-${answerId}`);
      const maxWidth = Math.max(element.getBoundingClientRect().width, 800);

Function AssessmentList has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentList: FC<Props> = (props) => {
  const { courseTitle } = props;
  const assessmentCategories = useAppSelector((state) =>
    getAllAssessmentCategories(state),
  );
Severity
Category
Status
Source
Language