Showing 51 of 108 total issues
Function newsSpeech
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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(){
Function base64_decode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function sayWebTitle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Consider simplifying this complex logical expression. Open
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() {
Function $get
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) {
Avoid deeply nested control flow statements. Open
Open
if (angular.isFunction(templateUrl)) {
templateUrl = templateUrl(next.params);
}
Avoid deeply nested control flow statements. Open
Open
if (angular.isDefined(templateUrl)) {
next.loadedTemplateUrl = templateUrl;
template = $http.get(templateUrl, {cache: $templateCache}).
then(function(response) { return response.data; });
}
Avoid deeply nested control flow statements. Open
Open
} else if ($scope.regXloop(results, 'settings')) {
if ($scope.jeeves.view != 'settings') {
navigator.tts.speak("On it.", function() {
$scope.$apply(function() {
$scope.changeView('settings');
Avoid deeply nested control flow statements. Open
Open
if ($scope.jeeves.view != 'menu') {
navigator.tts.speak("On it.", function() {
$scope.$apply(function() {
$scope.changeView('menu');
});
Consider simplifying this complex logical expression. Open
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;
}
Consider simplifying this complex logical expression. Open
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;
}
Consider simplifying this complex logical expression. Open
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);
Function link
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
link: function(scope, $element, attr, ctrl, $transclude) {
Function decode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
base64.decode = function(s) {
// convert to string
s = "" + s;
var getbyte64 = base64.getbyte64;
var pads, i, b10;
- Read upRead up
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
Open
return true;
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return $scope.changeNewsSection(results[i]);
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return true;