Skip to content

Count lines in private methods #48

@lasseebert

Description

@lasseebert

I'm not sure if this is a bug or by design.

Lets say I have this class in foo.rb:

class Foo
  def foo
    1
    2
    3
    4
    5
    6
  end

  def bar
    1
    2
    3
    4
    5
    6
  end
end

sandi_meter -d will produce the expected result:

$ sandi_meter -d
1. 100% of classes are under 100 lines.
2. 0% of methods are under 5 lines.
3. No method calls to analyze.
4. No controllers to analyze.

Methods with 5+ lines
  Class name  | Method name  | Size  | Path     
  Foo         | foo          | 6     | ./foo.rb 
  Foo         | bar          | 6     | ./foo.rb 

If I make the bar method private like this:

class Foo
  def foo
    1
    2
    3
    4
    5
    6
  end

  private

  def bar
    1
    2
    3
    4
    5
    6
  end
end

The bar method is not counted:

$ sandi_meter -d
1. 100% of classes are under 100 lines.
2. 0% of methods are under 5 lines.
3. No method calls to analyze.
4. No controllers to analyze.

Methods with 5+ lines
  Class name  | Method name  | Size  | Path     
  Foo         | foo          | 6     | ./foo.rb 

Shouldn't the bar method be counted even though it's private?

This example was mase with ruby 2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions