Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function buildGenerateRequestPayload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const buildGenerateRequestPayload = (
  codaveriData: CodaveriGenerateFormData,
  questionData: QuestionPrototypeFormData,
): FormData => {
  const data = new FormData();
Severity: Minor
Found in client/app/bundles/course/assessment/pages/AssessmentGenerate/utils.ts - About 45 mins to fix

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

const Tab = (props: TabProps): JSX.Element => {
  const { tab, index, stationary, disabled } = props;
  const { t } = useTranslation();
  const { settings, deleteTabInCategory, moveAssessments } =
    useAssessmentSettings();

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

const Link = forwardRef<LinkRef, LinkProps>((props, ref): JSX.Element => {
  const {
    opensInNewTab,
    external,
    to: route,
Severity: Minor
Found in client/app/lib/components/core/Link.tsx - About 45 mins to fix

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

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

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

Avoid deeply nested control flow statements.
Open

          if (
            draft.pageState.tabValue === CommentTabTypes.MY_STUDENTS_PENDING ||
            draft.pageState.tabValue === CommentTabTypes.MY_STUDENTS
          ) {
            draft.tabs.myStudentUnreadCount! += 1;
Severity: Major
Found in client/app/bundles/course/discussion/topics/store.ts - About 45 mins to fix

Function AchievementNew has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const AchievementNew: FC<Props> = (props) => {
  const { open, onClose } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();
  const navigate = useNavigate();
Severity: Minor
Found in client/app/bundles/course/achievement/pages/AchievementNew/index.tsx - About 45 mins to fix

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

const ExperiencePointsTableRow: FC<Props> = (props) => {
  const { record, isStudentPage, disabled } = props;
  const [isDirty, setIsDirty] = useState(false);
  const [rowData, setRowData] = useState({
    id: record.id,

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

  (props, ref): JSX.Element => {
    const { disabled, for: originalOptions } = props;
    const [options, setOptions] = useState(originalOptions);

    const optionRefs = useRef<Record<OptionEntity['id'], OptionRef>>({});

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

const DataFilesManager = (props: DataFilesManagerProps): JSX.Element => {
  const { t } = useTranslation();

  const { control } = useFormContext<ProgrammingFormData>();

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

const LevelsTableRow: FC<Props> = ({
  row,
  index,
  isThresholdOrderedCorrectly,
  canManage,
Severity: Minor
Found in client/app/bundles/course/level/components/LevelsTableRow.tsx - About 45 mins to fix

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

const VideoShow: FC<Props> = (props) => {
  const { intl } = props;
  const { videoId } = useParams();
  const [isLoading, setIsLoading] = useState(true);
  const dispatch = useAppDispatch();
Severity: Minor
Found in client/app/bundles/course/video/pages/VideoShow/index.tsx - About 45 mins to fix

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

const TestCaseRow: FC<Props> = (props) => {
  const { result } = props;

  const nameRegex = /\/?(\w+)$/;
  const idMatch = result.identifier?.match(nameRegex);

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

Consider simplifying this complex logical expression.
Open

    if (
      (sections && sections.length) < 1 ||
      (sections[0].questions && sections[0].questions.length < 1) ||
      (sections[0].questions[0].answers &&
        sections[0].questions[0].answers.length < 1)
Severity: Major
Found in client/app/bundles/course/survey/pages/SurveyResults/index.jsx - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if (editMode) {
      return (
        <>
          {renderRating()}
          <TextField

Function saveGrade has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function saveGrade(submissionId, grade, questionId, exp, published) {
Severity: Minor
Found in client/app/bundles/course/assessment/submission/actions/answers/index.js - About 35 mins to fix

Function updateCategory has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  id,
  { name, description },
  successMessage,
  failureMessage,
  setError,
Severity: Minor
Found in client/app/bundles/course/group/actions/categories.js - About 35 mins to fix

Function updateSurveySection has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  sectionId,
  data,
  successMessage,
  failureMessage,
  setError,
Severity: Minor
Found in client/app/bundles/course/survey/actions/sections.js - About 35 mins to fix

Function updateSurvey has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  surveyId,
  surveyFields,
  successMessage,
  failureMessage,
  setError,
Severity: Minor
Found in client/app/bundles/course/survey/actions/surveys.js - About 35 mins to fix

Function updateSurveyQuestion has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  questionId,
  data,
  successMessage,
  failureMessage,
  setError,
Severity: Minor
Found in client/app/bundles/course/survey/actions/questions.js - About 35 mins to fix

Function createSurvey has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  surveyFields,
  successMessage,
  failureMessage,
  navigate,
  setError,
Severity: Minor
Found in client/app/bundles/course/survey/actions/surveys.js - About 35 mins to fix
Severity
Category
Status
Source
Language