WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 462 of 1,667 total issues

Function exports has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (env) => {
  const mode = env.development ? 'development' : 'production';
  const isProductionOrCI = env.production || env.coverage;
  let devtool = 'eval-cheap-source-map';
  // see https://webpack.js.org/configuration/devtool/ for the detailed descriptions of these
Severity: Major
Found in webpack.config.js - About 5 hrs to fix

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

      render() {
        let content;
        let faqLink;
    
        let wikipediaHelpButton;
    Severity: Major
    Found in app/assets/javascripts/components/common/get_help_button.jsx - About 5 hrs to fix

      File course_cloned_modal.jsx has 383 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import createReactClass from 'create-react-class';
      import PropTypes from 'prop-types';
      import Modal from '../common/modal.jsx';
      import TextInput from '../common/text_input.jsx';
      Severity: Minor
      Found in app/assets/javascripts/components/overview/course_cloned_modal.jsx - About 5 hrs to fix

        Function renderGraph has 126 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const renderGraph = () => {
            const vegaSpec = {
              width: props.graphWidth,
              height: props.graphHeight,
              padding: 5,
        Severity: Major
        Found in app/assets/javascripts/components/articles/edit_size_graph.jsx - About 5 hrs to fix

          Function CourseDates has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const CourseDates = (props) => {
            const updateCourseDates = (key, value) => {
              const updatedCourse = CourseDateUtils.updateCourseDates(props.course, key, value);
              props.updateCourseProps(updatedCourse);
            };
          Severity: Major
          Found in app/assets/javascripts/components/course_creator/course_dates.jsx - About 5 hrs to fix

            Function render has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                if (this.props.loading) {
                  return <Loading />;
                }
            
            
            Severity: Minor
            Found in app/assets/javascripts/components/timeline/timeline.jsx - About 4 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 RevisionHandler has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            const RevisionHandler = ({ course, courseScopedLimit }) => {
              const [isCourseScoped, setIsCourseScoped] = useState(false);
            
              const dispatch = useDispatch();
            
            
            Severity: Minor
            Found in app/assets/javascripts/components/revisions/revisions_handler.jsx - About 4 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

            File routes.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            Rails.application.routes.draw do
              get 'errors/file_not_found'
              get 'errors/unprocessable'
              get 'errors/login_error'
              get 'errors/internal_server_error'
            Severity: Minor
            Found in config/routes.rb - About 4 hrs to fix

              Function NotesPanel has 117 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const NotesPanel = () => {
                // State variables for managing the modal and note creation
                const [isModalOpen, setIsModalOpen] = useState(null);
                const [isNoteCreationActive, setIsNoteCreationActive] = useState(false);
              
              
              Severity: Major
              Found in app/assets/javascripts/components/admin_notes/notes_panel.jsx - About 4 hrs to fix

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

                  render() {
                    const spacer = this.props.spacer || ': ';
                    let label;
                    let timeLabel;
                    let currentMonth;
                Severity: Major
                Found in app/assets/javascripts/components/common/date_picker.jsx - About 4 hrs to fix

                  Function Feedback has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Feedback = ({ assignment, username, current_user }) => {
                    const [show, setShow] = useState(false);
                    const [fetched, setFetched] = useState(false);
                    const [feedbackSent, setFeedbackSent] = useState(false);
                    const [feedbackInput, setFeedbackInput] = useState('');
                  Severity: Minor
                  Found in app/assets/javascripts/components/common/feedback.jsx - About 4 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 render has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const { course, current_user } = this.props;
                  
                      if (course.cloned_status === 1 || course.cloned_status === 3) {
                        return (
                  Severity: Major
                  Found in app/assets/javascripts/components/overview/overview_handler.jsx - About 4 hrs to fix

                    Function Panel has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const Panel = (props) => {
                      const persistState = () => {
                          const step = props.step.toLowerCase().split(' ').slice(0, 2);
                          step[1] = +step[1] + 1; // Keeping the step in line with the UI
                          window.history.pushState(
                    Severity: Minor
                    Found in app/assets/javascripts/components/wizard/panel.jsx - About 4 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 InputHOC has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const InputHOC = (Component) => {
                      const validatingComponent = createReactClass({
                        displayName: `Input${Component.displayName}`,
                    
                        // value passed is HOC's state value
                    Severity: Minor
                    Found in app/assets/javascripts/components/high_order/input_hoc.jsx - About 4 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 Wp10Graph has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const Wp10Graph = (props) => {
                      useEffect(() => {
                        renderGraph();
                      }, []);
                    
                    
                    Severity: Major
                    Found in app/assets/javascripts/components/articles/wp10_graph.jsx - About 4 hrs to fix

                      Function render has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render() {
                          const spacer = this.props.spacer || ': ';
                          let label;
                          let timeLabel;
                          let currentMonth;
                      Severity: Minor
                      Found in app/assets/javascripts/components/common/date_picker.jsx - About 4 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 _handleMoveBlock has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _handleMoveBlock(moveUp, blockId) {
                          for (let i = 0; i < this.props.weeks.length; i += 1) {
                            const week = this.props.weeks[i];
                            const blocks = this.getBlocksInWeek(week.id);
                            for (let j = 0; j < blocks.length; j += 1) {
                      Severity: Minor
                      Found in app/assets/javascripts/components/timeline/timeline.jsx - About 4 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 PagePileScoping has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const PagePileScoping = () => {
                        const [inputValue, setInputValue] = useState('');
                        const pagePileIds = useSelector(state => state.scopingMethods.pagepile.ids);
                      
                        const dispatch = useDispatch();

                        Function PetScanScoping has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const PetScanScoping = () => {
                          const [inputValue, setInputValue] = React.useState('');
                          const petscanIDs = useSelector(state => state.scopingMethods.petscan.psids);
                          const dispatch = useDispatch();
                          const home_wiki = useSelector(state => state.course.home_wiki);

                          File course_approval.jsx has 339 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { useEffect, useState } from 'react';
                          
                          import { connect } from 'react-redux';
                          import { difference, uniq } from 'lodash-es';
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/components/course/course_approval.jsx - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language