ece517-p3/expertiza

View on GitHub
spec/controllers/tree_display_controller_spec.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Block has too many lines. [262/25]
Open

describe TreeDisplayController do
  # Airbrake-1517247902792549741
  describe "#list" do
    it "should not redirect to tree_display#list if current user is an instructor" do
      user = build(:instructor)

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [138/25]
Open

  describe "POST #children_node_ng for TA" do
    before(:each) do
      @treefolder = TreeFolder.new
      @treefolder.parent_id = nil
      @treefolder.name = "Courses"

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

File tree_display_controller_spec.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

describe TreeDisplayController do
  # Airbrake-1517247902792549741
  describe "#list" do
    it "should not redirect to tree_display#list if current user is an instructor" do
      user = build(:instructor)
Severity: Minor
Found in spec/controllers/tree_display_controller_spec.rb - About 2 hrs to fix

    Block has too many lines. [35/25]
    Open

      describe "POST #children_node_ng" do
        before(:each) do
          @treefolder = TreeFolder.new
          @treefolder.parent_id = nil
          @treefolder.name = "Courses"

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [29/25]
    Open

        before(:each) do
          @treefolder = TreeFolder.new
          @treefolder.parent_id = nil
          @treefolder.name = "Courses"
          @treefolder.child_type = "CourseNode"

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
    Open

          expect(response.body).to match /csc517\/test/

    This cop checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.

    Example:

    # bad
    
    # This is interpreted as a method invocation with a regexp literal,
    # but it could possibly be `/` method invocations.
    # (i.e. `do_something./(pattern)./(i)`)
    do_something /pattern/i

    Example:

    # good
    
    # With parentheses, there's no ambiguity.
    do_something(/pattern/i)

    Use %r around regular expression.
    Open

          expect(response.body).to match /csc517\/test/

    This cop enforces using // or %r around regular expressions.

    Example: EnforcedStyle: slashes (default)

    # bad
    snake_case = %r{^[\dA-Z_]+$}
    
    # bad
    regex = %r{
      foo
      (bar)
      (baz)
    }x
    
    # good
    snake_case = /^[\dA-Z_]+$/
    
    # good
    regex = /
      foo
      (bar)
      (baz)
    /x

    Example: EnforcedStyle: percent_r

    # bad
    snake_case = /^[\dA-Z_]+$/
    
    # bad
    regex = /
      foo
      (bar)
      (baz)
    /x
    
    # good
    snake_case = %r{^[\dA-Z_]+$}
    
    # good
    regex = %r{
      foo
      (bar)
      (baz)
    }x

    Example: EnforcedStyle: mixed

    # bad
    snake_case = %r{^[\dA-Z_]+$}
    
    # bad
    regex = /
      foo
      (bar)
      (baz)
    /x
    
    # good
    snake_case = /^[\dA-Z_]+$/
    
    # good
    regex = %r{
      foo
      (bar)
      (baz)
    }x

    Example: AllowInnerSlashes: false (default)

    # If `false`, the cop will always recommend using `%r` if one or more
    # slashes are found in the regexp string.
    
    # bad
    x =~ /home\//
    
    # good
    x =~ %r{home/}

    Example: AllowInnerSlashes: true

    # good
    x =~ /home\//

    Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
    Open

          expect(response.body).to match /csc517\/test/

    This cop checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.

    Example:

    # bad
    
    # This is interpreted as a method invocation with a regexp literal,
    # but it could possibly be `/` method invocations.
    # (i.e. `do_something./(pattern)./(i)`)
    do_something /pattern/i

    Example:

    # good
    
    # With parentheses, there's no ambiguity.
    do_something(/pattern/i)

    Use %r around regular expression.
    Open

          expect(response.body).to match /csc517\/test/

    This cop enforces using // or %r around regular expressions.

    Example: EnforcedStyle: slashes (default)

    # bad
    snake_case = %r{^[\dA-Z_]+$}
    
    # bad
    regex = %r{
      foo
      (bar)
      (baz)
    }x
    
    # good
    snake_case = /^[\dA-Z_]+$/
    
    # good
    regex = /
      foo
      (bar)
      (baz)
    /x

    Example: EnforcedStyle: percent_r

    # bad
    snake_case = /^[\dA-Z_]+$/
    
    # bad
    regex = /
      foo
      (bar)
      (baz)
    /x
    
    # good
    snake_case = %r{^[\dA-Z_]+$}
    
    # good
    regex = %r{
      foo
      (bar)
      (baz)
    }x

    Example: EnforcedStyle: mixed

    # bad
    snake_case = %r{^[\dA-Z_]+$}
    
    # bad
    regex = /
      foo
      (bar)
      (baz)
    /x
    
    # good
    snake_case = /^[\dA-Z_]+$/
    
    # good
    regex = %r{
      foo
      (bar)
      (baz)
    }x

    Example: AllowInnerSlashes: false (default)

    # If `false`, the cop will always recommend using `%r` if one or more
    # slashes are found in the regexp string.
    
    # bad
    x =~ /home\//
    
    # good
    x =~ %r{home/}

    Example: AllowInnerSlashes: true

    # good
    x =~ /home\//

    There are no issues that match your filters.

    Category
    Status