oaeproject/Hilary

View on GitHub
packages/oae-following/lib/api.js

Summary

Maintainability
D
1 day
Test Coverage
A
93%

Function getFollowing has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

const getFollowing = function (ctx, userId, start, limit, callback) {
Severity: Minor
Found in packages/oae-following/lib/api.js - About 35 mins to fix

    Function getFollowers has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    const getFollowers = function (ctx, userId, start, limit, callback) {
    Severity: Minor
    Found in packages/oae-following/lib/api.js - About 35 mins to fix

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

              AuthzUtil.filterDeletedIds(followerUserIds, (error, followerUserIds) => {
                if (error) {
                  return callback(error);
                }
      
      
      Severity: Major
      Found in packages/oae-following/lib/api.js and 1 other location - About 4 hrs to fix
      packages/oae-following/lib/api.js on lines 152..172

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

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

              AuthzUtil.filterDeletedIds(followingUserIds, (error, followingUserIds) => {
                if (error) {
                  return callback(error);
                }
      
      
      Severity: Major
      Found in packages/oae-following/lib/api.js and 1 other location - About 4 hrs to fix
      packages/oae-following/lib/api.js on lines 83..103

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

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

              FollowingDAO.saveFollows(ctx.user().id, [followedUserId], (error_) => {
                if (error_) {
                  return callback(error_);
                }
      
      
      Severity: Major
      Found in packages/oae-following/lib/api.js and 1 other location - About 2 hrs to fix
      packages/oae-following/lib/api.js on lines 261..267

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

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

        FollowingDAO.deleteFollows(ctx.user().id, [unfollowedUserId], (error) => {
          if (error) {
            return callback(error);
          }
      
      
      Severity: Major
      Found in packages/oae-following/lib/api.js and 1 other location - About 2 hrs to fix
      packages/oae-following/lib/api.js on lines 225..231

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

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

        try {
          unless(isLoggedInUser, {
            code: 401,
            msg: 'You must be authenticated to follow a user'
          })(ctx);
      Severity: Major
      Found in packages/oae-following/lib/api.js and 14 other locations - About 1 hr to fix
      packages/oae-authentication/lib/strategies/oauth/api.js on lines 39..51
      packages/oae-authentication/lib/strategies/oauth/api.js on lines 179..191
      packages/oae-jitsi/lib/api.meetings.js on lines 605..617
      packages/oae-resource/lib/actions.js on lines 410..422
      packages/oae-content/lib/api.js on lines 2389..2401
      packages/oae-content/lib/api.js on lines 2464..2476
      packages/oae-content/lib/api.js on lines 2733..2745
      packages/oae-discussions/lib/api.discussions.js on lines 1036..1047
      packages/oae-folders/lib/api.js on lines 954..966
      packages/oae-folders/lib/api.js on lines 1731..1743
      packages/oae-following/lib/api.js on lines 246..258
      packages/oae-principals/lib/api.group.js on lines 646..658
      packages/oae-principals/lib/api.group.js on lines 702..714
      packages/oae-principals/lib/api.user.js on lines 1327..1339

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

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

        try {
          unless(isLoggedInUser, {
            code: 401,
            msg: 'You must be authenticated to unfollow a user'
          })(ctx);
      Severity: Major
      Found in packages/oae-following/lib/api.js and 14 other locations - About 1 hr to fix
      packages/oae-authentication/lib/strategies/oauth/api.js on lines 39..51
      packages/oae-authentication/lib/strategies/oauth/api.js on lines 179..191
      packages/oae-jitsi/lib/api.meetings.js on lines 605..617
      packages/oae-resource/lib/actions.js on lines 410..422
      packages/oae-content/lib/api.js on lines 2389..2401
      packages/oae-content/lib/api.js on lines 2464..2476
      packages/oae-content/lib/api.js on lines 2733..2745
      packages/oae-discussions/lib/api.discussions.js on lines 1036..1047
      packages/oae-folders/lib/api.js on lines 954..966
      packages/oae-folders/lib/api.js on lines 1731..1743
      packages/oae-following/lib/api.js on lines 187..199
      packages/oae-principals/lib/api.group.js on lines 646..658
      packages/oae-principals/lib/api.group.js on lines 702..714
      packages/oae-principals/lib/api.user.js on lines 1327..1339

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

      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(isUserId, {
            code: 400,
            msg: 'You must specify a valid user id'
          })(userId);
      Severity: Major
      Found in packages/oae-following/lib/api.js and 13 other locations - About 35 mins to fix
      packages/oae-authz/lib/invitations/dao.js on lines 405..412
      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-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

      Similar blocks of code found in 14 locations. Consider refactoring.
      Invalid

        try {
          unless(isUserId, {
            code: 400,
            msg: 'You must specify a valid user id'
          })(userId);
      Severity: Major
      Found in packages/oae-following/lib/api.js and 13 other locations - About 35 mins to fix
      packages/oae-authz/lib/invitations/dao.js on lines 405..412
      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 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