lagranovskiy/j316-translator

View on GitHub

Showing 28 of 97 total issues

Function senderConnector has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

var senderConnector = function(socketChannel) {


    socketChannel.on('connection', function(socket) {

Severity: Minor
Found in app/connector/SenderConnector.js - About 1 day 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 senderConnector has 196 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var senderConnector = function(socketChannel) {


    socketChannel.on('connection', function(socket) {

Severity: Major
Found in app/connector/SenderConnector.js - About 7 hrs to fix

    Function consumerConnector has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    var consumerConnector = function (socketChannel) {
    
    
        /**
         * Socket server for handlich translation service
    Severity: Minor
    Found in app/connector/ConsumerConnector.js - About 6 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 consumerConnector has 119 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var consumerConnector = function (socketChannel) {
    
    
        /**
         * Socket server for handlich translation service
    Severity: Major
    Found in app/connector/ConsumerConnector.js - About 4 hrs to fix

      Function translationWorker has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var translationWorker = function () {
      
          var worker = {
      
      
      
      Severity: Major
      Found in app/provider/BibleVerseWorker.js - About 4 hrs to fix

        File TranslationController.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        angular.module('j316.translate.controller.translation', ['angular-underscore'])
            .controller('TranslationPanelCtrl', function($scope, $location, $timeout, $log, TranslationService, QuestionService, languages, $mdDialog, $mdMedia, $mdToast) {
        
                $scope.showLastMsgCount = 20;
                $scope.messages = [];
        Severity: Minor
        Found in public/sender/js/controllers/TranslationController.js - About 3 hrs to fix

          Function requestTranslation has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              requestTranslation: function (text, sourceLanguage, translationSource) {
                  if (!text) {
                      console.error('Service :: Cannot request a translation of null');
                      return;
                  }
          Severity: Major
          Found in app/business/ServiceDistributor.js - About 3 hrs to fix

            Function protocolService has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var protocolService = function() {
            
                var cache = new NodeCache({
                    stdTTL: 60 * 60 * 18,
                    checkperiod: 60 * 60 * 3
            Severity: Major
            Found in app/business/ProtokollDistributor.js - About 2 hrs to fix

              Function startVoiceRecognition has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      $scope.startVoiceRecognition = function() {
                          if (!('webkitSpeechRecognition' in window)) {
                              $log.log("webkitSpeechRecognition is not available");
                          }
                          else {
              Severity: Major
              Found in public/sender/js/controllers/TranslationController.js - About 2 hrs to fix

                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

                  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

                            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

                              Function yandexTranslator has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var yandexTranslator = function () {
                              
                                  var service = {
                              
                                      /**
                              Severity: Minor
                              Found in app/provider/connectors/YandexConnector.js - About 1 hr to fix

                                Function exports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                module.exports = function(app) {
                                
                                
                                    var errorHandler = function(err, req, res, next) {
                                        console.error(err.stack);
                                Severity: Minor
                                Found in app/router.js - About 1 hr to fix

                                  Function submitQuestionAnswer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      submitQuestionAnswer: function (answer, questionUUID, senderName, senderLanguage) {
                                          var question = this.msgCache.get(questionUUID);
                                          if (!question) {
                                              console.error('Cannot find msg with uuid ' + questionUUID + ' answer not accepted.');
                                              return;
                                  Severity: Minor
                                  Found in app/business/QuestionDistributor.js - About 1 hr to fix

                                    Function postmarkConnector has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    var postmarkConnector = function() {
                                    
                                        var client = new postmark.Client(config.keys.postmark.apiToken);
                                    
                                        var service = {
                                    Severity: Minor
                                    Found in app/provider/connectors/PostmarkConnector.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language