Showing 33 of 2,687 total issues
Function saveGuideChanges
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.saveGuideChanges = function() {
var params = {
data: {
attributes: {
overview: $scope.guide.overview,
Function showCropCtrl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showCropCtrl($scope, $http, cropService, gardenService, userService, $interval) {
$scope.alerts = [];
$scope.s3upload = '';
$scope.crop = {};
$scope.userId = USER_ID || undefined;
Method validate_favorite_guides
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_favorite_guides
current_guide_id = ''
unless attributes[:favorited_guide_ids].nil?
@favorited_guides = []
attributes[:favorited_guide_ids].uniq.each do |guide_id|
- 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
Method find_overlap_in
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_overlap_in(basic_needs)
stages.each do |stage|
basic_needs.each do |need|
# This is bad structure
if need[:name] == "Sun / Shade"
- 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
Method validate_images
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_images (images, obj=nil)
images && images.each do |pic|
pic_id = "#{pic[:id]}" if pic[:id].present?
pictures = obj.pictures if obj
- 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
Method show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show
token = params.require(:confirmation_token).encode!(
"UTF-8",
"binary",
invalid: :replace,
- 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
Method validate_crop
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_crop
if crop_id
@crop = Crop.find(crop_id)
else
@crop = check_if_crop_exists
- 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
Method compatibility_score
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compatibility_score(current_user)
return current_user_compatibility_score if current_user_compatibility_score
return nil unless current_user
return nil if current_user.gardens.blank?
- 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
Method show?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show?
if @current_user
if @current_user == @viewed_user || @current_user.admin
true
elsif @viewed_user.is_private?
- 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 finishCtrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function finishCtrl($scope, $http, userService) {
$scope.userId = USER_ID || undefined;
$scope.setUser = function(success, object) {
if (success) {
- 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 searchCtrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function searchCtrl($scope, $http) {
$scope.crops = [];
// Redirect the browser to a specified crop
//
- 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
Method compatibility_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compatibility_label(current_user)
if current_user_compatibility_score
score = current_user_compatibility_score
else
score = compatibility_score(current_user)
- 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
Method validate_picture
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_picture
storage_type = Paperclip::Attachment.default_options[:storage]
test_or_filesystem = storage_type.to_s != 'filesystem' ||
Rails.env.to_s == 'test'
if id
- 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"