WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 462 of 1,666 total issues

Function CategoriesScoping has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CategoriesScoping = () => {
  const depth = useSelector(state => state.scopingMethods.categories.depth);
  const categories = useSelector(state => state.scopingMethods.categories.tracked);
  const home_wiki = useSelector(state => state.course.home_wiki);
  const dispatch = useDispatch();

    File training_slide_handler.jsx has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useEffect, useState } from 'react';
    import { useNavigate, useParams } from 'react-router';
    import { extend } from 'lodash-es';
    import { useDispatch, useSelector } from 'react-redux';
    import { fetchTrainingModule, setSlideCompleted, setCurrentSlide, toggleMenuOpen } from '../../actions/training_actions.js';
    Severity: Minor
    Found in app/assets/javascripts/training/components/training_slide_handler.jsx - About 2 hrs to fix

      Function articleFromTitleInput has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static articleFromTitleInput(articleTitleInput) {
          const articleTitle = articleTitleInput;
          if (!/http/.test(articleTitle)) {
            const title = articleTitle.replace(/_/g, ' ');
            return {
      Severity: Major
      Found in app/assets/javascripts/utils/course_utils.js - About 2 hrs to fix

        Function SettingsHandler has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SettingsHandler = () => {
          const dispatch = useDispatch();
        
          const adminUsers = useSelector(state => state.settings.adminUsers);
          const specialUsers = useSelector(state => state.settings.specialUsers);
        Severity: Major
        Found in app/assets/javascripts/components/settings/settings_handler.jsx - About 2 hrs to fix

          Function newsContent has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const newsContent = newsContentList.map((news, index) => {
              const isCurrentlyEditedNews = editNewsId === news.id;
              const isHovered = newsHoverId === news.id;
              const confirmDelete = confirmDeleteNewsId === news.id;
              // Opaque text area input when admin selects delete news

            Function downgradeSpecialUser has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const downgradeSpecialUser = (username, position) => (dispatch) => {
              // remove a user's admin status
              // username: user's username
              dispatch({
                type: REVOKING_SPECIAL_USER,
            Severity: Minor
            Found in app/assets/javascripts/actions/settings_actions.js - About 2 hrs to fix

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

              const TrainingModulesViewMode = (props) => {
                  const block = props.block;
                  const modules = [];
                  const length = block.training_modules.length;
              
              

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

                const TrainingModuleHandler = (props) => {
                  useEffect(() => {
                    const moduleId = document.getElementById('react_root').getAttribute('data-module-id');
                    props.fetchTrainingModule({ module_id: moduleId });
                  }, []);

                  Function articleFinder has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function articleFinder(state = initialState, action) {
                    switch (action.type) {
                      case UPDATE_FINDER_FIELD: {
                        const newState = { ...state };
                        newState[action.data.key] = action.data.value;
                  Severity: Minor
                  Found in app/assets/javascripts/reducers/article_finder.js - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render() {
                      let content;
                      let faqLink;
                  
                      let wikipediaHelpButton;
                  Severity: Minor
                  Found in app/assets/javascripts/components/common/get_help_button.jsx - About 1 hr 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 CourseOresPlot has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const CourseOresPlot = ({ course }) => {
                    const [show, setShow] = useState(false);
                    const [refreshedData, setRefreshedData] = useState(null);
                    const [loading, setLoading] = useState(true);
                    const [refresh, setRefresh] = useState(false);
                  Severity: Minor
                  Found in app/assets/javascripts/components/articles/course_ores_plot.jsx - About 1 hr 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 PetScanScoping has a Cognitive Complexity of 15 (exceeds 5 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);

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

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

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

                    def create_alerts
                      @courses.each do |course|
                        next unless course.type == 'ClassroomProgramCourse'
                        next unless course.approved? # No alerts needed for unapproved courses
                        next if Alert.exists?(course_id: course.id, type: 'UntrainedStudentsAlert')
                  Severity: Minor
                  Found in lib/alerts/untrained_students_alert_manager.rb - About 1 hr 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 InlineUsers has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const InlineUsers = (props) => {
                    const lastUserIndex = props.users.length - 1;
                    let userList = props.users.map((user, index) => {
                      let extraInfo = '';
                      const link = `/users/${user.username}`; // User profile page
                  Severity: Minor
                  Found in app/assets/javascripts/components/overview/inline_users.jsx - About 1 hr 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 fetchCourseScopedRevisions has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const fetchCourseScopedRevisions = (course, limit) => async (dispatch, getState) => {
                    const state = getState();
                    const users = state.users.users.filter(user => user.role === STUDENT_ROLE);
                  
                    dispatch({ type: COURSE_SCOPED_REVISIONS_LOADING });
                  Severity: Minor
                  Found in app/assets/javascripts/actions/revisions_actions.js - About 1 hr to fix

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

                    export const downgradeAdmin = username => (dispatch) => {
                      // remove a user's admin status
                      // username: user's username
                      dispatch({
                        type: REVOKING_ADMIN,
                    Severity: Minor
                    Found in app/assets/javascripts/actions/settings_actions.js - About 1 hr to fix

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

                        render() {
                          return (
                            <tr>
                              <td>
                                <form onSubmit={this.handleSubmit}>

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

                        const moduleByExercises = (modules) => {
                          const orderedSteps = [
                            'Complete your Bibliography',
                            'Create in the sandbox',
                            'Expand your Draft',
                        Severity: Minor
                        Found in app/assets/javascripts/components/resources/resources.jsx - About 1 hr to fix

                          Function SlideMenu has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const SlideMenu = (props) => {
                            useEffect(() => {
                              window.addEventListener('click', props.closeMenu, false);
                          
                              return () => {
                          Severity: Minor
                          Found in app/assets/javascripts/training/components/slide_menu.jsx - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language