Friday 16 November 2012

RLint 1.0

Hi folks, Today, I'll show to you the progress from my little tool called RLint. E.G, I have a test code and I need check if it's following my coding standards. Setting up this configuration (Today hardcoded, but in release version the configuration will be through config file): Tabulation - Tabs, size 4 Class Name - Camel case Column Delimiter - 80 If Bracket - No Source code - teste.rb
class AV
end

class AudioVideo
  def method_column_delimiter_80
    "String really loooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnggggggggggggggggggggggggggg"
  end

  def method_no_bracket
    if(abc)

    end

    if abc

    end
  end
end

When running rlint.rb, I get this output (Alright, the error messages are really useless or confused, however, I know it needs improvement):
rodrigo@:~/RubyProjects/rlint$ ruby rlint.rb teste.rb
Tabulation report:
Correct: 5
Error: 13

You need review this lines:
Detected a indentation mistake.
> teste.rb - 6:   def method_foo
Detected a whitespace indentation.
> teste.rb - 6:   def method_foo
Detected a whitespace indentation.
> teste.rb - 7:     "String really loooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnggggggggggggggggggggggggggg"
Detected a indentation mistake.
> teste.rb - 8:   end
Detected a whitespace indentation.
> teste.rb - 8:   end
Detected a indentation mistake.
> teste.rb - 10:   def method_xxx
Detected a whitespace indentation.
> teste.rb - 10:   def method_xxx
Detected a whitespace indentation.
> teste.rb - 11:     if(abc)
Detected a whitespace indentation.
> teste.rb - 13:     end
Detected a whitespace indentation.
> teste.rb - 15:     if abc
Detected a whitespace indentation.
> teste.rb - 17:     end
Detected a indentation mistake.
> teste.rb - 18:   end
Detected a whitespace indentation.
> teste.rb - 18:   end


Class/Module name report:
Correct: 1
Error: 1

You need review this lines:
Detected a class name mistake. Possible Snake Case
> teste.rb - 2: class AV


If parenthesis report:
Correct: 1
Error: 1

You need review this lines:
Detected a configuration mismatch for bracket usage.
> teste.rb - 11:     if(abc)


Column Delimiter report:
Correct: 19
Error: 1

You need review this lines:
Detected a word across the delimiter.
> teste.rb - 7:     "String really loooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnggggggggggggggggggggggggggg"
I'm think so it's really delighted, if you have a program that help check your coding standards.

Thursday 1 November 2012

RLint is coming

Hi folks,

Finally, I get back to develop RLint, because I'm really excited with RHash amount of download (3777). Besides, I felt a emptiness about a tool could help detect code pattern mistakes. I've seen in Python a software amazing, the Pylint. Furthermore I think I can use this tool in own projects and share with Ruby community.

First features:
- Tabulator check (Space vs Tabs)
- Class/Module name (CamelBack vs Snake)
- If/Unless parenthesis check - Column delimiter
- Class/Module/Method size (Total of line)
- Method parenthesis check That's it.

If someone have a good idea for feature, tell me.
Let's start the ball rolling.