GladysProject/Gladys

View on GitHub
server/utils/httpErrors.js

Summary

Maintainability
C
1 day
Test Coverage

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

module.exports = {
  HttpError,
  Error400,
  Error401,
  Error403,
Severity: Major
Found in server/utils/httpErrors.js and 4 other locations - About 1 hr to fix
server/services/ewelink/lib/utils/constants.js on lines 16..26
server/services/philips-hue/lib/utils/consts.js on lines 12..22
server/utils/colors.js on lines 184..194
server/utils/device.js on lines 228..238

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

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

class Error500 extends HttpError {
  constructor(error) {
    super();
    this.status = 500;
    this.code = 'SERVER_ERROR';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 63..70

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

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

class Error403 extends HttpError {
  constructor(message) {
    super();
    this.status = 403;
    this.code = 'FORBIDDEN';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 63..70
server/utils/httpErrors.js on lines 72..79

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

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

class Error401 extends HttpError {
  constructor(message) {
    super();
    this.status = 401;
    this.code = 'UNAUTHORIZED';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 63..70
server/utils/httpErrors.js on lines 72..79

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

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

class Error409 extends HttpError {
  constructor(error) {
    super();
    this.status = 409;
    this.code = 'CONFLICT';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 63..70
server/utils/httpErrors.js on lines 72..79

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

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

class Error429 extends HttpError {
  constructor(properties) {
    super();
    this.status = 429;
    this.code = 'TOO_MANY_REQUESTS';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 72..79

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

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

class Error422 extends HttpError {
  constructor(properties) {
    super();
    this.status = 422;
    this.code = 'UNPROCESSABLE_ENTITY';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 63..70
server/utils/httpErrors.js on lines 72..79

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

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

class Error404 extends HttpError {
  constructor(message) {
    super();
    this.status = 404;
    this.code = 'NOT_FOUND';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 9..16
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 63..70
server/utils/httpErrors.js on lines 72..79

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

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

class Error400 extends HttpError {
  constructor(message) {
    super();
    this.status = 400;
    this.code = 'BAD_REQUEST';
Severity: Major
Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
server/utils/httpErrors.js on lines 18..25
server/utils/httpErrors.js on lines 27..34
server/utils/httpErrors.js on lines 36..43
server/utils/httpErrors.js on lines 45..52
server/utils/httpErrors.js on lines 54..61
server/utils/httpErrors.js on lines 63..70
server/utils/httpErrors.js on lines 72..79

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

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