Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function CKEditorRichText has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CKEditorRichText = (props: Props) => {
  const {
    label,
    value,
    onChange,
Severity: Major
Found in client/app/lib/components/core/fields/CKEditorRichText.tsx - About 4 hrs to fix

Function ForumTopicManagementButtons has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumTopicManagementButtons: FC<Props> = (props) => {
  const { topic, pageType, disabled, showOnHover } = props;
  const dispatch = useAppDispatch();
  const { t } = useTranslation();
  const navigate = useNavigate();

Function SolutionsManager has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  (props, ref): JSX.Element => {
    const { disabled, for: originalSolutions, isAssessmentAutograded } = props;
    const [solutions, setSolutions] = useState(originalSolutions);

    const solutionRefs = useRef<Record<SolutionEntity['id'], SolutionRef>>({});

Function InstanceUserRoleRequestForm has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstanceUserRoleRequestForm: FC<Props> = (props) => {
  const { open, onClose, instanceUserRoleRequest } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Function ReplyCard has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReplyCard: FC<Props> = (props) => {
  const {
    postId,
    isReplying,
    isAnonymousEnabled,
Severity: Major
Found in client/app/bundles/course/forum/components/cards/ReplyCard.tsx - About 4 hrs to fix

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

  render() {
    const {
      confirmationDialogOpen,
      disabled,
      dispatch,

Function ForumDisbursement has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumDisbursement: FC = () => {
  const retrievedPostUserIds = new Set();
  const { t } = useTranslation();
  const [selectedForumPostUser, setSelectedForumPostUser] =
    useState<ForumDisbursementUserEntity | null>();

Function AssessmentShowHeader has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentShowHeader = (
  props: AssessmentShowHeaderProps,
): JSX.Element => {
  const { with: assessment } = props;
  const { t } = useTranslation();

Class AssessmentsController has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class Course::Assessment::AssessmentsController < Course::Assessment::Controller # rubocop:disable Metrics/ClassLength
  include Course::Assessment::AssessmentsHelper
  include Course::Assessment::KoditsuAssessmentConcern
  include Course::Assessment::Question::KoditsuQuestionConcern
  include Course::Assessment::KoditsuAssessmentInvitationConcern
Severity: Minor
Found in app/controllers/course/assessment/assessments_controller.rb - About 4 hrs to fix

Function AssessmentDetails has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentDetails = (props: AssessmentDetailsProps): JSX.Element => {
  const { for: assessment } = props;
  const { t } = useTranslation();

  return (

Function QuestionGrade has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

const QuestionGrade: FC<QuestionGradeProps> = (props) => {
  const { questionId, isSaving } = 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 TextResponseForm has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function DisbursementTable has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DisbursementTable: FC<Props> = (props: Props) => {
  const { filteredUsers, onClickCopy, onClickRemove, intl } = props;

  const columns: TableColumns[] = [
    {

Function FilterForm has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FilterForm: FC<Props> = (props) => {
  const { intl, initialValues } = props;
  const [isSearching, setIsSearching] = useState(false);
  const dispatch = useAppDispatch();

Function UsersIndex has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function TimePopup has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function ForumManagementButtons has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumManagementButtons: FC<Props> = (props) => {
  const {
    forum,
    navigateToIndexAfterDelete,
    navigateToShowAfterUpdate,

Function SubmissionsTableRow has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

const SubmissionsTableRow = (props) => {
  const { assessment, assessmentId, courseId, dispatch, submission } = props;
  const palette = useTheme().palette;
  const [state, setState] = useState({
    unsubmitConfirmation: 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 renderHeader has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  renderHeader(shownSubmissions) {
    const {
      assessment: { canPublishGrades, canForceSubmit, isKoditsuEnabled },
      isPublishing,
      isForceSubmitting,

Function AssessmentCategoriesManager has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentCategoriesManager = (props: Props): JSX.Element => {
  const { categories } = props;
  const { t } = useTranslation();
  const { createCategory, settings } = useAssessmentSettings();

Severity
Category
Status
Source
Language