goappes/hoodie-plugin-socialmedia

View on GitHub

Showing 36 of 36 total issues

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

    dualFollow: function (userId) {
      var defer = window.jQuery.Deferred();
      defer.notify('dualFollow', arguments, false);

      hoodie.pubsub.bidirectional(userId, hoodie.socialmedia.pubsubtypes)
Severity: Major
Found in hoodie.socialmedia.js and 2 other locations - About 3 hrs to fix
hoodie.socialmedia.js on lines 194..201
hoodie.socialmedia.js on lines 203..210

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

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

    getProfile: function (userId) {
      var defer = window.jQuery.Deferred();
      defer.notify('getProfile', arguments, false);
      hoodie.profile.get(userId)
        .then(defer.resolve)
Severity: Major
Found in hoodie.socialmedia.js and 1 other location - About 2 hrs to fix
hoodie.socialmedia.js on lines 636..643

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

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

    updateProfile: function (profile) {
      var defer = window.jQuery.Deferred();
      defer.notify('updateProfile', arguments, false);
      hoodie.profile.set(profile)
        .then(defer.resolve)
Severity: Major
Found in hoodie.socialmedia.js and 1 other location - About 2 hrs to fix
hoodie.socialmedia.js on lines 212..219

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

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

File socialmedia.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Dependencies
 */

var async = require('async');
Severity: Minor
Found in lib/socialmedia.js - About 2 hrs to fix

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

          if (userId === hoodie.id()) {
            hoodie.store.findAll('post')
              .then(hoodie.socialmedia.returnTask('feed', defer.resolve))
              .fail(defer.reject);
          } else {
    Severity: Major
    Found in hoodie.socialmedia.js and 3 other locations - About 1 hr to fix
    hoodie.socialmedia.js on lines 264..273
    hoodie.socialmedia.js on lines 289..298
    hoodie.socialmedia.js on lines 313..328

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

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

              if (userId === hoodie.id()) {
                hoodie.store.add('post', postObject)
                  .then(hoodie.socialmedia.returnTask('post', defer.resolve))
                  .fail(defer.reject);
              } else {
    Severity: Major
    Found in hoodie.socialmedia.js and 3 other locations - About 1 hr to fix
    hoodie.socialmedia.js on lines 289..298
    hoodie.socialmedia.js on lines 313..328
    hoodie.socialmedia.js on lines 395..404

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

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

          if (userId === hoodie.id()) {
            hoodie.store.update('post', postObject.id, postObject)
              .then(hoodie.socialmedia.returnTask('post', defer.resolve))
              .fail(defer.reject);
          } else {
    Severity: Major
    Found in hoodie.socialmedia.js and 3 other locations - About 1 hr to fix
    hoodie.socialmedia.js on lines 264..273
    hoodie.socialmedia.js on lines 313..328
    hoodie.socialmedia.js on lines 395..404

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

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

          if (userId === hoodie.id()) {
            if (!postObject) {
              hoodie.store.removeAll('post')
                .then(defer.resolve)
                .fail(defer.reject);
    Severity: Major
    Found in hoodie.socialmedia.js and 3 other locations - About 1 hr to fix
    hoodie.socialmedia.js on lines 264..273
    hoodie.socialmedia.js on lines 289..298
    hoodie.socialmedia.js on lines 395..404

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

    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

            hoodie.task('socialmediafeed').start(task)
              .then(function (task) {
                return hoodie.socialmedia.addProfileOnPosts(task.socialmedia.feed);
              })
              .then(hoodie.socialmedia.returnTask('feed', defer.resolve))
    Severity: Major
    Found in hoodie.socialmedia.js and 1 other location - About 1 hr to fix
    hoodie.socialmedia.js on lines 516..527

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

    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

          hoodie.task('socialmediagetpost').start(task)
            .then(function (task) {
              return hoodie.socialmedia.addProfileOnPost(task.socialmedia.post);
            })
            .then(function (post) {
    Severity: Major
    Found in hoodie.socialmedia.js and 1 other location - About 1 hr to fix
    hoodie.socialmedia.js on lines 375..379

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

    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

    Function post has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        post: function (postObject, userId) {
          var defer = window.jQuery.Deferred();
          defer.notify('post', arguments, false);
          userId = userId || hoodie.id();
          postObject.userId = userId;
    Severity: Minor
    Found in hoodie.socialmedia.js - About 1 hr to fix

      Function _addProfileOnCountType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var _addProfileOnCountType = function (collection, countType) {
          var defer = window.jQuery.Deferred();
          defer.notify('addProfile', arguments, false);
      
          var ids = collection.map(function (v) {
      Severity: Minor
      Found in hoodie.socialmedia.js - About 1 hr to fix

        Function _addProfileOnComments has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var _addProfileOnComments = function (collection) {
            var defer = window.jQuery.Deferred();
            defer.notify('addProfile', arguments, false);
        
            var ids = collection.map(function (v) {
        Severity: Minor
        Found in hoodie.socialmedia.js - About 1 hr to fix

          Function deletePost has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              deletePost: function (postObject, userId) {
                var defer = window.jQuery.Deferred();
                defer.notify('deletePost', arguments, false);
                userId = userId || hoodie.id();
                var task = {
          Severity: Minor
          Found in hoodie.socialmedia.js - About 1 hr to fix

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

                var uniqueArray = ids.filter(function (item, pos, self) {
                  return (self.indexOf(item) === pos && item !== undefined);
                });
            Severity: Minor
            Found in hoodie.socialmedia.js and 1 other location - About 35 mins to fix
            hoodie.socialmedia.js on lines 159..161

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

                var uniqueArray = ids.filter(function (item, pos, self) {
                  return (self.indexOf(item) === pos && item !== undefined);
                });
            Severity: Minor
            Found in hoodie.socialmedia.js and 1 other location - About 35 mins to fix
            hoodie.socialmedia.js on lines 124..126

            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

            Severity
            Category
            Status
            Source
            Language