arikalfus/Jeeves

View on GitHub

Showing 51 of 108 total issues

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

    $scope.newsSpeech = function(results){
        // Should only go to news page if it match anything from here.
        // ########Potential problem here: even though it is not "read something about news", it will still change the view to news.
        if ($scope.jeeves.view != 'news') {
            $scope.$apply(function(){
Severity: Minor
Found in js/mvc.js - About 1 hr to fix

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

    function base64_decode(data) {
      //  discuss at: http://phpjs.org/functions/base64_decode/
      // original by: Tyler Akins (http://rumkin.com)
      // improved by: Thunder.m
      // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    Severity: Minor
    Found in js/base64_decode.js - About 1 hr to fix

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

          $scope.sayWebTitle = function(section){
              $scope.adaptivePrompt();
              if ($scope.jeeves.newsPosition.section == "news"){
                  navigator.tts.speak($scope.jeeves.newsArticles.news[$scope.jeeves.newsPosition.articleIndex].webTitle+ $scope.jeeves.webTitle.calledWebTitle, function() {
                      $scope.reco($scope.dialogMan);
      Severity: Minor
      Found in js/mvc.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    if (results[i] == "how is the weather" || results[i] == "how's the weather" || results[i] == "what's the weather" || results[i] == "what is the weather like today" || results[i] == "what's the weather like" || results[i] == "how's the weather today" || results[i] == "how is the weather today"){
                        $scope.$apply(function() {
                            $scope.changeView("weather");
                        })
                        navigator.tts.speak("The current temperature in " + $scope.jeeves.city + " is " + Math.round($scope.jeeves.weather.temp.current) + " degrees fahrenheit. " + $scope.jeeves.weather.description + ".", function() {
        Severity: Major
        Found in js/mvc.js - About 1 hr to fix

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

                function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) {
          Severity: Major
          Found in js/angular-route.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                            if (angular.isFunction(templateUrl)) {
                              templateUrl = templateUrl(next.params);
                            }
            Severity: Major
            Found in js/angular-route.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if (angular.isDefined(templateUrl)) {
                                next.loadedTemplateUrl = templateUrl;
                                template = $http.get(templateUrl, {cache: $templateCache}).
                                    then(function(response) { return response.data; });
                              }
              Severity: Major
              Found in js/angular-route.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                        } else if ($scope.regXloop(results, 'settings')) {
                            if ($scope.jeeves.view != 'settings') {
                                navigator.tts.speak("On it.", function() {
                                    $scope.$apply(function() {
                                        $scope.changeView('settings');
                Severity: Major
                Found in js/mvc.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if ($scope.jeeves.view != 'menu') {
                                  navigator.tts.speak("On it.", function() {
                                      $scope.$apply(function() {
                                          $scope.changeView('menu');
                                      });
                  Severity: Major
                  Found in js/mvc.js - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ($scope.regXloopForNews(results, 'news')||$scope.regXloopForNews(results, 'world')||$scope.regXloopForNews(results, 'sports')||$scope.regXloopForNews(results, 'business')||$scope.regXloopForNews(results, 'tech')||$scope.regXloopForNews(results, 'science')){
                                    $scope.changeNewsHelper(results);
                                    return true;
                                }
                    Severity: Major
                    Found in js/mvc.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                      if ($scope.regXloopForNews(results1[i], 'news')||$scope.regXloopForNews(results1[i], 'world')||$scope.regXloopForNews(results1[i], 'sports')||$scope.regXloopForNews(results1[i], 'business')||$scope.regXloopForNews(results1[i], 'tech')||$scope.regXloopForNews(results1[i], 'science')){
                                          if($scope.changeNewsSection(results1[i])){
                                              $scope.sayWebTitle($scope.jeeves.newsPosition.section);
                                              return true;
                                          }
                      Severity: Major
                      Found in js/mvc.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                              if (next && last && next.$$route === last.$$route
                                  && angular.equals(next.pathParams, last.pathParams)
                                  && !next.reloadOnSearch && !forceReload) {
                                last.params = next.params;
                                angular.copy(last.params, $routeParams);
                        Severity: Major
                        Found in js/angular-route.js - About 40 mins to fix

                          Function link has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              link: function(scope, $element, attr, ctrl, $transclude) {
                          Severity: Minor
                          Found in js/angular-route.js - About 35 mins to fix

                            Function decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            base64.decode = function(s) {
                                // convert to string
                                s = "" + s;
                                var getbyte64 = base64.getbyte64;
                                var pads, i, b10;
                            Severity: Minor
                            Found in js/base64.js - About 35 mins 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

                            Avoid too many return statements within this function.
                            Open

                                            return true;
                            Severity: Major
                            Found in js/mvc.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return true;
                              Severity: Major
                              Found in js/mvc.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return $scope.changeNewsSection(results[i]);
                                Severity: Major
                                Found in js/mvc.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return false;
                                  Severity: Major
                                  Found in js/mvc.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return true;
                                    Severity: Major
                                    Found in js/mvc.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return true;
                                      Severity: Major
                                      Found in js/mvc.js - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language