WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 1,672 of 1,672 total issues

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

          <div>
            <label>
              <input type="radio" value="keyword" checked={props.search_type === 'keyword'} onChange={e => updateFieldsHandler('search_type', e.target.value)} />
              {I18n.t('article_finder.keyword_search')}
            </label>
app/assets/javascripts/components/article_finder/article_finder.jsx on lines 113..118

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 94.

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_language_mappings.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export const PageAssessmentGrades = {
  wikipedia: {
    en: {
      FA: {
        class: 'fa',
Severity: Minor
Found in app/assets/javascripts/utils/article_finder_language_mappings.js - About 2 hrs to fix

    Function default has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function (state = initialState, action) {
      switch (action.type) {
        case DELETE_TICKET: {
          const all = removeTicket(state.all, action.id);
          return {
    Severity: Major
    Found in app/assets/javascripts/reducers/tickets.js - About 2 hrs to fix

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

      export const addAssignment = assignment => (dispatch) => {
        return API.createAssignment(assignment)
          .then(resp => dispatch({ type: types.ADD_ASSIGNMENT, data: resp }))
          .catch(response => dispatch({ type: types.API_FAIL, data: response }));
      };
      Severity: Major
      Found in app/assets/javascripts/actions/assignment_actions.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/actions/assignment_actions.js on lines 54..58

      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 93.

      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

      export const deleteAssignment = assignment => (dispatch) => {
        return API.deleteAssignment(assignment)
          .then(resp => dispatch({ type: types.DELETE_ASSIGNMENT, data: resp }))
          .catch(response => dispatch({ type: types.API_FAIL, data: response }));
      };
      Severity: Major
      Found in app/assets/javascripts/actions/assignment_actions.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/actions/assignment_actions.js on lines 41..45

      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 93.

      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

      WeekdayPicker.propTypes = {
        className: PropTypes.string,
        style: PropTypes.object,
        tabIndex: PropTypes.number,
      
      
      Severity: Major
      Found in app/assets/javascripts/components/common/weekday_picker.jsx and 1 other location - About 2 hrs to fix
      app/assets/javascripts/components/course/course_alert.jsx on lines 42..52

      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 93.

      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

      CourseAlert.propTypes = {
        actionMessage: PropTypes.string,
        actionClassName: PropTypes.string,
        buttonLink: PropTypes.string,
        components: PropTypes.node,
      Severity: Major
      Found in app/assets/javascripts/components/course/course_alert.jsx and 1 other location - About 2 hrs to fix
      app/assets/javascripts/components/common/weekday_picker.jsx on lines 199..211

      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 93.

      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 4 locations. Consider refactoring.
      Open

        test(
          'returns a formatted_article from the same project and language in article and defaultWiki',
          () => {
            const defaultWiki = {
              language: 'en',
      Severity: Major
      Found in test/utils/course_utils.spec.js and 3 other locations - About 2 hrs to fix
      test/utils/course_utils.spec.js on lines 349..364
      test/utils/course_utils.spec.js on lines 366..378
      test/utils/course_utils.spec.js on lines 380..395

      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 93.

      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 4 locations. Consider refactoring.
      Open

        test(
          'returns a formatted_article from same project different language',
          () => {
            const defaultWiki = {
              language: 'en',
      Severity: Major
      Found in test/utils/course_utils.spec.js and 3 other locations - About 2 hrs to fix
      test/utils/course_utils.spec.js on lines 332..347
      test/utils/course_utils.spec.js on lines 366..378
      test/utils/course_utils.spec.js on lines 380..395

      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 93.

      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 4 locations. Consider refactoring.
      Open

        test(
          'returns a formatted_article from diferent project different language',
          () => {
            const defaultWiki = {
              language: 'en',
      Severity: Major
      Found in test/utils/course_utils.spec.js and 3 other locations - About 2 hrs to fix
      test/utils/course_utils.spec.js on lines 332..347
      test/utils/course_utils.spec.js on lines 349..364
      test/utils/course_utils.spec.js on lines 366..378

      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 93.

      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

            <td className="desktop-only-tc">
              <Link
                to={uploadsLink}
                onClick={() => { this.setUploadFilters([{ value: student.username, label: student.username }]); }}
              >
      app/assets/javascripts/components/students/shared/StudentList/Student/Student.jsx on lines 139..148

      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 93.

      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

              <td className="desktop-only-tc">
                <Link
                  to={uploadsLink}
                  onClick={() => {
                    this.setUploadFilters([{ value: student.username, label: student.username }]);
      app/assets/javascripts/components/students/components/Articles/SelectedStudent/RevisionsList/StudentRevisionRow.jsx on lines 18..25

      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 93.

      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 4 locations. Consider refactoring.
      Open

        test('returns a formatted_article from diferent project same language', () => {
          const defaultWiki = {
            language: 'en',
            project: 'wikipedia'
          };
      Severity: Major
      Found in test/utils/course_utils.spec.js and 3 other locations - About 2 hrs to fix
      test/utils/course_utils.spec.js on lines 332..347
      test/utils/course_utils.spec.js on lines 349..364
      test/utils/course_utils.spec.js on lines 380..395

      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 93.

      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 diff_viewer.jsx has 287 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 SalesforceMediaButtons from '../articles/salesforce_media_buttons.jsx';
      import Loading from '../common/loading.jsx';
      Severity: Minor
      Found in app/assets/javascripts/components/revisions/diff_viewer.jsx - About 2 hrs to fix

        File date_picker.jsx has 286 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 DayPicker from 'react-day-picker';
        import OnClickOutside from 'react-onclickoutside';
        Severity: Minor
        Found in app/assets/javascripts/components/common/date_picker.jsx - About 2 hrs to fix

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

            async fetchUserProfileStats(username) {
              const response = await request(`/user_stats.json?username=${username}`);
          
              if (!response.ok) {
                logErrorMessage(response);
          Severity: Major
          Found in app/assets/javascripts/utils/api.js and 2 other locations - About 2 hrs to fix
          app/assets/javascripts/utils/api.js on lines 161..171
          app/assets/javascripts/utils/api.js on lines 588..597

          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 91.

          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 3 locations. Consider refactoring.
          Open

            async fetchUserCourses(userId) {
              const response = await request(`/courses_users.json?user_id=${userId}`);
          
              if (!response.ok) {
                logErrorMessage(response);
          Severity: Major
          Found in app/assets/javascripts/utils/api.js and 2 other locations - About 2 hrs to fix
          app/assets/javascripts/utils/api.js on lines 80..90
          app/assets/javascripts/utils/api.js on lines 588..597

          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 91.

          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

                  <div className="input-row">
                    <input
                      type="radio"
                      name="wp10_score"
                      id="wp10_score"
          app/assets/javascripts/components/articles/article_graphs.jsx on lines 106..116

          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 91.

          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

                  <div className="nav__item" id="articles-link">
                    <p><NavLink to={articlesLink} className={({ isActive }) => (isActive ? 'active' : '')}>{CourseUtils.i18n('articles_short', course.wiki_string_prefix)}</NavLink></p>
                  </div>
          Severity: Major
          Found in app/assets/javascripts/components/common/course_navbar.jsx and 1 other location - About 2 hrs to fix
          app/assets/javascripts/components/common/course_navbar.jsx on lines 82..84

          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 91.

          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 3 locations. Consider refactoring.
          Open

            async enableAccountRequests(courseSlug) {
              const response = await request(`/requested_accounts/${courseSlug}/enable_account_requests`);
              if (!response.ok) {
                logErrorMessage(response);
                const data = await response.text();
          Severity: Major
          Found in app/assets/javascripts/utils/api.js and 2 other locations - About 2 hrs to fix
          app/assets/javascripts/utils/api.js on lines 80..90
          app/assets/javascripts/utils/api.js on lines 161..171

          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 91.

          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

          Severity
          Category
          Status
          Source
          Language