WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 1,672 of 1,672 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    const promises = chunk(articlesList, 20).map((articles) => {
      const query = pageAssessmentQueryGenerator(map(articles, 'title'));

      return limit(() => queryUrl(mediawikiApiBase(wiki.language, wiki.project), query))
      .then(data => data.query.pages)
Severity: Major
Found in app/assets/javascripts/actions/article_finder_action.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/actions/article_finder_action.js on lines 98..109

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 149.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  const promises = chunk(articlesList, 5).map((articles) => {
    const query = pageviewQueryGenerator(map(articles, 'pageid'));
    return limit(() => queryUrl(mediawikiApiBase(wiki.language, wiki.project), query))
    .then(data => data.query.pages)
    .then((data) => {
Severity: Major
Found in app/assets/javascripts/actions/article_finder_action.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/actions/article_finder_action.js on lines 130..142

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 149.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File course_utils.spec.js has 404 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import '../testHelper';
import courseUtils from '../../app/assets/javascripts/utils/course_utils.js';

describe('courseUtils.generateTempId', () => {
  test('creates a slug from term, title and school', () => {
Severity: Minor
Found in test/utils/course_utils.spec.js - About 5 hrs to fix

    Function Form has 142 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Form = (props) => {
      const [state, setState] = useState({
        started: false,
        user: props.currentUser,
        name: props.currentUser.real_name,
    Severity: Major
    Found in app/assets/javascripts/components/onboarding/form.jsx - About 5 hrs to fix

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

      const API = {
        // /////////
        // Getters /
        // /////////
        fetchFeedback(articleTitle, assignmentId) {
      Severity: Minor
      Found in app/assets/javascripts/utils/api.js - About 5 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if (this.props.trackedStatusFilterEnabled) {
              filterTracked = (
                <select
                  className="filter-articles"
                  value={this.props.trackedStatusFilter}
        Severity: Major
        Found in app/assets/javascripts/components/articles/article_list.jsx and 1 other location - About 5 hrs to fix
        app/assets/javascripts/components/articles/article_list.jsx on lines 225..237

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 148.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if (this.props.newnessFilterEnabled) {
              filterArticlesSelect = (
                <select
                  className="filter-articles"
                  value={this.props.newnessFilter}
        Severity: Major
        Found in app/assets/javascripts/components/articles/article_list.jsx and 1 other location - About 5 hrs to fix
        app/assets/javascripts/components/articles/article_list.jsx on lines 240..252

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 148.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        File article_finder.jsx has 399 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { useState, useEffect } from 'react';
        import { connect } from 'react-redux';
        import InputRange from 'react-input-range';
        import { includes, map, find } from 'lodash-es';
        import qs from 'query-string';
        Severity: Minor
        Found in app/assets/javascripts/components/article_finder/article_finder.jsx - About 5 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              case RECEIVE_REFERENCES_COURSE_SPECIFIC: {
                const newState = { ...state, courseSpecificReferencesLoaded: true };
                const revisionsArray = newState.courseScopedRevisions;
                const referencesAdded = action.data.referencesAdded;
                newState.courseScopedRevisions = revisionsArray.map((revision) => {
          Severity: Major
          Found in app/assets/javascripts/reducers/revisions.js and 1 other location - About 5 hrs to fix
          app/assets/javascripts/reducers/revisions.js on lines 94..105

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 146.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              case RECEIVE_REFERENCES: {
                const newState = { ...state, referencesLoaded: true };
                const revisionsArray = newState.revisions;
                const referencesAdded = action.data.referencesAdded;
                newState.revisions = revisionsArray.map((revision) => {
          Severity: Major
          Found in app/assets/javascripts/reducers/revisions.js and 1 other location - About 5 hrs to fix
          app/assets/javascripts/reducers/revisions.js on lines 106..117

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 146.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  {
                    type: 'symbol',
                    from: { data: 'points' },
                    encode: {
                      enter: {
          app/assets/javascripts/components/articles/course_quality_progress_graph.jsx on lines 293..309

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 145.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  } else if (UnhighlightedContributions) {
                    res = <div key={`legend-${user.name}`} className={'article-viewer-legend tooltip-trigger'}><p className={'tooltip large'} id={'popup-style'} >{I18n.t('users.contributions_not_highlighted', { username: user.name })}</p><a href={userLink} title={realName} target="_blank">{user.name}</a>{<span className="tooltip-indicator-article-viewer" />}</div>;
                  } else {
          app/assets/javascripts/components/common/article_viewer_legend.jsx on lines 39..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 145.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  } else {
                    res = <div key={`legend-${user.name}`} className={'article-viewer-legend tooltip-trigger'}><p className={'tooltip large'} id={'popup-style'}>{I18n.t('users.no_highlighting', { editor: user.name })}</p><a href={userLink} title={realName} target="_blank">{user.name}</a>{<span className="tooltip-indicator-article-viewer" />}</div>;
                  }
          app/assets/javascripts/components/common/article_viewer_legend.jsx on lines 37..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 145.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  {
                    type: 'symbol',
                    from: { data: 'points' },
                    encode: {
                      enter: {
          app/assets/javascripts/components/articles/course_quality_progress_graph.jsx on lines 276..292

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 145.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function EditSizeGraph has 136 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      timelineStart = (
                        <DatePicker
                          onChange={this.updateCourseDates}
                          value={this.props.course.timeline_start}
                          value_key="timeline_start"
                Severity: Major
                Found in app/assets/javascripts/components/overview/details.jsx and 1 other location - About 5 hrs to fix
                app/assets/javascripts/components/overview/details.jsx on lines 323..335

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 139.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      timelineEnd = (
                        <DatePicker
                          onChange={this.updateCourseDates}
                          value={this.props.course.timeline_end}
                          value_key="timeline_end"
                Severity: Major
                Found in app/assets/javascripts/components/overview/details.jsx and 1 other location - About 5 hrs to fix
                app/assets/javascripts/components/overview/details.jsx on lines 310..322

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 139.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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
                  Severity
                  Category
                  Status
                  Source
                  Language