Skip to content

ammarkandel/Custom-Ruby-Linter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom-Ruby-Linter

Build custom linter for ruby files

About

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 Build

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.

Built with

  • 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.

Long of lines

# 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

Space at the end of lines

# 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

Empty line between methods

# 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

Usage

$ 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
    

Authors

👤 Ammar El refay Kandel

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Show your support

Give a ⭐️ if you like this project!

📝 License

This project is MIT licensed.

Acknowledgments

  • Microverse

About

Build custom linter for ruby files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages