manshar/manshar

View on GitHub

Showing 82 of 82 total issues

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

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

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

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('images:production', function() {
  return gulp.src(config.production.src)
    .pipe(gulp.dest(config.production.dest));
});
Severity: Major
Found in web-client/gulp/tasks/production/images.js and 1 other location - About 1 hr to fix
web-client/gulp/tasks/production/fonts.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 64.

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 exports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

Severity: Minor
Found in web-client/karma.conf.js - About 1 hr to fix

    Function save has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            save: function (data, optSuccess, optError, optProgress) {
    
              var delayedObj = {};
    
              // TODO(mkhatib): Until we figure out a way to rename files either
    Severity: Minor
    Found in web-client/app/scripts/services/imageService.js - About 1 hr to fix

      Method up has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.up    
        #Tables
            #Conversations
          create_table :mailboxer_conversations do |t|
            t.column :subject, :string, :default => ""

        Method create has a Cognitive Complexity of 11 (exceeds 5 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

        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

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

            var cleanup = function() {
              for (var i = 0; i < listeners.length; i++) {
                listeners[i]();
              }
              listeners = [];
        Severity: Major
        Found in web-client/app/scripts/directives/anchoredComment.js and 1 other location - About 1 hr to fix
        web-client/app/scripts/directives/anchoredComments.js on lines 114..119

        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

            var resetError = function(response) {
              $analytics.eventTrack('Password Reset Error', {
                category: 'User',
                label: angular.toJson(response.errors)
              });
        web-client/app/scripts/controllers/updatePasswordController.js on lines 26..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 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

            var updateError = function(response) {
              $analytics.eventTrack('Password Update Error', {
                category: 'User',
                label: angular.toJson(response.errors)
              });
        web-client/app/scripts/controllers/resetPasswordController.js on lines 21..27

        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

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

            var cleanup = function() {
              for (var i = 0; i < listeners.length; i++) {
                listeners[i]();
              }
              listeners = [];
        Severity: Major
        Found in web-client/app/scripts/directives/anchoredComments.js and 1 other location - About 1 hr to fix
        web-client/app/scripts/directives/anchoredComment.js on lines 39..44

        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 link has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              link: function (scope, element) {
                scope.$watch('article', function (newValue) {
                  if (!newValue) {
                    return;
                  }
        Severity: Minor
        Found in web-client/app/scripts/directives/recommendButton.js - About 1 hr to fix

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

                link: function (scope, element, attrs, ngModel) {
                  ngModel.$render = function() {
                    if (ngModel.$viewValue) {
                      if (!carbon.Loader.load('embedProviders')) {
                        carbon.Loader.register('embedProviders', {
          Severity: Minor
          Found in web-client/app/scripts/directives/articleRenderer.js - About 1 hr to fix

            Method create has a Cognitive Complexity of 10 (exceeds 5 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

            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

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

                    $auth.signOut()
                    .then(
                      // Success.
                      angular.bind(this, function(response) {
                        if(optSuccess) {
            Severity: Major
            Found in web-client/app/scripts/services/loginService.js and 1 other location - About 1 hr to fix
            web-client/app/scripts/services/loginService.js on lines 18..33

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

            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

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

                    $auth.submitLogin(user)
                    .then(
            
                      // Success.
                      angular.bind(this, function(response) {
            Severity: Major
            Found in web-client/app/scripts/services/loginService.js and 1 other location - About 1 hr to fix
            web-client/app/scripts/services/loginService.js on lines 37..50

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

            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 update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def update
                # make sure user is authorized
                unless @resource
                  return render json: {
                    success: false,
            Severity: Minor
            Found in backend/app/controllers/api/v1/passwords_controller.rb - About 1 hr to fix

              Function scrollToHelper_ has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  element, x1, x2, prop, t, v, step, timeFunc) {
              Severity: Major
              Found in web-client/app/scripts/helpers/animation.js - About 1 hr to fix

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

                      var ArticleRecommendationResource = $resource(
                        baseUrl + 'articles/:articleId/recommendations/:recommendationId', {
                          articleId: '@articleId'
                        }, {
                          get: {cache: true},
                Severity: Minor
                Found in web-client/app/scripts/services/recommendationService.js and 1 other location - About 50 mins to fix
                web-client/app/scripts/services/commentService.js on lines 8..14

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

                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 ArticleCommentResource = $resource(
                        baseUrl + 'articles/:articleId/comments/:commentId', {
                          articleId: '@articleId'
                        }, {
                          get: {cache: true},
                Severity: Minor
                Found in web-client/app/scripts/services/commentService.js and 1 other location - About 50 mins to fix
                web-client/app/scripts/services/recommendationService.js on lines 8..14

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

                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 smoothScrollTo has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    container, from, to, prop, duration, timeFunc) {
                Severity: Minor
                Found in web-client/app/scripts/helpers/animation.js - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language