Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function CourseDisplay has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CourseDisplay: FC<Props> = (props) => {
  const { intl, courses } = props;

  const {
    processedItems: processedCourses,
Severity: Minor
Found in client/app/bundles/course/courses/components/misc/CourseDisplay.tsx - About 1 hr to fix

Function ManageStaff has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ManageStaff: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(true);
  const staff = useAppSelector(getAllStaffMiniEntities);
  const permissions = useAppSelector(getManageCourseUserPermissions);
Severity: Minor
Found in client/app/bundles/course/users/pages/ManageStaff/index.tsx - About 1 hr to fix

Function StatisticsIndex has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const StatisticsIndex: FC = () => {
  const { t } = useTranslation();
  const statisticsUrl = getCourseStatisticsURL(getCourseId());

  const tabs: TabData[] = [

Function MaterialUploadForm has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MaterialUploadForm: FC<Props> = (props) => {
  const {
    handleClose,
    onSubmit,
    isSubmitting,

Function PulseGrid has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PulseGrid = (props: PulseGridProps): JSX.Element => {
  const { courseId, monitorId, title } = props.with;

  const { t } = useTranslation();
  const [userIds, setUserIds] = useState<number[]>([]);

Function SubmitButton has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubmitButton: FC<Props> = (props) => {
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

  const { questionId } = props;

Method parse_from_file has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_from_file(file)
    row_num = 0
    [].tap do |invites|
      CSV.foreach(file).with_index(1) do |row, row_number|
        row_num = row_number

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

const SidebarSettingsForm = (props: SidebarSettingsFormProps): JSX.Element => {
  const { t } = useTranslation();
  const [settings, setSettings] = useState(props.data);

  const moveItem = (sourceIndex: number, destinationIndex: number): void => {

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

const SubscribeButton: FC<Props> = ({
  emailSubscription,
  entityType,
  entityId,
  entityUrl,

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

  render() {
    const numPostsSelected = this.state.selectedPostPacks.length;
    const hasNoChanges =
      JSON.stringify(
        this.state.selectedPostPacks.map((pack) => pack.corePost.id).sort(),

Function AssessmentTab has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentTab: FC<AssessmentTabProps> = (props) => {
  const { tab } = props;
  const assessments = useAppSelector((state) =>
    getAssessmentsForTab(state, tab.id),
  );

Function AnnouncementsIndex has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  // For new announcements form dialog
  const [isOpen, setIsOpen] = useState(false);

Function renderCommentContent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderCommentContent = (): JSX.Element => {
    if (editMode) {
      return (
        <div className="edit-discussion-post-form" id={`edit_post_${post.id}`}>
          <CKEditorRichText

Function Link has 47 lines of code (exceeds 25 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 1 hr to fix

Function DataFileRow has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DataFileRow = (props: DataFileRowProps): JSX.Element => {
  const file = unwrap(props.of);
  const toBeDeleted = isMarked(props.of);

  const handleClickDelete = (): void => {

Function CourseUserItem has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CourseUserItem = (props: CourseUserItemProps): JSX.Element => {
  const { from: data } = props;

  const { t } = useTranslation();

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

Function McqWidget has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const McqWidget = (props: McqWidgetProps): JSX.Element | null => {
  const { for: question } = props;
  const { t } = useTranslation();
  const [expanded, setExpanded] = useState(false);

Function ResetProgrammingAnswerButton has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ResetProgrammingAnswerButton: FC<Props> = (props) => {
  const { t } = useTranslation();
  const dispatch = useAppDispatch();

  const { questionId } = props;

Function CoursesButtons has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CoursesButtons: FC<Props> = (props) => {
  const { intl, course, deleteOperation } = props;
  const dispatch = useAppDispatch();
  const [openPrompt, setOpenPrompt] = useState(false);
  const [isDeleting, setIsDeleting] = useState(false);

Function BaseActiveSessionBlob has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BaseActiveSessionBlob = (
  props: BaseActiveSessionBlobProps,
): JSX.Element => {
  const { of: snapshot, for: userId } = props;

Severity
Category
Status
Source
Language