manshar/manshar

View on GitHub

Showing 82 of 82 total issues

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

angular.module('webClientApp')
  .service('ArticleRecommendation', ['$resource', 'API_HOST',
      function ($resource, API_HOST) {

      var baseUrl = '//' + API_HOST + '/api/v1/';
Severity: Major
Found in web-client/app/scripts/services/recommendationService.js and 1 other location - About 2 hrs to fix
web-client/app/scripts/services/commentService.js on lines 3..32

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

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

angular.module('webClientApp')
  .service('ArticleComment', ['$resource', 'API_HOST',
      function ($resource, API_HOST) {

      var baseUrl = '//' + API_HOST + '/api/v1/';
Severity: Major
Found in web-client/app/scripts/services/commentService.js and 1 other location - About 2 hrs to fix
web-client/app/scripts/services/recommendationService.js on lines 3..36

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

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

Method perform has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform(start_index=1)

    if @@client.nil? or @@analytics.nil?
      puts 'Not calculating total articles stats due to client authorization or service discovery issue.'
      return
Severity: Major
Found in backend/app/workers/article_total_stats_worker.rb - About 2 hrs to fix

    TimingFunctions has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Animation.TimingFunctions = {
      linearTween: function(t){
        return t;
      },
      easeInQuad: function(t){
    Severity: Minor
    Found in web-client/app/scripts/helpers/animation.js - About 2 hrs to fix

      Method perform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def perform(start_index=1)
      
          if @@client.nil? or @@analytics.nil?
            puts 'Not calculating total articles stats due to client authorization or service discovery issue.'
            return
      Severity: Minor
      Found in backend/app/workers/article_total_stats_worker.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function link has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            link: function (scope, element) {
              scope.selectedCategory = null;
              scope.categories = Category.query();
              scope.topics = [];
              // scope.allowCreateTopics = false;
      Severity: Major
      Found in web-client/app/scripts/directives/categoryTopicPicker.js - About 2 hrs to fix

        Function link has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              link: function (scope, element) {
                scope.commentsCount = 0;
                scope.commentsCountToShow = 4;
        
                // Shows the anchor icon for the user to click.
        Severity: Major
        Found in web-client/app/scripts/directives/anchoredComment.js - About 2 hrs to fix

          Function loadMoreData has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  scope.loadMoreData = function() {
                    scope.inProgress = true;
          
                    if(scope.state === 'publishers') {
                      User.query({
          Severity: Minor
          Found in web-client/app/scripts/directives/loadMoreData.js - About 2 hrs to fix

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

                var updateError = function(response) {
                  $analytics.eventTrack('Update Error', {
                    category: 'Category',
                    label: angular.toJson(response.errors)
                  });
            web-client/app/scripts/controllers/admin/manageCategoriesCtrl.js on lines 68..75

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

            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 createError = function(response) {
                  $analytics.eventTrack('Create Error', {
                    category: 'Category',
                    label: angular.toJson(response.errors)
                  });
            web-client/app/scripts/controllers/admin/manageCategoriesCtrl.js on lines 51..58

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

            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

            gulp.task('assets:dist', function() {
              return gulp.src(config.dist.src, {base: config.dist.base})
                .pipe(gulp.dest(config.dist.dest));
            });
            Severity: Major
            Found in web-client/gulp/tasks/production/assets.js and 1 other location - About 1 hr to fix
            web-client/gulp/tasks/production/assets.js on lines 9..12

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

            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

            gulp.task('assets:production', function() {
              return gulp.src(config.production.src, {base: config.production.base})
                .pipe(gulp.dest(config.production.dest));
            });
            Severity: Major
            Found in web-client/gulp/tasks/production/assets.js and 1 other location - About 1 hr to fix
            web-client/gulp/tasks/production/assets.js on lines 18..21

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

            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

            Method index has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
            
                # Retreive users around a specific user id.
                # TODO(mkhatib): This is really ugly and hacky.
                # Move this to the user model and come up with a better way to paginate.
            Severity: Minor
            Found in backend/app/controllers/api/v1/users_controller.rb - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            gulp.task('scripts:production', function() {
              return gulp.src(config.index.production.src)
                .pipe(assets.js())
                .pipe(gulp.dest(config.index.production.dest));
            });
            Severity: Major
            Found in web-client/gulp/tasks/production/scripts.js and 1 other location - About 1 hr to fix
            web-client/gulp/tasks/production/styles.js on lines 38..42

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

            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

            gulp.task('styles:production', ['sass:production'], function() {
              return gulp.src(config.index.production.src)
                  .pipe(assets.css())
                  .pipe(gulp.dest(config.index.production.dest));
            });
            Severity: Major
            Found in web-client/gulp/tasks/production/styles.js and 1 other location - About 1 hr to fix
            web-client/gulp/tasks/production/scripts.js on lines 11..15

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

            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 deleteError = function (response) {
                  $scope.inProgress = null;
                  $analytics.eventTrack('Delete Article Error', {
                    category: 'Article',
                    label: angular.toJson(response.errors)
            Severity: Major
            Found in web-client/app/scripts/controllers/editArticleController.js and 1 other location - About 1 hr to fix
            web-client/app/scripts/controllers/editArticleController.js on lines 90..97

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

            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 updateError = function (response) {
                  $scope.inProgress = null;
                  $analytics.eventTrack('Article Update Error', {
                    category: 'Article',
                    label: angular.toJson(response.errors)
            Severity: Major
            Found in web-client/app/scripts/controllers/editArticleController.js and 1 other location - About 1 hr to fix
            web-client/app/scripts/controllers/editArticleController.js on lines 109..116

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

            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

            Method create has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                unless resource_params[:email]
                  return render json: {
                    success: false,
                    errors: ['You must provide an email address.']
            Severity: Minor
            Found in backend/app/controllers/api/v1/confirmations_controller.rb - About 1 hr to fix

              Method create has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create
                  # Check
                  field = (resource_params.keys.map(&:to_sym) & resource_class.authentication_keys).first
              
                  @resource = nil
              Severity: Minor
              Found in backend/app/controllers/api/v1/sessions_controller.rb - About 1 hr to fix

                Method index has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def index
                
                    # Retreive users around a specific user id.
                    # TODO(mkhatib): This is really ugly and hacky.
                    # Move this to the user model and come up with a better way to paginate.
                Severity: Minor
                Found in backend/app/controllers/api/v1/users_controller.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language