Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function ProgrammingForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const ProgrammingForm = (props: ProgrammingFormProps): JSX.Element => {
  const [data, setData] = useState(props.with);

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

const WorkbinTableButtons: FC<Props> = (props) => {
  const {
    currFolderId,
    itemId,
    itemName,

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

const TestCaseComponent: FC<TestCaseComponentProps> = (props) => {
  const { testCaseResults, testCaseType } = props;
  const { t } = useTranslation();

  const isProgrammingAnswerEvaluated =

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

const AuthenticatableApp = (): JSX.Element => {
  const auth = useAuthAdapter();

  switch (auth.activeNavigator) {
    case 'signinRedirect':
Severity: Minor
Found in client/app/routers/AuthenticatableApp.tsx - About 1 hr to fix

Function AdminPopupMenuList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminPopupMenuList = (): JSX.Element | null => {
  const { t } = useTranslation();

  const { user } = useAppContext();

Severity: Minor
Found in client/app/lib/components/navigation/AdminPopupMenuList.tsx - About 1 hr to fix

Function onFormSubmit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const onFormSubmit = (data: DisbursementFormData): void => {
    setIsSubmitting(true);
    const courseUserFields = filteredCourseUsers.map(
      (user) => `courseUser_${user.id}`,
    );

Function LevelRing has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LevelRing = (props: LevelRingProps): JSX.Element => {
  const { in: progress } = props;

  const [percentage, setPercentage] = useState<number>();

Severity: Minor
Found in client/app/bundles/course/container/Sidebar/LevelRing.tsx - About 1 hr to fix

Function UserManagementButtons has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UserManagementButtons: FC<Props> = (props) => {
  const { intl, user } = props;
  const dispatch = useAppDispatch();
  const [isDeleting, setIsDeleting] = useState(false);

Function TestCases has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TestCases = (props: TestCasesProps): JSX.Element => {
  const { byIdentifier, as: component, name, ...otherProps } = props;

  const TestCaseComponent = component ?? TestCase;

Function PublishButton has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PublishButton: FC = () => {
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

  const assessment = useAppSelector(getAssessment);

Function QuestionStepper has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const QuestionStepper: FC = () => {
    return (
      questionIds &&
      questionIds.length > 1 && (
        <Stepper

Function SaveGradeButton has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SaveGradeButton: FC = () => {
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

  const submission = useAppSelector(getSubmission);

Function MultipleResponseDetails has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MultipleResponseDetails = (
  props: QuestionAnswerDisplayDetails<'MultipleResponse'>,
): JSX.Element => {
  const { question, answer } = props;
  return (

Function ResendConfirmationEmailLandingPage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  const email = useEmailFromLocationState();
  if (!email) return <Navigate to="/users/confirmation/new" />;

Function renderOptionRow has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static renderOptionRow(breakdown, hasImage, option, index, anonymous) {
    const percentage = (100 * breakdown[option.id].count) / breakdown.length;
    const {
      id,
      option: optionText,

Function default has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (state = {}, action) {
  switch (action.type) {
    case actions.GET_PAST_ANSWERS_SUCCESS: {
      return {
        ...state,

Function renderEmailSettingsTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderEmailSettingsTable() {
    const { emailSettings } = this.props;

    if (emailSettings.length < 1) {
      return (

Function renderTextResultsTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static renderTextResultsTable(answers, anonymous) {
    return (
      <Table>
        <TableHead>
          <TableRow>

Function renderTextResponseSolutions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function renderTextResponseSolutions(question) {
  return (
    <>
      <hr />
      <Typography variant="h6">

Function renderPastAnswerSelect has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderPastAnswerSelect() {
    const {
      answers,
      answerIds,
      selectedAnswerIds,
Severity
Category
Status
Source
Language