Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function reducer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  (draft: InstanceAdminState, action: InstanceAdminActionType) => {
    switch (action.type) {
      case SAVE_ANNOUNCEMENT_LIST: {
        const announcementList = action.announcementList;
        const entityList = announcementList.map((data) => ({ ...data }));
Severity: Minor
Found in client/app/bundles/system/admin/instance/instance/store.ts - About 55 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 questionHandle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const questionHandle: DataHandle = (match, location) => {
  if (
    location.pathname.endsWith('new') ||
    location.pathname.endsWith('generate')
  )
Severity: Minor
Found in client/app/bundles/course/assessment/handles.ts - About 55 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 ForumManagementButtons has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

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

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

const SavedIndicator = (props: SavedIndicatorProps): JSX.Element => {
  const { at: lastSaved, success } = props;

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

const AchievementTable: FC<Props> = (props) => {
  const { achievements, permissions, onTogglePublished, isReordering } = props;

  if (achievements && achievements.length === 0) {
    return (

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

const HorizontallyResizable = (
  props: HorizontallyResizableProps,
): JSX.Element => {
  const [resizingHandle, setResizingHandle] = useState<ResizeHandle>();

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

const FolderShow: FC = () => {
  const { folderId } = useParams();
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Severity: Minor
Found in client/app/bundles/course/material/folders/pages/FolderShow/index.tsx - About 55 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 LevelsManager has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const LevelsManager = (): JSX.Element => {
  const { canManage, levels } = useAppSelector(getLevels);
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

Severity: Minor
Found in client/app/bundles/course/level/pages/LevelsIndex/LevelsManager.tsx - About 55 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 SkillsIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const SkillsIndex: FC<Props> = (props) => {
  const { intl } = props;
  const dispatch = useAppDispatch();
  const [isLoading, setIsLoading] = useState(true);
  const [dialogType, setDialogType] = useState(DialogTypes.NewSkill);
Severity: Minor
Found in client/app/bundles/course/assessment/skills/pages/SkillsIndex/index.tsx - About 55 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 StepperButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const StepperButton: FC<Props> = (props) => {
  const { questionId, questionIndex, stepIndex } = props;

  const explanations = useAppSelector(getExplanations);

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

const AccountSettingsForm = (props: AccountSettingsFormProps): JSX.Element => {
  const { t } = useTranslation();
  const [stagedImage, setStagedImage] = useState<File>();
  const [requirePasswordConfirmation, setRequirePasswordConfirmation] =
    useState(true);
Severity: Minor
Found in client/app/bundles/user/AccountSettings/AccountSettingsForm.tsx - About 55 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 AddEmailSubsection has a Cognitive Complexity of 9 (exceeds 5 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: Minor
Found in client/app/bundles/user/components/AddEmailSubsection.tsx - About 55 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 updateCodaveri has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  fileId,
  topicId,
  postId,
  codaveriId,
  text,
Severity: Major
Found in client/app/bundles/course/assessment/submission/actions/annotations.js - About 50 mins to fix

Function duplicateCourse has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  fields,
  destinationHost,
  successMessage,
  pendingMessage,
  failureMessage,
Severity: Minor
Found in client/app/bundles/course/duplication/operations.js - About 45 mins to fix

Function updateGroup has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  categoryId,
  groupId,
  { name, description },
  successMessage,
  failureMessage,
Severity: Minor
Found in client/app/bundles/course/group/actions/groups.js - About 45 mins to fix

Function updateResponse has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  responseId,
  payload,
  successMessage,
  failureMessage,
  navigate,
Severity: Minor
Found in client/app/bundles/course/survey/actions/responses.js - About 45 mins to fix

Function create has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  submissionId,
  answerId,
  fileId,
  line,
  text,
Severity: Minor
Found in client/app/bundles/course/assessment/submission/actions/annotations.js - About 45 mins to fix

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

const getGroupData = (data, existingNames) => {
  const groupData = [];
  const isSingle = data.is_single === 'true' || data.is_single === true;
  if (isSingle) {
    groupData.push({ name: data.name, description: data.description });

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 (this.ellipse && this.ellipse.type === 'ellipse') {
              this.ellipse.selectable = false;
            }

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

const TextResponse = (props) => {
  const {
    answerId,
    graderView,
    handleUploadTextResponseFiles,

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

Severity
Category
Status
Source
Language