mcfiredrill/forttree

View on GitHub

Showing 19 of 19 total issues

Function init has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function init (converter) {
        function api (key, value, attributes) {
            var result;

            // Write
Severity: Major
Found in app/assets/javascripts/js-cookie/js.cookie.js - About 3 hrs to fix

    Function draw has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    FortScene.prototype.draw = function($container) {
      // Initialize the 3d crap.
      var w = this.$container.innerWidth();
      var h = $(window).innerHeight() - $('header').innerHeight() - 50;
    
    
    Severity: Major
    Found in app/assets/javascripts/fort-scene.js - About 2 hrs to fix

      Function api has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function api (key, value, attributes) {
                  var result;
      
                  // Write
      
      
      Severity: Major
      Found in app/assets/javascripts/js-cookie/js.cookie.js - About 2 hrs to fix

        Function caret has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          $.fn.caret = function(pos) {
            var target = this[0];
            var isContentEditable = target.contentEditable === 'true';
            //get
            if (arguments.length == 0) {
        Severity: Major
        Found in app/assets/javascripts/caret/jquery.caret.js - About 2 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              respond_to do |format|
                if @captcha.valid? && @post_form.save!
                  flash[:success] = "Leaf created!"
                  format.html { redirect_to board_path(board) }
                else
          Severity: Minor
          Found in app/controllers/posts_controller.rb and 1 other location - About 50 mins to fix
          app/controllers/posts_controller.rb on lines 18..26

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              respond_to do |format|
                if @captcha.valid? && @post_form.save!
                  flash[:success] = "Branch created!"
                  format.html { redirect_to board_path(board) }
                else
          Severity: Minor
          Found in app/controllers/posts_controller.rb and 1 other location - About 50 mins to fix
          app/controllers/posts_controller.rb on lines 38..46

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              params[:delete].each do |id|
                @leaf = Leaf.find(id)
                @branch = Branch.find(@leaf.branch_id)
                if @branch.leafs.count <= 1
                  if @branch.destroy
          Severity: Minor
          Found in app/controllers/branches_controller.rb and 1 other location - About 35 mins to fix
          app/controllers/posts_controller.rb on lines 51..60

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              params[:delete].each do |id|
                @leaf = Leaf.find(id)
                @branch = Branch.find(@leaf.branch_id)
                if @branch.leafs.count <= 1
                  if @branch.destroy
          Severity: Minor
          Found in app/controllers/posts_controller.rb and 1 other location - About 35 mins to fix
          app/controllers/branches_controller.rb on lines 51..60

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              board = Board.find(params[:board_id])
              branch = Branch.find(params[:id])
              @post_form = PostForm.new board, branch, Leaf.new(@captcha.values)
              respond_to do |format|
          Severity: Minor
          Found in app/controllers/posts_controller.rb - About 35 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

          Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @board = Board.new board_params
              respond_to do |format|
                if Admin.authenticate(params[:password])
                  if @board.save!
          Severity: Minor
          Found in app/controllers/boards_controller.rb - About 35 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

          Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @branch = Branch.new(:last_post_at => Time.now)
              @leaf = Leaf.new(leaf_params)
              @branches = Branch.page(params[:page])
          
          
          Severity: Minor
          Found in app/controllers/branches_controller.rb - About 35 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

          Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              board = Board.find(params[:board_id])
              @post_form = PostForm.new board, Branch.new, Leaf.new(@captcha.values)
              respond_to do |format|
                if @captcha.valid? && @post_form.save!
          Severity: Minor
          Found in app/controllers/posts_controller.rb - About 35 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

          Method update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              @board = Board.find(params[:id])
          
              respond_to do |format|
                if Admin.authenticate(params[:password])
          Severity: Minor
          Found in app/controllers/boards_controller.rb - About 35 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

          Method destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def destroy
              @board = Board.find(params[:id])
          
              respond_to do |format|
                if Admin.authenticate(params[:delete_password])
          Severity: Minor
          Found in app/controllers/boards_controller.rb - About 35 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

          Avoid too many return statements within this function.
          Open

              return this;
          Severity: Major
          Found in app/assets/javascripts/caret/jquery.caret.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return target.selectionStart;
            Severity: Major
            Found in app/assets/javascripts/caret/jquery.caret.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return 0;
              Severity: Major
              Found in app/assets/javascripts/caret/jquery.caret.js - About 30 mins to fix

                Method destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def destroy
                    params[:delete].each do |id|
                      @leaf = Leaf.find(id)
                      @branch = Branch.find(@leaf.branch_id)
                      if @branch.leafs.count <= 1
                Severity: Minor
                Found in app/controllers/branches_controller.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

                Method destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def destroy
                    board = Board.find(params[:board_id])
                    params[:delete].each do |id|
                      @leaf = Leaf.find(id)
                      @branch = Branch.find(@leaf.branch_id)
                Severity: Minor
                Found in app/controllers/posts_controller.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

                Severity
                Category
                Status
                Source
                Language