Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function useTanStackTableBuilder has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

const useTanStackTableBuilder = <D extends object>(
  props: TableTemplate<D>,
): TanStackTableProps<D> => {
  const [columns, getRealColumn] = buildTanStackColumns(
    props.columns,

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

const EnrolRequestsTable: FC<Props> = (props) => {
  const {
    title,
    enrolRequests,
    pendingEnrolRequests = 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 ConvertMcqMrqPrompt has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

const ConvertMcqMrqPrompt = (props: ConvertMcqMrqPromptProps): JSX.Element => {
  const { for: question } = props;
  const { t } = useTranslation();
  const [converting, setConverting] = useState(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 PendingTodosTable has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

const PendingTodosTable: FC<Props> = (props) => {
  const { intl, todos, todoType } = props;

  const [shavedTodos, setShavedTodos] = useState(todos.slice(0, 5));
  const [end, setEnd] = useState(10);

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

const VideoTable: FC<Props> = (props) => {
  const { videos, permissions, onTogglePublished, intl } = props;
  const videoMetadata = useAppSelector(getVideoMetadata);

  if (videos && videos.length === 0) {
Severity: Minor
Found in client/app/bundles/course/video/components/tables/VideoTable.tsx - About 2 hrs 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 reducer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const reducer = produce((state, action) => {
  const { type } = action;

  switch (type) {
    case actionTypes.LOAD_OBJECTS_LIST_REQUEST: {
Severity: Major
Found in client/app/bundles/course/duplication/store.js - About 2 hrs to fix

Function NameDescriptionForm has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NameDescriptionForm = (props) => {
  const { initialValues, onSubmit } = props;
  const {
    control,
    handleSubmit,
Severity: Major
Found in client/app/bundles/course/group/forms/NameDescriptionForm.jsx - About 2 hrs to fix

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

  const renderCommentContent = () => {
    if (editMode) {
      return (
        <>
          {renderRating()}

Function Checkbox has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  (props, ref): JSX.Element => {
    const {
      component,
      label,
      dangerouslySetInnerHTML,
Severity: Major
Found in client/app/lib/components/core/buttons/Checkbox.tsx - About 2 hrs to fix

Function Footer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Footer = (): JSX.Element | null => {
  const { t } = useTranslation();

  const enabled = useFooter();
  const attributions = useAttributions();
Severity: Major
Found in client/app/lib/components/core/layouts/Footer.tsx - About 2 hrs to fix

Function DayView has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  const timelines = useAppSelector(selectTimelines);
  const items = useAppSelector(selectItems);

Function ForumPostResponseForm has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function UserShow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UserShow: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(true);

  const { userId } = useParams();
Severity: Major
Found in client/app/bundles/users/pages/UserShow.tsx - About 2 hrs to fix

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

  render() {
    const {
      sections,
      isLoading,
      survey: { anonymous },
Severity: Major
Found in client/app/bundles/course/survey/pages/SurveyResults/index.jsx - About 2 hrs to fix

Function initializeCanvas has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initializeCanvas(answerId, imageUrl) {
    this.image = new Image();
    this.image.src = imageUrl;

    this.image.onload = () => {

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

  render() {
    const { topicPostPack, courseId, forumId } = this.props;
    const selectedPostIds = new Set(
      this.props.selectedPostPacks.map((pack) => pack.corePost.id),
    );

Function MaterialForm has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MaterialForm: FC<Props> = (props) => {
  const { open, editing, onClose, onSubmit, title, initialValues } = props;
  const { t } = useTranslation();

  return (

Function LearningRateRecordsChart has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LearningRateRecordsChart: FC<LearningRateRecordsChartProps> = (props) => {
  const { learningRateRecords } = props;
  const { t } = useTranslation();

  const sortedRecords = useMemo(

Class LearningMapController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class Course::LearningMapController < Course::ComponentController
  NODE_ID_DELIMITER = '-'
  NEGATIVE_INF = -1_000_000_000

  before_action :authorize_learning_map
Severity: Minor
Found in app/controllers/course/learning_map_controller.rb - About 2 hrs to fix

Function ResponseEdit has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ResponseEdit = (props) => {
  const {
    dispatch,
    flags,
    match: {
Severity: Major
Found in client/app/bundles/course/survey/pages/ResponseEdit/index.jsx - About 2 hrs to fix
Severity
Category
Status
Source
Language