About | Built with | Installing | Style Guide | Author
This is a code linter like Rubocop that trawls through your code files and finds problems, such as methods with too many lines, code style violations, or common gotchas.
- Ruby
- RSpec for Ruby Testing
- Ruby installed on local machine. Please go to this link if you need to install it.
Clone this repository on the command promp or console using
git clone https://github.com/Georjane/Ruby-Linters.git
cd Ruby-Linters
Type in the following command to run the linter on a test file
ruby bin/main.rb
Test class methods using RSpec by running the command in the root directory
rspec
But before testing using RSpec you can install the gem file by running the command
$ bundle install
Also make sure you have bundler installed on your system, else run
$ gem install bundler
or you simply install the the following directly using
$ gem install rspec
Naming cops check for naming issue of your code, such as method name, constant name, file name, etc.
This cop makes sure that all variables use the configured style, snake_case for their names.
# bad
myVar = 5
# good
my_var = 5
This cop makes sure that all methods use the configured style, snake_case for their names.
# bad
def MyMethodName
# code
end
# good
def my_method_name
# code
end
This cop checks for class and module names with an underscore in them.
# bad
class My_Class
end
module My_Module
end
# good
class MyClass
end
module MyModule
end
Metrics cops deal with properties of the source code that can be measured, such as class length, method length, etc. Generally speaking, they have a configuration parameter called Max and when running rubocop --auto-gen-config, this parameter will be set to the highest value found for the inspected code. In this linter, Max value has being set to 10.
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored.
Layout cops inspect your code for consistent use of indentation, alignment, and white space.
This cop checks for two or more consecutive blank lines.
# bad - It has two empty lines.
my_method
my_method
# good
my_method
my_method
👤 Witah Georjane
- Github: @Georjane
- Twitter: @WittyJany
- Linkedin: @witah-georjane
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
This project is free to use as learning purposes. For any external content (e.g. logo, images, ...), please contact the proper author and check their license of use.