This is the final project for the Ruby module in the Microverse's full-stack remote developer program
JARL is a beginner level linter that checks ruby .rb code files for the following rules:
- Maximum 100 lines per file
- Maximum 80 characters per code line
- Use of two spaces of indentation.
- Exception in the line after a guard clause
- No trailing spaces
- Lack of EOF empty line
You can see a video with the presentation of this project by clicking here
Max. 80 characters per line
# Bad
if extra_large_condition1 && extra_large_condition2 && extra_large_condition3 && extra_large_condition4
# Good
if extra_large_condition1 && extra_large_condition2 &&
extra_large_condition3 && extra_large_condition4
Use of two spaces of indentation
# Bad
name = 'Carlos'
if name.length > 4
puts "Hello #{name}!" # tab or more than 2 spaces
end
# Good
name = 'Carlos'
if name.length > 4
puts "Hello #{name}!"
end
Exception in the line after a guard clause
# Good
return unless File.exists?('file_name')
# empty line indentation can be 0 even if previous line is 4
some other code
No trailing spaces
# Bad
puts 'Hello, world!' # invisible trailing space here
# Good
puts 'Hello, world!' # the line ends with the last single quote
Missing EOF empty line
# Bad
name = 'Carlos'
if name.length > 4
puts "Hello #{name}!"
end # file ends here
# Good
name = 'Carlos'
if name.length > 4
puts "Hello #{name}!"
end
# file ends here
To get a local copy of this repository up and running, follow these steps:
- Click the "Clone or download" button
- Copy the URL of the repository.
- Go to the terminal on your local machine and type: git clone
- Paste the URL you copied before.
- Change your local directory by typing cd Ruby-capstone-project
- Type ruby bin/main.rb and press [Enter]
You can either run the main.rb script without arguments for linting all the .rb ruby code files, (including subdirectories) or pass a single filename as an argument to lint that specific file.
You must have Ruby installed on your computer
- Ruby
- RSpec
- VSCode
For running the automated tests type rspec spec/linter_spec.rb in the root directory of the project
👤 Carlos Santamaría
- Twitter: @Flakster
- Github: @Flakster
- Email: contact@carlossantamaria.co
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a 🌟 if you like this project!
This project is licensed under the GNU General Public License v3.0