Showing 33 of 2,687 total issues
Function newGuideCtrl
has 313 lines of code (exceeds 25 allowed). Consider refactoring. Open
function newGuideCtrl(
$scope,
$http,
$q,
guideService,
Function newGuideCtrl
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
function newGuideCtrl(
$scope,
$http,
$q,
guideService,
- 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
Function showGuideCtrl
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showGuideCtrl(
$scope,
$http,
guideService,
$q,
Function showGuideCtrl
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function showGuideCtrl(
$scope,
$http,
guideService,
$q,
- 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
File new.js
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
openFarmApp.config([
'$locationProvider',
function($locationProvider) {
$locationProvider.html5Mode(false).hashPrefix('!');
},
Function cropCtrl
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cropCtrl($scope, $http, cropService) {
$scope.s3upload = '';
$scope.crop = {};
var cropId = getIDFromURL('crops');
Function gardenCtrl
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
function gardenCtrl($scope, $http, $rootScope, userService, gardenService, cropService) {
$scope.addingGarden = false;
$scope.addingCrop = false;
$scope.newGarden = {};
Function gardenCtrl
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function gardenCtrl($scope, $http, $rootScope, userService, gardenService, cropService) {
$scope.addingGarden = false;
$scope.addingCrop = false;
$scope.newGarden = {};
- 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
Function setCurrentUser
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.setCurrentUser = function(success, object) {
if (success) {
$scope.currentUser = object;
$scope.currentUser.gardens.forEach(function(g) {
Function cropCtrl
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function cropCtrl($scope, $http, cropService) {
$scope.s3upload = '';
$scope.crop = {};
var cropId = getIDFromURL('crops');
- 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
Function createStageData
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createStageData(stage, guide) {
var data = {};
var stageActions = [];
if (stage.selected) {
if (stage.stage_action_options) {
Function profileCtrl
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function profileCtrl($scope, $rootScope, $http, userService) {
$scope.profileId = PROFILE_ID || undefined;
$scope.userId = USER_ID || undefined;
$scope.query = '';
- 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
Function submitForm
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function submitForm() {
$scope.crop.sending = true;
var commonNames = $scope.crop.common_names;
if (typeof $scope.crop.common_names === 'string') {
Function activate
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activate() {
// First FIRST we need to get all of the defaults
$q.all([
defaultService.processedDetailOptions(),
cropService.getCropWithPromise(getUrlVar('crop_id')),
Function buildParametersFromScope
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
var buildParametersFromScope = function() {
// Gather things in the scope and put them in parameters.
angular.forEach($scope.newGuide.time_span, function(val, key) {
$scope.newGuide.time_span[key] = val || undefined;
Function profileCtrl
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function profileCtrl($scope, $rootScope, $http, userService) {
$scope.profileId = PROFILE_ID || undefined;
$scope.userId = USER_ID || undefined;
$scope.query = '';
Method show
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
token = params.require(:confirmation_token).encode!(
"UTF-8",
"binary",
invalid: :replace,
Function finishCtrl
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function finishCtrl($scope, $http, userService) {
$scope.userId = USER_ID || undefined;
$scope.setUser = function(success, object) {
if (success) {
Method basic_needs
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def basic_needs(current_user)
return nil unless current_user
return nil if current_user.gardens.blank?
first_garden = current_user.gardens.first
Function favoriteGuide
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function favoriteGuide(guideId) {
if (!$scope.currentUser) {
alertsService.pushToAlerts(['You need to log in to mark your favorite'], 401);
} else {
$scope.updatingFavoritedGuides = true;