bcgov/common-object-management-service

View on GitHub
app/src/routes/v1/object.js

Summary

Maintainability
C
1 day
Test Coverage
D
63%

TODO found
Open

  // TODO: Add validation to reject unexpected query parameters
Severity: Minor
Found in app/src/routes/v1/object.js by fixme

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

router.get('/:objectId/sync', requireSomeAuth, objectValidator.syncObject,
  currentObject, hasPermission(Permissions.READ), (req, res, next) => {
    syncController.syncObject(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.patch('/:objectId/metadata', requireSomeAuth, objectValidator.addMetadata,
  currentObject, hasPermission(Permissions.UPDATE), (req, res, next) => {
    objectController.addMetadata(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.delete('/:objectId/metadata', requireSomeAuth, objectValidator.deleteMetadata,
  currentObject, hasPermission(Permissions.UPDATE), (req, res, next) => {
    objectController.deleteMetadata(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.put('/:objectId/tagging', requireSomeAuth, objectValidator.replaceTags,
  currentObject, hasPermission(Permissions.UPDATE), (req, res, next) => {
    objectController.replaceTags(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110

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

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

router.patch('/:objectId/public', requireSomeAuth, objectValidator.togglePublic,
  currentObject, hasPermission(Permissions.MANAGE), (req, res, next) => {
    objectController.togglePublic(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.get('/:objectId/version', requireSomeAuth, objectValidator.listObjectVersion,
  currentObject, hasPermission(Permissions.READ), (req, res, next) => {
    objectController.listObjectVersion(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.patch('/:objectId/tagging', requireSomeAuth, objectValidator.addTags,
  currentObject, hasPermission(Permissions.UPDATE), (req, res, next) => {
    objectController.addTags(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 113..117

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

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

router.delete('/:objectId', requireSomeAuth, objectValidator.deleteObject,
  currentObject, hasPermission(Permissions.DELETE), (req, res, next) => {
    objectController.deleteObject(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 85..89
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.put('/:objectId/metadata', requireSomeAuth, objectValidator.replaceMetadata,
  currentObject, hasPermission(Permissions.UPDATE), (req, res, next) => {
    objectController.replaceMetadata(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 8 other locations - About 55 mins to fix
app/src/routes/v1/object.js on lines 57..61
app/src/routes/v1/object.js on lines 64..68
app/src/routes/v1/object.js on lines 71..75
app/src/routes/v1/object.js on lines 78..82
app/src/routes/v1/object.js on lines 92..96
app/src/routes/v1/object.js on lines 99..103
app/src/routes/v1/object.js on lines 106..110
app/src/routes/v1/object.js on lines 113..117

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

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

router.head('/:objectId', objectValidator.headObject, currentObject, hasPermission(Permissions.READ),
  (req, res, next) => {
    objectController.headObject(req, res, next);
  }
);
Severity: Major
Found in app/src/routes/v1/object.js and 2 other locations - About 50 mins to fix
app/src/routes/v1/permission/bucketPermission.js on lines 19..23
app/src/routes/v1/permission/objectPermission.js on lines 19..23

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

There are no issues that match your filters.

Category
Status