WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 453 of 1,605 total issues

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

    File course_cloned_modal.jsx has 374 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 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

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

        render() {
          const canRename = this.canRename();
          const isClassroomProgramType = this.props.course.type === 'ClassroomProgramCourse';
          const timelineDatesDiffer = this.props.course.start !== this.props.course.timeline_start || this.props.course.end !== this.props.course.timeline_end;
          let campus;
      Severity: Minor
      Found in app/assets/javascripts/components/overview/details.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 365 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

        API has 36 functions (exceeds 20 allowed). Consider refactoring.
        Open

        const API = {
          // /////////
          // Getters /
          // /////////
          fetchFeedback(articleTitle, assignmentId) {
        Severity: Minor
        Found in app/assets/javascripts/utils/api.js - 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) {
                  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 _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 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 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);

                    Function Course has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const Course = withRouter((props) => {
                      useEffect(() => {
                        // Fetch all the data needed to render a course page
                        const courseSlug = getCourseSlug();
                        props.fetchCourse(courseSlug);
                    Severity: Major
                    Found in app/assets/javascripts/components/course/course.jsx - About 4 hrs to fix

                      Function Panel has 101 lines of code (exceeds 25 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: Major
                      Found in app/assets/javascripts/components/wizard/panel.jsx - About 4 hrs to fix

                        Function OnboardingSupplementary has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const OnboardingSupplementary = (props) => {
                          const formRef = useRef(null);
                          const navigate = useNavigate();
                          const [state, setState] = useState({
                            heardFrom: '',
                        Severity: Major
                        Found in app/assets/javascripts/components/onboarding/supplementary.jsx - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language