lagranovskiy/j316-translator

View on GitHub

Showing 97 of 97 total issues

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

        $scope.$on('socket:error', function(ev, data) {
            $log.warn(data);
            TranslationService.disconnect();

            $mdToast.show(
Severity: Major
Found in public/sender/js/controllers/SenderController.js and 1 other location - About 2 hrs to fix
public/sender/js/controllers/TranslationController.js on lines 166..176

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

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 app.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';


angular.module('senderApp', [
    'ngCookies',
Severity: Minor
Found in public/sender/js/app.js - About 2 hrs to fix

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

    angular.module('j316.translate.service.info', [])
        .service('InfoService', function ($rootScope) {
            var info = {};
    
            $rootScope.$on('info', function (event, data) {
    Severity: Major
    Found in public/sender/js/service/InfoService.js and 1 other location - About 2 hrs to fix
    public/consumer/js/service/InfoService.js on lines 1..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 81.

    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

    angular.module('j316.translate.service.info', [])
        .service('InfoService', function ($rootScope) {
    
            var info = {};
    
    
    Severity: Major
    Found in public/consumer/js/service/InfoService.js and 1 other location - About 2 hrs to fix
    public/sender/js/service/InfoService.js on lines 1..13

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

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

            verseQueue: async.queue(function (job, callback) {
    
                    var lookupJobArray = job.verseJobs;
                    var targetLanguage = job.targetLanguage;
                    var verse = job.verse;
    Severity: Major
    Found in app/provider/BibleVerseWorker.js - About 2 hrs to fix

      Function dbtConnector has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var dbtConnector = function () {
      
          var service = {
              /**
               * Returns vers with given parameters fetched from dbt.io
      Severity: Major
      Found in app/provider/connectors/DbtConnector.js - About 2 hrs to fix

        Function getVersInLang has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                getVersInLang: function (damId, bookId, chapterId, verseStart, verse_end, callback) {
                    if (!damId) {
                        console.info('dbtConnector :: no damID given.');
                        return callback('Unknown translation');
                    }
        Severity: Minor
        Found in app/provider/connectors/DbtConnector.js - About 1 hr to fix

          Function prepareVerseLookup has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  prepareVerseLookup: function (senderLanguage, verse, callback) {
                      refParser.parseOSIS(senderLanguage, verse, function (err, refInfoArray) {
                          if (!refInfoArray || refInfoArray.length == 0) {
                              return callback('VerseWorker :: no parsing of verse possible');
                          }
          Severity: Minor
          Found in app/provider/BibleVerseWorker.js - About 1 hr to fix

            Function protokollService has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var protokollService = function() {
            
                var controller = {
            
                    /**
            Severity: Minor
            Found in app/service/ProtokollService.js - About 1 hr to fix

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

                          if (event.keyCode == 8 && (event.ctrlKey == true || event.shiftKey == true)) {
                              $scope.undo();
                              event.defaultPrevented = true;
                              event.preventDefault();
                          }
              Severity: Major
              Found in public/sender/js/controllers/TranslationController.js and 2 other locations - About 1 hr to fix
              public/sender/js/controllers/TranslationController.js on lines 369..373
              public/sender/js/controllers/TranslationController.js on lines 379..383

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

                          if (event.keyCode == 13 && (event.ctrlKey == true || event.shiftKey == true)) {
                              $scope.sendMessage();
                              event.defaultPrevented = true;
                              event.preventDefault();
                          }
              Severity: Major
              Found in public/sender/js/controllers/TranslationController.js and 2 other locations - About 1 hr to fix
              public/sender/js/controllers/TranslationController.js on lines 374..378
              public/sender/js/controllers/TranslationController.js on lines 379..383

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

                          if (event.keyCode == 8 && (event.ctrlKey == true && event.shiftKey == true)) {
                              $scope.redo();
                              event.defaultPrevented = true;
                              event.preventDefault();
                          }
              Severity: Major
              Found in public/sender/js/controllers/TranslationController.js and 2 other locations - About 1 hr to fix
              public/sender/js/controllers/TranslationController.js on lines 369..373
              public/sender/js/controllers/TranslationController.js on lines 374..378

              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

                  function emitTranslationToSender(translationObject) {
                      console.info('sender :: Emitting translation ' + translationObject.timestamp + ' to socket roam for ' + translationObject.targetLanguage);
              
                      socketChannel.to('lang_' + translationObject.targetLanguage).emit('newTranslation', translationObject);
                  }
              Severity: Major
              Found in app/connector/SenderConnector.js and 1 other location - About 1 hr to fix
              app/connector/ConsumerConnector.js on lines 188..191

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

              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

                  function emitTranslation(translationObject) {
                      console.info('client :: Emitting translation ' + translationObject.timestamp + ' to socket roam for ' + translationObject.targetLanguage);
                      socketChannel.to('lang_' + translationObject.targetLanguage).emit('newTranslation', translationObject);
                  }
              Severity: Major
              Found in app/connector/ConsumerConnector.js and 1 other location - About 1 hr to fix
              app/connector/SenderConnector.js on lines 322..326

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

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

                      distributeProtokoll: function(protokollDate, recipientList, callback) {
              
                          async.waterfall([function(asyncCallback) {
              
                              // Get protokoll internally
              Severity: Minor
              Found in app/business/ProtokollDistributor.js - About 1 hr to fix

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

                            if (!requestedDate) {
                                return res.status(500).send("Cannot get protokoll without date query option. use ?date=2016-02-02 as a paramteter");
                            }
                            else if (requestedDate === 'today') {
                                requestedDate = null;
                Severity: Major
                Found in app/service/ProtokollService.js and 1 other location - About 1 hr to fix
                app/service/ProtokollService.js on lines 52..60

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

                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

                            if (!requestedDate) {
                                return res.status(500).send("Cannot get distribute without date query option. use ?date=2016-02-02 as a paramteter");
                            }
                            else if (requestedDate === 'today') {
                                requestedDate = null;
                Severity: Major
                Found in app/service/ProtokollService.js and 1 other location - About 1 hr to fix
                app/service/ProtokollService.js on lines 21..29

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

                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

                                if (!socket.handshake.session.senderAuthenticatedOn ||
                                    new Date().getTime() - socket.handshake.session.senderAuthenticatedOn > 1000 * 60 * config.maxWaitingTime) {
                                    // If a sender forgot to logout then force logout after configured inactivity timeout of translator
                                    if (new Date().getTime() - serviceDistributor.getLastActivity() > 1000 * 60 * config.inactiveTimeout) {
                                        console.info('sender :: no active translation session. Forcing disconnect of the sender ' + socket.id);
                Severity: Major
                Found in app/connector/SenderConnector.js and 1 other location - About 1 hr to fix
                app/connector/ConsumerConnector.js on lines 28..40

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

                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

                        this.register = function (regInfo) {
                            if (!regInfo.name) {
                                regInfo.name = 'Anonym'
                            }
                
                
                Severity: Major
                Found in public/sender/js/service/TranslationService.js and 1 other location - About 1 hr to fix
                public/consumer/js/service/TranslationService.js on lines 81..90

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

                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

                        this.register = function (regInfo) {
                            if (!regInfo.name) {
                                regInfo.name = 'Anonym'
                            }
                
                
                Severity: Major
                Found in public/consumer/js/service/TranslationService.js and 1 other location - About 1 hr to fix
                public/sender/js/service/TranslationService.js on lines 126..135

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

                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