Build custom linter for ruby files
This custom linter deals with the idea of checking ruby script and looking for syntax. It checks some of the unexpected actions may developer do in the code.
The custom Ruby linter checks for the following warnings.
- Check the long of lines.
- Check spaces at the end of every line.
- Check empty lines between methods.
- Ruby
- RSpec for test ruby
These are examples of good and bad codes. The good practices of code and the bad practices are shown below.
# Good code
def method_one(a, b)
if a == b
p '-----------------------------------------------------------'
end
end
# Bad code
def method_one(a, b)
p "-------------------------------------------------------------------" if a == b
end# Good code (no spaces at the end of line(s) )
def method_one
return "Hello world"
end
# Bad code (spaces at the end of line(s) )
def method_one
return "Hello world"
end# Good code
def method_one
return "Hello world"
end
def method_two
return "Hello world"
end
# Bad code
def method_one
return "Hello world"
end
def method_two
return "Hello world"
end$ git clone https://github.com/ammarkandel/Custom-Ruby-Linter.git
$ cd Custom-Ruby-Linter
- And your code in lib/test_code.rb
- Then make sure you are in the project folder
- Run
/Custom-Ruby-Linter$ main
👤 Ammar El refay Kandel
- GitHub: ammarkandel
- Twitter: @AmmarQandel
- LinkedIn: LinkedIn
Contributions, issues, and feature requests are welcome!
Give a ⭐️ if you like this project!
This project is MIT licensed.
- Microverse