WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 462 of 1,666 total issues

Function SummaryPanel has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SummaryPanel = (props) => {
  const submit = () => {
    props.submitWizard(props.courseId);
    window.onbeforeunload = window.onbeforeunloadcache;
    return props.router.navigate(`/courses/${props.courseId}/timeline`);
Severity: Minor
Found in app/assets/javascripts/components/wizard/summary_panel.jsx - About 1 hr to fix

    Function initRangeSliders has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initRangeSliders() {
        $('[data-range]').each((i, slider) => {
          const $input = $(slider).next('[data-range-field]');
          const min = parseInt($(slider).data('min'));
          const max = parseInt($(slider).data('max'));
    Severity: Minor
    Found in app/assets/javascripts/surveys/modules/Survey.js - About 1 hr to fix

      Function exports has a Cognitive Complexity of 14 (exceeds 5 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: Minor
      Found in webpack.config.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 Option has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      const Option = ({
        index,
        panel_index,
        option,
        open_weeks,
      Severity: Minor
      Found in app/assets/javascripts/components/wizard/option.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 Nav has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      const Nav = () => {
        const {
          rooturl: rootUrl,
          logopath: logoPath,
          fluid: fluidStr,
      Severity: Minor
      Found in app/assets/javascripts/components/nav/nav.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

      Method create_alerts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def create_alerts
          @courses.each do |course|
            next unless course.type == 'ClassroomProgramCourse'
            next if course.students.empty?
            next if Alert.exists?(course_id: course.id, type: 'FirstEnrolledStudentAlert')
      Severity: Minor
      Found in lib/alerts/first_student_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 initSlider has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        initSlider() {
          this.$surveyContainer = $('[data-survey-form-container]');
          this.parentSlider = this.$surveyContainer.slick(assign({}, slickOptions, { adaptiveHeight: false }));
      
          this.parentSlider.on('init', (e, slick) => {
      Severity: Minor
      Found in app/assets/javascripts/surveys/modules/Survey.js - About 1 hr to fix

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

          render() {
            const { user } = this.props;
            const adminLevel = user.permissions === 3
              ? 'Super Admin'
              : 'Admin';
        Severity: Minor
        Found in app/assets/javascripts/components/settings/views/admin_user.jsx - About 1 hr to fix

          Function MainspaceChecklist has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const MainspaceChecklist = () => {
            const [isVisible, setIsVisible] = useState(false);
          
            const show = () => {
              setIsVisible(true);
          Severity: Minor
          Found in app/assets/javascripts/components/common/mainspace_checklist.jsx - About 1 hr to fix

            Function upgradeAdmin has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function PeerReviewChecklist has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const PeerReviewChecklist = () => {
                const [isVisible, setIsVisible] = useState(false);
                const show = () => {
                  setIsVisible(true);
                };
              Severity: Minor
              Found in app/assets/javascripts/components/common/peer_review_checklist.jsx - About 1 hr to fix

                Function StatisticsUpdateModal has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const StatisticsUpdateModal = (props) => {
                  const course = props.course;
                  const helpMessage = Features.wikiEd ? I18n.t('metrics.wiki_ed_help') : I18n.t('metrics.outreach_help');
                  const updatesEndMoment = toDate(course.update_until);
                  const futureUpdatesRemaining = isAfter(updatesEndMoment, new Date());

                  Function Notifications has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Notifications = () => {
                    const dispatch = useDispatch();
                    const notifications = useSelector(state => state.newsNotifications);
                  
                    const _handleClose = (notification) => {

                    Function Notifications has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Notifications = () => {
                      const dispatch = useDispatch();
                      const notifications = useSelector(state => state.notifications);
                    
                      const _handleClose = (notification) => {
                    Severity: Minor
                    Found in app/assets/javascripts/components/common/notifications.jsx - About 1 hr to fix

                      Function campaigns has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function campaigns(state = initialState, action) {
                        switch (action.type) {
                          case ADD_CAMPAIGN:
                          case DELETE_CAMPAIGN:
                          case RECEIVE_COURSE_CAMPAIGNS: {
                      Severity: Minor
                      Found in app/assets/javascripts/reducers/campaigns.js - About 1 hr to fix

                        Function saveTimeline has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async saveTimeline(courseId, data) {
                            const cleanObject = object => {
                              if (object.is_new) {
                                delete object.id;
                                delete object.is_new;
                        Severity: Minor
                        Found in app/assets/javascripts/utils/api.js - About 1 hr to fix

                          Function refreshData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const refreshData = (location, args, dispatch) => {
                            const {
                              lastUserRequestTimestamp,
                              courseSlug,
                              articlesLimit,
                          Severity: Minor
                          Found in app/assets/javascripts/components/util/refresh.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 handleErrorNotification has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const handleErrorNotification = function (data) {
                            const notification = {};
                          
                            notification.closable = true;
                            notification.type = 'error';
                          Severity: Minor
                          Found in app/assets/javascripts/reducers/notifications.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 ModuleRow has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const ModuleRow = ({ isStudent, module, trainingLibrarySlug }) => {
                            const isTrainingModule = module.kind === TRAINING_MODULE_KIND;
                            const isExercise = module.kind === EXERCISE_KIND;
                            const isDiscussion = module.kind === DISCUSSION_KIND;
                          
                          

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

                          const AddAvailableArticles = ({
                            course_id,
                            role,
                            project,
                            language,

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language