Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function InviteUsers has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InviteUsers: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(true);
  const invitations = useAppSelector(getAllInvitationsMiniEntities);
  const permissions = useAppSelector(getManageCourseUserPermissions);

Function VideosIndex has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideosIndex: FC = () => {
  const { t } = useTranslation();
  const [isLoading, setIsLoading] = useState(true);
  const [isOpen, setIsOpen] = useState(false);
  const videoMetadata = useAppSelector(getVideoMetadata);
Severity: Major
Found in client/app/bundles/course/video/pages/VideosIndex/index.tsx - About 2 hrs to fix

Function LiveFeedbackButton has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LiveFeedbackButton: FC<Props> = (props) => {
  const { t } = useTranslation();
  const { questionId } = props;

  const dispatch = useAppDispatch();

Function ActionButtons has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ActionButtons = (props: ActionButtonsProps): JSX.Element => {
  const { for: assessment, student } = props;
  const { t } = useTranslation();

  return (

Function AssessmentBlockedByMonitorPage has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AssessmentBlockedByMonitorPage = (
  props: AssessmentBlockedByMonitorPageProps,
): JSX.Element => {
  const { for: assessment } = props;

Function CoursesIndex has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CoursesIndex: FC<Props> = (props) => {
  const { intl } = props;
  const [isLoading, setIsLoading] = useState(false);
  const [filter, setFilter] = useState({ active: false });
  const courseCounts = useAppSelector(getAdminCounts);

Function VisibleProgrammingImportEditor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const VisibleProgrammingImportEditor = (props) => {
  const {
    answerId,
    disabled,
    dispatch,

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

  def update_submission # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/MethodLength
    @submission.class.transaction do
      unless unsubmit? || unmark?
        update_answers_params&.each do |answer_params|
          next if !answer_params.is_a?(ActionController::Parameters) || answer_params[:id].blank?
Severity: Minor
Found in app/services/course/assessment/submission/update_service.rb - 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 CreateRenameTimelinePrompt has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const CreateRenameTimelinePrompt = (
  props: CreateRenameTimelinePromptProps,
): JSX.Element => {
  const { renames: timeline } = props;

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

  (props, ref): JSX.Element => {
    const { disabled, for: originalSolution } = props;

    const [solution, setSolution] = useState(originalSolution);
    const [toBeDeleted, setToBeDeleted] = 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 LeaderboardIndex has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const LeaderboardIndex: FC<Props> = (props) => {
  const { intl } = props;
  const dispatch = useAppDispatch();
  const tabView = useMedia.MinWidth('lg');
  const [isLoading, setIsLoading] = useState(true);

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

export default function (state = {}, action) {
  switch (action.type) {
    case actions.FETCH_SUBMISSION_SUCCESS:
    case actions.FINALISE_SUCCESS:
    case actions.UNSUBMIT_SUCCESS:
Severity: Major
Found in client/app/bundles/course/assessment/submission/reducers/testCases.js - About 2 hrs to fix

Function MultipleFileInput has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MultipleFileInput: FC<Props> = (props) => {
  const { intl, uploadedFiles, setUploadedFiles, disabled } = props;

  const [dropZoneActive, setDropZoneActive] = useState(false);

Function HorizontallyResizable has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function VideoManagementButtons has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideoManagementButtons: FC<Props> = (props) => {
  const { video, navigateToIndex } = props;
  const { t } = useTranslation();
  const dispatch = useAppDispatch();
  const navigate = useNavigate();

Function Canvas has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Canvas = () => {
  const transformRef = useRef(null);
  const [scale, setScale] = useState(1);

  const getGateInputId = (isSummaryGate, parentNodeId, childNodeId) =>
Severity: Major
Found in client/app/bundles/course/learning-map/containers/Canvas/index.jsx - About 2 hrs to fix

Function renderUser has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderUser = () => {
    const { unsubmitConfirmation, deleteConfirmation } = state;
    const tableCenterCellStyle = {
      ...styles.tableCell,
      ...styles.tableCenterCell,

Method answer_statistics_hash has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def answer_statistics_hash
    submission_answer_statistics = Course::Assessment::Answer.find_by_sql(<<-SQL.squish
      WITH
        attempt_info AS (
          SELECT
Severity: Major
Found in app/controllers/concerns/course/statistics/submissions_concern.rb - About 2 hrs to fix

Function VideosSettingsForm has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VideosSettingsForm = (props: VideosSettingsFormProps): JSX.Element => {
  const { t } = useTranslation();

  return (
    <Form

Function TargetsList has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TargetsList = (props: TargetsListProps): JSX.Element => {
  const { containing: keyword, for: question } = props;
  const { t } = useTranslation();
  const targets = useMemo(() => filter(keyword, question), [keyword, question]);

Severity
Category
Status
Source
Language