jsperf/jsperf.com

View on GitHub
test/unit/server/web/errors/index.js

Summary

Maintainability
D
2 days
Test Coverage

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

  lab.test('bypass custom error pages for all allowed routes', function (done) {
    server.inject('/web/bypass', function (response) {
      Code.expect(response.statusCode).to.equal(200);
      Code.expect(response.result).to.include('bypassed any boom errors');

Severity: Major
Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
test/unit/server/web/errors/index.js on lines 105..112
test/unit/server/web/errors/index.js on lines 114..121
test/unit/server/web/errors/index.js on lines 123..130
test/unit/server/web/errors/index.js on lines 132..139

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

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

  lab.test('display a general error page', function (done) {
    server.inject('/web/405', function (response) {
      Code.expect(response.statusCode).to.equal(500);
      Code.expect(response.result).to.include('something went wrong');

Severity: Major
Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
test/unit/server/web/errors/index.js on lines 105..112
test/unit/server/web/errors/index.js on lines 114..121
test/unit/server/web/errors/index.js on lines 123..130
test/unit/server/web/errors/index.js on lines 141..148

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

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

  lab.test('display a custom 404 page', function (done) {
    server.inject('/silly/no/way/this/is/a/route', function (response) {
      Code.expect(response.statusCode).to.equal(404);
      Code.expect(response.result).to.include('The requested document could not be found');

Severity: Major
Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
test/unit/server/web/errors/index.js on lines 105..112
test/unit/server/web/errors/index.js on lines 114..121
test/unit/server/web/errors/index.js on lines 132..139
test/unit/server/web/errors/index.js on lines 141..148

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

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

  lab.test('display a custom 400 page', function (done) {
    server.inject('/web/400', function (response) {
      Code.expect(response.statusCode).to.equal(400);
      Code.expect(response.result).to.include('The request cannot be fulfilled due to bad syntax');

Severity: Major
Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
test/unit/server/web/errors/index.js on lines 105..112
test/unit/server/web/errors/index.js on lines 123..130
test/unit/server/web/errors/index.js on lines 132..139
test/unit/server/web/errors/index.js on lines 141..148

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

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

  lab.test('display a custom 403 page', function (done) {
    server.inject('/web/403', function (response) {
      Code.expect(response.statusCode).to.equal(403);
      Code.expect(response.result).to.include('You don’t have permission to view this document');

Severity: Major
Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
test/unit/server/web/errors/index.js on lines 114..121
test/unit/server/web/errors/index.js on lines 123..130
test/unit/server/web/errors/index.js on lines 132..139
test/unit/server/web/errors/index.js on lines 141..148

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Route405Plugin.register = function (localserv, options, next) {
  localserv.route({
    method: 'GET',
    path: '/web/405',
    config: {
Severity: Major
Found in test/unit/server/web/errors/index.js and 2 other locations - About 2 hrs to fix
test/unit/server/web/errors/index.js on lines 12..23
test/unit/server/web/errors/index.js on lines 29..40

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Route400Plugin.register = function (localserv, options, next) {
  localserv.route({
    method: 'GET',
    path: '/web/400',
    config: {
Severity: Major
Found in test/unit/server/web/errors/index.js and 2 other locations - About 2 hrs to fix
test/unit/server/web/errors/index.js on lines 29..40
test/unit/server/web/errors/index.js on lines 46..57

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Route403Plugin.register = function (localserv, options, next) {
  localserv.route({
    method: 'GET',
    path: '/web/403',
    config: {
Severity: Major
Found in test/unit/server/web/errors/index.js and 2 other locations - About 2 hrs to fix
test/unit/server/web/errors/index.js on lines 12..23
test/unit/server/web/errors/index.js on lines 46..57

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

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

There are no issues that match your filters.

Category
Status