Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function GenerateConversation has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const GenerateConversation: FC<Props> = (props) => {
  const { t } = useTranslation();
  const {
    languages,
    onGenerate,

Function SkillsTable has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

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

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

const Question = (props: QuestionProps): JSX.Element => {
  const { of: question, index, dragging, draggedTo, disabled } = props;
  const { t } = useTranslation();
  const [duplicating, setDuplicating] = useState(false);

Function AccountSettings has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AccountSettings = (): JSX.Element => {
  const { t } = useTranslation();
  const [form, setForm] = useState<FormEmitter<AccountSettingsData>>();
  const [reloadForm, setReloadForm] = useState(false);
  const [submitting, setSubmitting] = useState(false);
Severity: Major
Found in client/app/bundles/user/AccountSettings/index.tsx - About 5 hrs to fix

Function InvitationResultDialog has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InvitationResultDialog: FC<Props> = (props) => {
  const { open, handleClose, invitationResult, intl } = props;
  const {
    duplicateUsers,
    existingCourseUsers,

Function renderDownloadDropdown has 129 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderDownloadDropdown() {
    const {
      assessment,
      handleDownload,
      handleDownloadStatistics,

Function SkillDialog has 128 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SkillDialog: FC<Props> = (props) => {
  const {
    open,
    onClose,
    dialogType,

Function SubmissionsIndex has 128 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionsIndex = (): JSX.Element => {
  const { t } = useTranslation();

  const dispatch = useAppDispatch();

Severity: Major
Found in client/app/bundles/course/assessment/submissions/SubmissionsIndex.tsx - About 5 hrs to fix

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

const reducer = produce((state, action) => {
  switch (action.type) {
    case actionTypes.FETCH_LEARNING_MAP_SUCCESS:
      return {
        ...state,
Severity: Major
Found in client/app/bundles/course/learning-map/store.ts - About 5 hrs to fix

Function ThemeProvider has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ThemeProvider = (props: ThemeProviderProps): JSX.Element => {
  const theme = createTheme({
    palette,
    // https://material-ui.com/customization/themes/#typography---html-font-size
    // https://material-ui.com/style/typography/#migration-to-typography-v2
Severity: Major
Found in client/app/lib/components/wrappers/ThemeProvider.tsx - About 5 hrs to fix

Function LoadedAssessmentSettings has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LoadedAssessmentSettings = (
  props: LoadedAssessmentSettingsProps,
): JSX.Element | null => {
  const { t } = useTranslation();
  const [form, setForm] = useState<FormEmitter<AssessmentSettingsData>>();
Severity: Major
Found in client/app/bundles/course/admin/pages/AssessmentSettings/index.tsx - About 5 hrs to fix

Function SubmissionAnswer has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionAnswer = <T extends keyof typeof QuestionType>(
  props: SubmissionAnswerProps<T>,
): JSX.Element => {
  const {
    answerId,

Function AssessmentsSettingsForm has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentsSettingsForm = (
  props: AssessmentsSettingsFormProps,
): JSX.Element => {
  const { t } = useTranslation();
  const validationSchema = yup.object({

Function McqMrqForm has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const McqMrqForm = <T extends 'new' | 'edit'>(
  props: McqMrqFormProps<T>,
): JSX.Element => {
  const { adapter, with: data } = props;

Function renderFeedbackCard has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderFeedbackCard = (filename, feedbackItem) => {
    let cardStyle = styles.card;
    if (feedbackItem.state === 'resolved') {
      cardStyle = { ...styles.card, ...styles.cardResolved };
    } else if (feedbackItem.state === 'dismissed') {

Function WorkbinTable has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function SubmissionFilter has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmissionFilter: FC<Props> = (props) => {
  const {
    intl,
    filter,
    tabCategories,

Function CoursesTable has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CoursesTable = (props: CoursesTableProps): JSX.Element => {
  const { courses, renderRowActionComponent } = props;
  const { t } = useTranslation();

  if (!courses?.length)

Function InvitationResultDialog has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InvitationResultDialog: FC<Props> = (props) => {
  const { handleClose, invitationResult, intl } = props;
  const {
    duplicateUsers,
    existingInstanceUsers,

ScribingCanvas has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class ScribingCanvas extends Component {
  constructor(props) {
    super(props);

    this.line = undefined;
Severity
Category
Status
Source
Language