WikiEducationFoundation/WikiEduDashboard

View on GitHub
test/utils/course_utils.spec.js

Summary

Maintainability
F
1 wk
Test Coverage

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

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

      test(
        'returns an article object with the language, project, title, and url',
        () => {
          const assignment = {
            article_url: 'https://es.wikipedia.org/wiki/Autofoto',
    Severity: Major
    Found in test/utils/course_utils.spec.js and 1 other location - About 5 hrs to fix
    test/utils/course_utils.spec.js on lines 249..268

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

    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

      test(
        'returns an article object with the language, project, title, and url, comparing it to the default wiki',
        () => {
          const assignment = {
            article_url: 'https://es.wikipedia.org/wiki/Silvia_Federici',
    Severity: Major
    Found in test/utils/course_utils.spec.js and 1 other location - About 5 hrs to fix
    test/utils/course_utils.spec.js on lines 228..247

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

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

      test('correctly parses mobile Wikipedia redlinks', () => {
        const input = 'https://en.m.wikipedia.org/w/index.php?title=Red_link&action=edit&redlink=1';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Red link');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses the wikimedia incubator url', () => {
        const input = 'https://incubator.wikimedia.org/wiki/Wp/kiu/Heyder_Cansa';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Wp/kiu/Heyder Cansa');
        expect(output.project).toBe('wikimedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses wikipedia redlinks (variation: The edit link for an older revision)', () => {
        const input = 'https://en.wikipedia.org/w/index.php?title=72nd_Primetime_Emmy_Awards&oldid=980777920&action=edit';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('72nd Primetime Emmy Awards');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses Wikimedia redlinks', () => {
        const input = 'https://incubator.wikimedia.org/w/index.php?title=Redlink&action=edit&redlink=1';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Redlink');
        expect(output.project).toBe('wikimedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('handles mobile urls correctly', () => {
        const input = 'https://en.m.wikipedia.org/wiki/Robot_selfie';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Robot selfie');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('handles url-encoded characters in Wikipedia redlinks -- #2', () => {
        const input = 'https://en.wikipedia.org/w/index.php?title=Mesut%20%C3%96zil:REDLINK&redirect=no';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Mesut Özil');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215

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

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

      test('converts Wikipedia urls into titles', () => {
        const input = 'https://en.wikipedia.org/wiki/Robot_selfie';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Robot selfie');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('handles url-encoded characters in Wikipedia urls', () => {
        const input = 'https://es.wikipedia.org/wiki/Jalape%C3%B1o';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Jalapeño');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test("correctly parses multilingual wikisource url's", () => {
        const input = 'https://wikisource.org/wiki/Heyder_Cansa';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Heyder Cansa');
        expect(output.project).toBe('wikisource');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses Wikipedia redlinks', () => {
        const input = 'https://en.wikipedia.org/w/index.php?title=Redlink&action=edit&redlink=1';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Redlink');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses wikipedia redlinks (variation: Section edit link)', () => {
        const input = 'https://en.wikipedia.org/w/index.php?title=Sweetwater_Formation&action=edit&section=2';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Sweetwater Formation');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses wikipedia redlinks (variation: Old version of page)', () => {
        const input = 'https://en.wikipedia.org/w/index.php?title=Smedsb%C3%B6le_Radio_Mast&oldid=479392613';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Smedsböle Radio Mast');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('correctly parses wikipedia redlinks (variation: Old version edit link using VisualEditor)', () => {
        const input = ' https://en.wikipedia.org/w/index.php?title=Christian_Social_Party_of_Obwalden&oldid=886780353&veaction=editsource';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Christian Social Party of Obwalden');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 208..215
    test/utils/course_utils.spec.js on lines 217..224

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

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

      test('handles url-encoded characters in Wikipedia redlinks -- #1', () => {
        const input = 'https://en.wikipedia.org/w/index.php?title=Jalape%C3%B1o&action=edit&redlink=1';
        const output = courseUtils.articleFromTitleInput(input);
        expect(output.title).toBe('Jalapeño');
        expect(output.project).toBe('wikipedia');
    Severity: Major
    Found in test/utils/course_utils.spec.js and 13 other locations - About 3 hrs to fix
    test/utils/course_utils.spec.js on lines 100..107
    test/utils/course_utils.spec.js on lines 109..116
    test/utils/course_utils.spec.js on lines 118..125
    test/utils/course_utils.spec.js on lines 127..134
    test/utils/course_utils.spec.js on lines 136..143
    test/utils/course_utils.spec.js on lines 145..152
    test/utils/course_utils.spec.js on lines 154..161
    test/utils/course_utils.spec.js on lines 163..170
    test/utils/course_utils.spec.js on lines 172..179
    test/utils/course_utils.spec.js on lines 181..188
    test/utils/course_utils.spec.js on lines 190..197
    test/utils/course_utils.spec.js on lines 199..206
    test/utils/course_utils.spec.js on lines 217..224

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

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

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

      test('collapses multiple whiltespaces into one space', () => {
        const course = {
          term: 'Fall    2015',
          school: ' University    of   Wikipedia            ',
          title: '          Introduction     to         Editing          '
    Severity: Major
    Found in test/utils/course_utils.spec.js and 1 other location - About 1 hr to fix
    test/utils/course_utils.spec.js on lines 5..13

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

    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

      test('creates a slug from term, title and school', () => {
        const course = {
          term: 'Fall 2015',
          school: 'University of Wikipedia',
          title: 'Introduction to Editing'
    Severity: Major
    Found in test/utils/course_utils.spec.js and 1 other location - About 1 hr to fix
    test/utils/course_utils.spec.js on lines 25..33

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

    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

    Parsing error: Cannot find module 'babel-plugin-root-import' Require stack: - /usr/local/node_modules/@babel/core/lib/config/files/plugins.js - /usr/local/node_modules/@babel/core/lib/config/files/index.js - /usr/local/node_modules/@babel/core/lib/index.js - /usr/local/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs - /usr/local/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs - /usr/local/node_modules/@babel/eslint-parser/lib/client.cjs - /usr/local/node_modules/@babel/eslint-parser/lib/index.cjs - /usr/local/node_modules/eslint/lib/cli-engine/config-array-factory.js - /usr/src/app/lib/eslint6-patch.js - /usr/src/app/lib/eslint.js - /usr/src/app/bin/eslint.js
    Open

    import '../testHelper';
    Severity: Minor
    Found in test/utils/course_utils.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status