oaeproject/Hilary

View on GitHub
packages/oae-authz/lib/invitations/dao.js

Summary

Maintainability
A
50 mins
Test Coverage
A
93%

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

export {
  getOrCreateTokensByEmails,
  getTokensByEmails,
  getEmailByToken,
  getAllInvitationsByEmail,
Severity: Minor
Found in packages/oae-authz/lib/invitations/dao.js and 1 other location - About 50 mins to fix
packages/oae-tenants/lib/internal/dao.networks.js on lines 439..450

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

const {
  unless,
  validateInCase: bothCheck,
  isResourceId,
  isEmail,
Severity: Major
Found in packages/oae-authz/lib/invitations/dao.js and 6 other locations - About 40 mins to fix
packages/oae-activity/lib/internal/push.js on lines 36..45
packages/oae-discussions/lib/internal/dao.js on lines 236..236
packages/oae-messagebox/lib/api.js on lines 52..61
packages/oae-messagebox/lib/model.js on lines 55..55
packages/oae-search/lib/searches/general.js on lines 28..37
packages/oae-util/lib/image.js on lines 28..37

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

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 14 locations. Consider refactoring.
Invalid

  try {
    unless(isEmail, {
      code: 400,
      msg: 'Specified email is not valid'
    })(email);
Severity: Major
Found in packages/oae-authz/lib/invitations/dao.js and 13 other locations - About 35 mins to fix
packages/oae-jitsi/lib/api.meetings.js on lines 294..301
packages/oae-jitsi/lib/api.meetings.js on lines 852..859
packages/oae-principals/lib/internal/dao.js on lines 282..289
packages/oae-discussions/lib/api.discussions.js on lines 355..362
packages/oae-discussions/lib/api.discussions.js on lines 466..473
packages/oae-folders/lib/api.js on lines 1306..1313
packages/oae-folders/lib/api.js on lines 1489..1496
packages/oae-following/lib/api.js on lines 56..63
packages/oae-following/lib/api.js on lines 124..131
packages/oae-principals/lib/api.group.js on lines 202..209
packages/oae-principals/lib/api.user.js on lines 795..802
packages/oae-principals/lib/api.user.js on lines 1049..1056
packages/oae-util/lib/mq.js on lines 365..372

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

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