deltreey/wildstring

View on GitHub

Showing 55 of 55 total issues

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

      it('should match matching strings even if the pattern ends with multiple wildcards', function() {
          // Given: a string that is longer than the pattern, but matches up to the wildcard, and the pattern
          var pattern = 'test***',
                  string = 'test';

Severity: Major
Found in karma-test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should return false if the string doesn\'t match the pattern and no wildcard is given', function() {
          // Given: a string and a pattern that don't match
          var pattern = 'test',
                  string = 'testing';

Severity: Major
Found in test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should match matching strings even if there\'s a wildcard in the middle', function() {
          // Given: a string that is longer than the pattern, but matches after to the wildcard, and the pattern
          var pattern = 'test*ing',
                  string = 'testing';

Severity: Major
Found in test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should work with multiple wildcards in the middle and at the end', function() {
          // Given: a string that is longer than the pattern, but matches after to the wildcard, and the pattern
          var pattern = 'te*st*ing*',
                  string = 'tea stings';

Severity: Major
Found in test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should not match strings that have extra characters at the beginning when the pattern doesn\'t begin with a wildcard', function() {
          // Given: a string that is longer than the pattern, but matches after to the wildcard, and the pattern
          var pattern = 'ing*',
                  string = 'testing';

Severity: Major
Found in karma-test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should move on if a wildcard doesn\'t continue to match but can later', function() {
          // Given: a string that has a pattern after the wildcard twice
          var pattern = '*test*ing',
                  string = 'I\'m testing this thing';

Severity: Major
Found in karma-test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should match longer strings if the pattern begins with a wildcard', function() {
          // Given: a string that is longer than the pattern, but matches after to the wildcard, and the pattern
          var pattern = '*ing',
                  string = 'testing';

Severity: Major
Found in test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should match strings that match the beginning and end with a wildcard in the middle', function() {
          // Given: a string that is longer than the pattern, but matches after to the wildcard, and the pattern
          var pattern = 'bow*ing',
                  string = 'bowstring';

Severity: Major
Found in test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should return false if the string doesn\'t match the pattern and no wildcard is given', function() {
          // Given: a string and a pattern that don't match
          var pattern = 'test',
                  string = 'testing';

Severity: Major
Found in karma-test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 102..112
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

      it('should match matching strings even if the pattern ends with a wildcard', function() {
          // Given: a string that is longer than the pattern, but matches up to the wildcard, and the pattern
          var pattern = 'test*',
                  string = 'test';

Severity: Major
Found in karma-test/test.js and 41 other locations - About 1 hr to fix
karma-test/test.js on lines 18..28
karma-test/test.js on lines 30..40
karma-test/test.js on lines 42..52
karma-test/test.js on lines 54..64
karma-test/test.js on lines 66..76
karma-test/test.js on lines 78..88
karma-test/test.js on lines 90..100
karma-test/test.js on lines 114..124
karma-test/test.js on lines 126..136
karma-test/test.js on lines 138..148
karma-test/test.js on lines 150..160
karma-test/test.js on lines 162..172
karma-test/test.js on lines 174..184
karma-test/test.js on lines 186..196
karma-test/test.js on lines 198..208
karma-test/test.js on lines 210..220
karma-test/test.js on lines 222..232
karma-test/test.js on lines 234..244
karma-test/test.js on lines 246..256
karma-test/test.js on lines 271..281
test/test.js on lines 12..22
test/test.js on lines 44..54
test/test.js on lines 56..66
test/test.js on lines 68..78
test/test.js on lines 80..90
test/test.js on lines 92..102
test/test.js on lines 104..114
test/test.js on lines 116..126
test/test.js on lines 128..138
test/test.js on lines 140..150
test/test.js on lines 152..162
test/test.js on lines 164..174
test/test.js on lines 176..186
test/test.js on lines 188..198
test/test.js on lines 200..210
test/test.js on lines 212..222
test/test.js on lines 224..234
test/test.js on lines 236..246
test/test.js on lines 248..258
test/test.js on lines 260..270
test/test.js on lines 285..295

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

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

    checkRollbackStrings: function (rollbackStrings, patternSubstrings) {
        for (var s = 0; s < rollbackStrings.length; ++s) {
            var currentString = rollbackStrings[s].string;    // starting with the rolled back string
            var patternIndex = rollbackStrings[s].index;

Severity: Minor
Found in wildstring.js - About 1 hr to fix

    Function replace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        replace: function (pattern, strings) {
            if (pattern === undefined || strings === undefined) {
                throw new Error('wildstring.replace takes the pattern as one parameter and either a string or an array of strings as the second.  You didn\'t pass enough parameters.');
            }
            if (typeof(strings) === typeof('')) {
    Severity: Minor
    Found in wildstring.js - About 35 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

    Avoid too many return statements within this function.
    Open

                return wildstring.checkRollbackStrings(rollbackStrings, patternSubstrings);
    Severity: Major
    Found in wildstring.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return false;
      Severity: Major
      Found in wildstring.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return true;
        Severity: Major
        Found in wildstring.js - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language