WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 1,607 of 1,607 total issues

File language_names.js has 923 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// adapted from https://github.com/meikidd/iso-639-1/blob/master/src/data.js

const LanguageNames = {
    aa: {
      name: 'Afar',
Severity: Major
Found in app/assets/javascripts/utils/language_names.js - About 2 days to fix

    Function render has 433 lines of code (exceeds 25 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: Major
    Found in app/assets/javascripts/components/overview/details.jsx - About 2 days to fix

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

      describe('getLastUpdateSummary', () => {
        test(
          'returns a last update summary, based on last update data',
          () => {
            const course = {
      Severity: Major
      Found in test/utils/statistic_update_info_utils.spec.js and 1 other location - About 2 days to fix
      test/utils/statistic_update_info_utils.spec.js on lines 376..458

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

      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

      describe('getTotaUpdatesMessage', () => {
        test(
          'returns a total update message, based on last update data',
          () => {
            const course = {
      Severity: Major
      Found in test/utils/statistic_update_info_utils.spec.js and 1 other location - About 2 days to fix
      test/utils/statistic_update_info_utils.spec.js on lines 292..374

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

      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 ArticleFinder has 334 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ArticleFinder = (props) => {
        const [isSubmitted, setIsSubmitted] = useState(false);
        const [showFilters, setShowFilters] = useState(false);
      
        useEffect(() => {
      Severity: Major
      Found in app/assets/javascripts/components/article_finder/article_finder.jsx - About 1 day to fix

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

        const keys = {
          title: {
            label: I18n.t(`${course_string_prefix}.courses`),
          },
          recent_revision_count: {
        app/assets/javascripts/components/courses_by_wiki/wiki_course_list.jsx on lines 9..51

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

        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 keys = {
          title: {
            label: I18n.t(`${course_string_prefix}.courses`),
          },
          recent_revision_count: {
        app/assets/javascripts/components/course/active_course_list.jsx on lines 9..51

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

        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 renderGraph has 300 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const renderGraph = () => {
            if (articleData.length === 0) {
              return;
            }
        
        

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

          const RecentEditsHandler = () => {
            const myCoursesRef = useRef(null);
          
            const dispatch = useDispatch();
            const revisions = useSelector(state => state.recentEdits.revisions);
          app/assets/javascripts/components/activity/did_you_know_handler.jsx on lines 16..51
          app/assets/javascripts/components/activity/plagiarism_handler.jsx on lines 16..47

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

          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

          const PlagiarismHandler = () => {
            const myCoursesRef = useRef(null);
          
            const dispatch = useDispatch();
            const revisions = useSelector(state => state.suspectedPlagiarism.revisions);
          app/assets/javascripts/components/activity/did_you_know_handler.jsx on lines 16..51
          app/assets/javascripts/components/activity/recent_edits_handler.jsx on lines 16..47

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

          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

          const DidYouKnowHandler = () => {
            const myCoursesRef = useRef(null);
          
            const dispatch = useDispatch();
            const articles = useSelector(state => state.didYouKnow.articles);
          app/assets/javascripts/components/activity/plagiarism_handler.jsx on lines 16..47
          app/assets/javascripts/components/activity/recent_edits_handler.jsx on lines 16..47

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

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

          //--------------------------------------------------------
          // Vendor Requirements [imports]
          //--------------------------------------------------------
          import { assign, throttle } from 'lodash-es';
          import Rails from '@rails/ujs';
          Severity: Major
          Found in app/assets/javascripts/surveys/modules/Survey.js - About 1 day to fix

            Function CourseApproval has 281 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const CourseApproval = (props) => {
              const [selectedWikiExpert, setSelectedWikiExpert] = useState({});
              const [selectedCampaigns, setSelectedCampaigns] = useState([]);
              const [selectedTags, setSelectedTags] = useState([]);
              const [createdTagOption, setCreatedTagOption] = useState([]);
            Severity: Major
            Found in app/assets/javascripts/components/course/course_approval.jsx - About 1 day to fix

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

                return (
                  <div className="scoping-method-petscan form-group">
                    <label htmlFor="pagepile-ids">Enter PagePile IDs/URLs</label>
                    <div
                      style={{
              app/assets/javascripts/components/course_creator/scoping_methods/petscan_scoping.jsx on lines 84..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 259.

              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

                return (
                  <div className="scoping-method-petscan form-group">
                    <label htmlFor="petscan-ids">Enter PetScan IDs/URLs</label>
                    <div style={{
                      display: 'grid',
              app/assets/javascripts/components/course_creator/scoping_methods/pagepile_scoping.jsx on lines 84..120

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

              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 render has 260 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  if (this.props.loading) {
                    return <Loading />;
                  }
              
              
              Severity: Major
              Found in app/assets/javascripts/components/timeline/timeline.jsx - About 1 day to fix

                Function CourseForm has 255 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const CourseForm = (props) => {
                  const handleWikiChange = (wiki) => {
                    const home_wiki = wiki.value;
                    const prev_wiki = { ...props.course.home_wiki };
                    const wikis = CourseUtils.normalizeWikis(
                Severity: Major
                Found in app/assets/javascripts/components/course_creator/course_form.jsx - About 1 day to fix

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

                    render() {
                      const i18nPrefix = this.props.course.string_prefix;
                      let buttonClass = 'button dark';
                      buttonClass += this.state.isPersisting ? ' working' : '';
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/components/overview/course_cloned_modal.jsx - About 1 day to fix

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

                      describe('#wikiwhoColorURL', () => {
                        it('should create a wikiwhoColorURL when given a valid article', () => {
                          const helper = new URLBuilder({ article: defaults.article });
                          const expected = 'https://wikiwho-api.wmcloud.org/en/whocolor/v1.0.0-beta/Brown%20Bear%2C%20Brown%20Bear%2C%20What%20Do%20You%20See%3F/0/';
                          expect(helper.wikiwhoColorURL()).toEqual(expected);
                    app/assets/javascripts/components/common/ArticleViewer/utils/URLBuilder.spec.js on lines 72..88

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

                    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

                      describe('#wikiwhoColorRevisionURL', () => {
                        it('should create a wikiwhoColorRevisionURL when given a valid article', () => {
                          const helper = new URLBuilder({ article: defaults.article });
                          const expected = 'https://wikiwho-api.wmcloud.org/en/api/v1.0.0-beta/rev_content/Brown%20Bear%2C%20Brown%20Bear%2C%20What%20Do%20You%20See%3F/?o_rev_id=true&editor=true&token_id=true&out=true&in=true';
                          expect(helper.wikiwhoColorRevisionURL()).toEqual(expected);
                    app/assets/javascripts/components/common/ArticleViewer/utils/URLBuilder.spec.js on lines 54..70

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

                    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