tomi77/handlebars-helpers-underscore.string

View on GitHub

Showing 11 of 11 total issues

File underscore.string.spec.js has 738 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const Handlebars = require('handlebars');
require('../dist/handlebars-helpers-underscore.string');

describe('A Handlebars helpers underscore.string wrapper have function that', () => {
  it('should trims defined characters from beginning and ending of the string', () => {
Severity: Major
Found in spec/underscore.string.spec.js - About 1 day to fix

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

      it('should searches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found', () => {
        const template = Handlebars.compile('{{str_left_back str pat}}');
    
        expect(template({str: 'This_is_a_test_string', pat: '_'})).toBe('This_is_a_test');
        expect(template({str: 'This_is_a_test_string', pat: 'This'})).toBe('');
    Severity: Major
    Found in spec/underscore.string.spec.js and 3 other locations - About 1 day to fix
    spec/underscore.string.spec.js on lines 656..668
    spec/underscore.string.spec.js on lines 670..682
    spec/underscore.string.spec.js on lines 684..696

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

    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

      it('should searches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found', () => {
        const template = Handlebars.compile('{{str_left str pat}}');
    
        expect(template({str: 'This_is_a_test_string', pat: '_'})).toBe('This');
        expect(template({str: 'This_is_a_test_string', pat: 'This'})).toBe('');
    Severity: Major
    Found in spec/underscore.string.spec.js and 3 other locations - About 1 day to fix
    spec/underscore.string.spec.js on lines 656..668
    spec/underscore.string.spec.js on lines 670..682
    spec/underscore.string.spec.js on lines 698..710

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

    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

      it('should searches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found', () => {
        const template = Handlebars.compile('{{str_right str pat}}');
    
        expect(template({str: 'This_is_a_test_string', pat: '_'})).toBe('is_a_test_string');
        expect(template({str: 'This_is_a_test_string', pat: 'string'})).toBe('');
    Severity: Major
    Found in spec/underscore.string.spec.js and 3 other locations - About 1 day to fix
    spec/underscore.string.spec.js on lines 670..682
    spec/underscore.string.spec.js on lines 684..696
    spec/underscore.string.spec.js on lines 698..710

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

    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

      it('should searches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found', () => {
        const template = Handlebars.compile('{{str_right_back str pat}}');
    
        expect(template({str: 'This_is_a_test_string', pat: '_'})).toBe('string');
        expect(template({str: 'This_is_a_test_string', pat: 'string'})).toBe('');
    Severity: Major
    Found in spec/underscore.string.spec.js and 3 other locations - About 1 day to fix
    spec/underscore.string.spec.js on lines 656..668
    spec/underscore.string.spec.js on lines 684..696
    spec/underscore.string.spec.js on lines 698..710

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

    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

      it('should returns the successor to str', () => {
        const template = Handlebars.compile('{{succ str}}');
    
        expect(template({str: 'a'})).toBe('b');
        expect(template({str: 'A'})).toBe('B');
    Severity: Major
    Found in spec/underscore.string.spec.js and 1 other location - About 1 day to fix
    spec/underscore.string.spec.js on lines 317..327

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

    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

      it('should returns the predecessor to str', () => {
        const template = Handlebars.compile('{{pred str}}');
    
        expect(template({str: 'b'})).toBe('a');
        expect(template({str: 'B'})).toBe('A');
    Severity: Major
    Found in spec/underscore.string.spec.js and 1 other location - About 1 day to fix
    spec/underscore.string.spec.js on lines 305..315

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

    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

      it('should split string by chars', () => {
        const template = Handlebars.compile('{{#each (chars str)}}{{this}} {{/each}}');
    
        expect(template({str: 'Hello'})).toBe('H e l l o ');
        expect(template({str: 123})).toBe('1 2 3 ');
    Severity: Major
    Found in spec/underscore.string.spec.js and 1 other location - About 6 hrs to fix
    spec/underscore.string.spec.js on lines 181..189

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

    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

      it('should compress some whitespaces to one', () => {
        const template = Handlebars.compile('{{clean str}}');
    
        expect(template({str: ' foo    bar   '})).toBe('foo bar');
        expect(template({str: 123})).toBe('123');
    Severity: Major
    Found in spec/underscore.string.spec.js and 1 other location - About 6 hrs to fix
    spec/underscore.string.spec.js on lines 505..513

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

    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

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

    var data = { "name": "Alan", "hometown": "Somewhere, TX",
                 "kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
    Severity: Minor
    Found in examples/vanilla/index.js and 1 other location - About 40 mins to fix
    examples/webpack/index.js on lines 9..10

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

    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

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

    var data = { "name": "Alan", "hometown": "Somewhere, TX",
                 "kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
    Severity: Minor
    Found in examples/webpack/index.js and 1 other location - About 40 mins to fix
    examples/vanilla/index.js on lines 6..7

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

    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