nymag/nunjucks-filters

View on GitHub

Showing 43 of 43 total issues

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

  it('formats with default format', function () {
    var result,
      date = 'something',
      defaultFormat = filter.getDefaultFormat(),
      expectedResult = 'whatever';
Severity: Major
Found in filters/dates/formatLocalDate.test.js and 1 other location - About 4 hrs to fix
filters/dates/formatUTCDate.test.js on lines 34..48

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

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

  it('formats with default format', function () {
    var result,
      date = 'something',
      defaultFormat = filter.getDefaultFormat(),
      expectedResult = 'whatever';
Severity: Major
Found in filters/dates/formatUTCDate.test.js and 1 other location - About 4 hrs to fix
filters/dates/formatLocalDate.test.js on lines 34..48

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

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

  it('formats with given format', function () {
    var result,
      date = 'something',
      givenFormat = 'something else',
      expectedResult = 'whatever';
Severity: Major
Found in filters/dates/formatUTCDate.test.js and 1 other location - About 4 hrs to fix
filters/dates/formatLocalDate.test.js on lines 50..64

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

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

  it('formats with given format', function () {
    var result,
      date = 'something',
      givenFormat = 'something else',
      expectedResult = 'whatever';
Severity: Major
Found in filters/dates/formatLocalDate.test.js and 1 other location - About 4 hrs to fix
filters/dates/formatUTCDate.test.js on lines 50..64

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

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.falsy;
  });

Severity: Major
Found in filters/strings/trimDash.test.js and 3 other locations - About 2 hrs to fix
filters/strings/breakSpaces.test.js on lines 6..14
filters/strings/camelToSpinalCase.test.js on lines 6..14
filters/strings/spinalToCamelCase.test.js on lines 6..14

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

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.falsy;
  });

Severity: Major
Found in filters/strings/breakSpaces.test.js and 3 other locations - About 2 hrs to fix
filters/strings/camelToSpinalCase.test.js on lines 6..14
filters/strings/spinalToCamelCase.test.js on lines 6..14
filters/strings/trimDash.test.js on lines 6..14

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

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.falsy;
  });

Severity: Major
Found in filters/strings/spinalToCamelCase.test.js and 3 other locations - About 2 hrs to fix
filters/strings/breakSpaces.test.js on lines 6..14
filters/strings/camelToSpinalCase.test.js on lines 6..14
filters/strings/trimDash.test.js on lines 6..14

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

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.falsy;
  });

Severity: Major
Found in filters/strings/camelToSpinalCase.test.js and 3 other locations - About 2 hrs to fix
filters/strings/breakSpaces.test.js on lines 6..14
filters/strings/spinalToCamelCase.test.js on lines 6..14
filters/strings/trimDash.test.js on lines 6..14

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

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.false;
  });
});
Severity: Major
Found in filters/strings/striptags.test.js and 5 other locations - About 50 mins to fix
filters/data/traverse.test.js on lines 6..10
filters/dates/testDates.test.js on lines 6..10
filters/strings/convertEntities.test.js on lines 6..10
filters/strings/stripentities.test.js on lines 6..10
filters/strings/striplinks.test.js on lines 6..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 52.

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.falsy;
  });
});
Severity: Major
Found in filters/strings/convertEntities.test.js and 5 other locations - About 50 mins to fix
filters/data/traverse.test.js on lines 6..10
filters/dates/testDates.test.js on lines 6..10
filters/strings/stripentities.test.js on lines 6..10
filters/strings/striplinks.test.js on lines 6..10
filters/strings/striptags.test.js on lines 6..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 52.

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.false;
  });
});
Severity: Major
Found in filters/dates/testDates.test.js and 5 other locations - About 50 mins to fix
filters/data/traverse.test.js on lines 6..10
filters/strings/convertEntities.test.js on lines 6..10
filters/strings/stripentities.test.js on lines 6..10
filters/strings/striplinks.test.js on lines 6..10
filters/strings/striptags.test.js on lines 6..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 52.

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.false;
  });
});
Severity: Major
Found in filters/strings/striplinks.test.js and 5 other locations - About 50 mins to fix
filters/data/traverse.test.js on lines 6..10
filters/dates/testDates.test.js on lines 6..10
filters/strings/convertEntities.test.js on lines 6..10
filters/strings/stripentities.test.js on lines 6..10
filters/strings/striptags.test.js on lines 6..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 52.

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.false;
  });
});
Severity: Major
Found in filters/strings/stripentities.test.js and 5 other locations - About 50 mins to fix
filters/data/traverse.test.js on lines 6..10
filters/dates/testDates.test.js on lines 6..10
filters/strings/convertEntities.test.js on lines 6..10
filters/strings/striplinks.test.js on lines 6..10
filters/strings/striptags.test.js on lines 6..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 52.

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

describe('Filters: ' + filterName, function () {
  it('return false on empty', function () {
    expect(filter()).to.be.falsy;
  });
});
Severity: Major
Found in filters/data/traverse.test.js and 5 other locations - About 50 mins to fix
filters/dates/testDates.test.js on lines 6..10
filters/strings/convertEntities.test.js on lines 6..10
filters/strings/stripentities.test.js on lines 6..10
filters/strings/striplinks.test.js on lines 6..10
filters/strings/striptags.test.js on lines 6..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 52.

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

var filterName = __filename.split('/').pop().split('.').shift(),
  filter = require('./' + filterName),
  expect = require('chai').expect;
Severity: Major
Found in filters/strings/trimDash.test.js and 22 other locations - About 45 mins to fix
filters/data/indexOf.test.js on lines 2..4
filters/data/isEmpty.test.js on lines 2..4
filters/data/traverse.test.js on lines 2..4
filters/data/typeof.test.js on lines 2..4
filters/dates/after.test.js on lines 2..4
filters/dates/formatDate.test.js on lines 2..4
filters/dates/formatLocalDate.test.js on lines 2..6
filters/dates/formatUTCDate.test.js on lines 2..6
filters/dates/getCurrentYear.test.js on lines 2..4
filters/dates/testDates.test.js on lines 2..4
filters/files/fileExists.test.js on lines 2..4
filters/files/includeFile.test.js on lines 1..3
filters/numbers/toK.test.js on lines 2..4
filters/strings/breakSpaces.test.js on lines 2..4
filters/strings/camelToSpinalCase.test.js on lines 2..4
filters/strings/convertEntities.test.js on lines 2..4
filters/strings/fromBase64.test.js on lines 2..4
filters/strings/spinalToCamelCase.test.js on lines 2..4
filters/strings/stripentities.test.js on lines 2..4
filters/strings/striplinks.test.js on lines 2..4
filters/strings/striptags.test.js on lines 2..4
filters/strings/toBase64.test.js on lines 2..4

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

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

var filterName = __filename.split('/').pop().split('.').shift(),
  filter = require('./' + filterName),
  expect = require('chai').expect;
Severity: Major
Found in filters/data/isEmpty.test.js and 22 other locations - About 45 mins to fix
filters/data/indexOf.test.js on lines 2..4
filters/data/traverse.test.js on lines 2..4
filters/data/typeof.test.js on lines 2..4
filters/dates/after.test.js on lines 2..4
filters/dates/formatDate.test.js on lines 2..4
filters/dates/formatLocalDate.test.js on lines 2..6
filters/dates/formatUTCDate.test.js on lines 2..6
filters/dates/getCurrentYear.test.js on lines 2..4
filters/dates/testDates.test.js on lines 2..4
filters/files/fileExists.test.js on lines 2..4
filters/files/includeFile.test.js on lines 1..3
filters/numbers/toK.test.js on lines 2..4
filters/strings/breakSpaces.test.js on lines 2..4
filters/strings/camelToSpinalCase.test.js on lines 2..4
filters/strings/convertEntities.test.js on lines 2..4
filters/strings/fromBase64.test.js on lines 2..4
filters/strings/spinalToCamelCase.test.js on lines 2..4
filters/strings/stripentities.test.js on lines 2..4
filters/strings/striplinks.test.js on lines 2..4
filters/strings/striptags.test.js on lines 2..4
filters/strings/toBase64.test.js on lines 2..4
filters/strings/trimDash.test.js on lines 2..4

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

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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (iterable, keywords) {
  var result, start, attribute;

  if (keywords && keywords.__keywords === true) {
    //if they've given us a keyword (mimicking jinja)
Severity: Minor
Found in filters/math/sum.js - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

var _ = require('lodash'),
  filterName = __filename.split('/').pop().split('.').shift(),
  filter = require('./' + filterName),
  expect = require('chai').expect,
  sinon = require('sinon');
Severity: Major
Found in filters/dates/formatLocalDate.test.js and 22 other locations - About 45 mins to fix
filters/data/indexOf.test.js on lines 2..4
filters/data/isEmpty.test.js on lines 2..4
filters/data/traverse.test.js on lines 2..4
filters/data/typeof.test.js on lines 2..4
filters/dates/after.test.js on lines 2..4
filters/dates/formatDate.test.js on lines 2..4
filters/dates/formatUTCDate.test.js on lines 2..6
filters/dates/getCurrentYear.test.js on lines 2..4
filters/dates/testDates.test.js on lines 2..4
filters/files/fileExists.test.js on lines 2..4
filters/files/includeFile.test.js on lines 1..3
filters/numbers/toK.test.js on lines 2..4
filters/strings/breakSpaces.test.js on lines 2..4
filters/strings/camelToSpinalCase.test.js on lines 2..4
filters/strings/convertEntities.test.js on lines 2..4
filters/strings/fromBase64.test.js on lines 2..4
filters/strings/spinalToCamelCase.test.js on lines 2..4
filters/strings/stripentities.test.js on lines 2..4
filters/strings/striplinks.test.js on lines 2..4
filters/strings/striptags.test.js on lines 2..4
filters/strings/toBase64.test.js on lines 2..4
filters/strings/trimDash.test.js on lines 2..4

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

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

var filterName = __filename.split('/').pop().split('.').shift(),
  filter = require('./' + filterName),
  expect = require('chai').expect;
Severity: Major
Found in filters/strings/fromBase64.test.js and 22 other locations - About 45 mins to fix
filters/data/indexOf.test.js on lines 2..4
filters/data/isEmpty.test.js on lines 2..4
filters/data/traverse.test.js on lines 2..4
filters/data/typeof.test.js on lines 2..4
filters/dates/after.test.js on lines 2..4
filters/dates/formatDate.test.js on lines 2..4
filters/dates/formatLocalDate.test.js on lines 2..6
filters/dates/formatUTCDate.test.js on lines 2..6
filters/dates/getCurrentYear.test.js on lines 2..4
filters/dates/testDates.test.js on lines 2..4
filters/files/fileExists.test.js on lines 2..4
filters/files/includeFile.test.js on lines 1..3
filters/numbers/toK.test.js on lines 2..4
filters/strings/breakSpaces.test.js on lines 2..4
filters/strings/camelToSpinalCase.test.js on lines 2..4
filters/strings/convertEntities.test.js on lines 2..4
filters/strings/spinalToCamelCase.test.js on lines 2..4
filters/strings/stripentities.test.js on lines 2..4
filters/strings/striplinks.test.js on lines 2..4
filters/strings/striptags.test.js on lines 2..4
filters/strings/toBase64.test.js on lines 2..4
filters/strings/trimDash.test.js on lines 2..4

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

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

var filterName = __filename.split('/').pop().split('.').shift(),
  filter = require('./' + filterName),
  expect = require('chai').expect;
Severity: Major
Found in filters/strings/stripentities.test.js and 22 other locations - About 45 mins to fix
filters/data/indexOf.test.js on lines 2..4
filters/data/isEmpty.test.js on lines 2..4
filters/data/traverse.test.js on lines 2..4
filters/data/typeof.test.js on lines 2..4
filters/dates/after.test.js on lines 2..4
filters/dates/formatDate.test.js on lines 2..4
filters/dates/formatLocalDate.test.js on lines 2..6
filters/dates/formatUTCDate.test.js on lines 2..6
filters/dates/getCurrentYear.test.js on lines 2..4
filters/dates/testDates.test.js on lines 2..4
filters/files/fileExists.test.js on lines 2..4
filters/files/includeFile.test.js on lines 1..3
filters/numbers/toK.test.js on lines 2..4
filters/strings/breakSpaces.test.js on lines 2..4
filters/strings/camelToSpinalCase.test.js on lines 2..4
filters/strings/convertEntities.test.js on lines 2..4
filters/strings/fromBase64.test.js on lines 2..4
filters/strings/spinalToCamelCase.test.js on lines 2..4
filters/strings/striplinks.test.js on lines 2..4
filters/strings/striptags.test.js on lines 2..4
filters/strings/toBase64.test.js on lines 2..4
filters/strings/trimDash.test.js on lines 2..4

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

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