app/helpers/admin_helper.rb
Method sort_tree
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def sort_tree(url, maxlevels)
%Q{
<script type="text/javascript">
$(document).ready(function(){
Method cropable
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def cropable(image_name, x,y,w,h)
%Q{
<script type="text/javascript">
function jcropInit() {
Method cropable
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def cropable(image_name, x,y,w,h)
Method sortable_columns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def sortable_columns(column, title = nil)
title ||= column.titleize
css_class = column == sort_column ? "current #{sort_direction}" : nil
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
link_to title, {:sort => column, :direction => direction}, {:class => css_class}
- 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"