I-de-ya/ideyabox

View on GitHub
app/helpers/admin_helper.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method sort_tree has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def sort_tree(url, maxlevels)
    %Q{
      <script type="text/javascript">
        $(document).ready(function(){

Severity: Minor
Found in app/helpers/admin_helper.rb - About 1 hr to fix

    Method cropable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def cropable(image_name, x,y,w,h)
        %Q{
          <script type="text/javascript">
            function jcropInit() {
    
    
    Severity: Minor
    Found in app/helpers/admin_helper.rb - About 1 hr to fix

      Method cropable has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def cropable(image_name, x,y,w,h)
      Severity: Minor
      Found in app/helpers/admin_helper.rb - About 35 mins to fix

        Method sortable_columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        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}
        Severity: Minor
        Found in app/helpers/admin_helper.rb - About 25 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

        There are no issues that match your filters.

        Category
        Status