Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function MaterialsSettingsForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MaterialsSettingsForm = (
  props: MaterialsSettingsFormProps,
): JSX.Element => {
  const { t } = useTranslation();

Function ForumTopicNew has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForumTopicNew: FC<Props> = (props) => {
  const { open, onClose, availableTopicTypes, isAnonymousEnabled } = props;
  const { t } = useTranslation();
  const { forumId } = useParams();
  const navigate = useNavigate();
Severity: Minor
Found in client/app/bundles/course/forum/pages/ForumTopicNew/index.tsx - About 1 hr to fix

Function handleUpdate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const handleUpdate = (): Promise<void> => {
    setIsUpdating(true);
    return dispatch(
      entityType === 'forum'
        ? updateForumSubscription(

Function AnnouncementsSettingsForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AnnouncementsSettingsForm = (
  props: AnnouncementsSettingsFormProps,
): JSX.Element => {
  const { t } = useTranslation();

Function useSliders has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const useSliders = (): UseSlidersHook => {
  const ref = useRef<HTMLDivElement>(null);
  const [showSliders, setShowSliders] = useState([false, false]);

  const resetShowSliders = (element: Element): void => {
Severity: Minor
Found in client/app/bundles/course/container/Breadcrumbs/sliders.tsx - About 1 hr to fix

Function UnavailableAlert has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  if (!assessment.permissions.canAttempt)

Function InstanceUsersInvitations has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstanceUsersInvitations: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(false);
  const invitations = useAppSelector(getAllInvitationMiniEntities);

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

const SurveyDetails = (props) => {
  const { survey, courseId, disabled } = props;
  const navigate = useNavigate();

  const dispatch = useAppDispatch();
Severity: Minor
Found in client/app/bundles/course/survey/pages/SurveyShow/SurveyDetails.jsx - About 1 hr 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 CategoryCard has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const CategoryCard = ({
  category,
  numGroups,
  intl,
  onManageGroups,
Severity: Minor
Found in client/app/bundles/course/group/pages/GroupShow/CategoryCard.jsx - About 1 hr 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 QuestionFormOption has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const QuestionFormOption = (props) => {
  const {
    fieldsConfig,
    field,
    index,

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

const Gate = (props) => {
  const {
    canModify,
    dispatch,
    gateInputSizeThreshold,
Severity: Minor
Found in client/app/bundles/course/learning-map/components/Gate/index.jsx - About 1 hr 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

Method annotation_replied has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def annotation_replied(post)
    category = post.topic.actable.file.answer.submission.assessment.tab.category
    email_enabled = category.course.email_enabled(:assessments, :new_comment, category.id)
    return unless email_enabled.regular || email_enabled.phantom

Severity: Minor
Found in app/notifiers/course/assessment/answer/comment_notifier.rb - About 1 hr 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

Method post_replied has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def post_replied(post)
    category = post.topic.actable.submission.assessment.tab.category
    email_enabled = category.course.email_enabled(:assessments, :new_comment, category.id)
    return unless email_enabled.regular || email_enabled.phantom

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

Method update_todo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def update_todo
    return unless todo

    if submitted?
      todo.update_attribute(:workflow_state, 'completed') unless todo.completed?
Severity: Minor
Found in app/models/concerns/course/survey/response/todo_concern.rb - About 1 hr 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

Method validate_no_repeat_bundles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_no_repeat_bundles(assignment_set)
      attempted_questions = {}
      @assessment.question_bundle_assignments.where.not(submission: nil).pluck(:user_id, :bundle_id).
        each do |user_id, bundle_id|
        attempted_questions[user_id] ||= Set.new

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

  (props, ref): JSX.Element => {
    const {
      component,
      label,
      dangerouslySetInnerHTML,
Severity: Minor
Found in client/app/lib/components/core/buttons/Checkbox.tsx - About 1 hr 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 buildFormData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const buildFormData = (draft: ProgrammingFormRequestData): FormData => {
  const data = new FormData();

  appendInto(data, 'title', draft.question.title);
  appendInto(data, 'description', draft.question.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

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

const AvatarSelector = (props: AvatarSelectorProps): JSX.Element => {
  const { t } = useTranslation();
  const [selectedImage, setSelectedImage] = useState<File>();
  const [cropping, setCropping] = useState(false);

Severity: Minor
Found in client/app/lib/components/core/AvatarSelector.tsx - About 1 hr 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 getTabTypesToRender has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const getTabTypesToRender = (
  permissions: CommentPermissions,
  tabInfo: CommentTabInfo,
): CommentTabData[] => {
  const tabs = [] as CommentTabTypes[];

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

const ForumTopicTable: FC<Props> = (props) => {
  const { forum, forumTopics } = props;
  const { t } = useTranslation();

  if (!forum || forumTopics.length === 0) {

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