Skip to content

This custom code linter is the Capstone Project for the Ruby Course. The main goal is to put into practice the main concepts of Object-Oriented Programming. Particularly, classes and access to their attributes.

License

Notifications You must be signed in to change notification settings

SafaErden/Lintit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lintit - A Custom Linter developed in Ruby to check Ruby files

About

This custom code linter is the Capstone Project for the Ruby Course. The main goal is to put into practice the main concepts of Object Oriented Programming. Particularly, classes and access to their attributes.

https://www.loom.com/share/3376f5d490b34dabb99676334cdd0c7f

How to Install

Downloading

1- Download this repository,

2- Unpack it,

3- Copy its address,

4- Open your terminal commandline,

5- Write "cd" and paste the address of the folder that you unpacked the repo

6- ⚠️ TO EXECUTE THE FILE WITHOUT ANY ERROR INSTALL COLORIZE GEM: ⚠️


  gem install colorize

Cloning

1- Copy repo address,


  https://github.com/SafaErden/Lintit.git

2- Open your terminal commandline,

3- Run git clone,


  git clone https://github.com/SafaErden/Lintit.git

4- ⚠️ TO EXECUTE THE FILE WITHOUT ANY ERROR INSTALL COLORIZE GEM: ⚠️


  gem install colorize

How to Use

After setting up the repo and installing the colorize gem, run the following command to execute the linter in the repo directory on your commanline,


  ./bin/main.rb <filename_tocheck.rb>

In this case a sample file is created for the reviewers to check the code,


  ./bin/main.rb sample.rb

Running the desired file without any additional argument will return the broken lines with line number and explanation,

screenshot

At the end of each return, the user will be informed about the number of detected cases,

screenshot

To fix the detected errors, add fix keyword after the filename


  ./bin/main.rb sample.rb fix

Using fix command will fix the detected cases and inform the user about progress with [CORRECTED] info,

screenshot

In this case, user also will be informed about the total fixed cases,

screenshot

Abilities

  1. Check and fix the indentation misusage : Use two spaces per indentation level (aka soft tabs).

 # bad - four spaces
def some_method
    do_something
end

# good
def some_method
  do_something
end

  1. Check and fix the line between methods : Use empty lines between method definitions and also to break up methods into logical paragraphs internally.

  2. Check the line length : Limit lines to 50 characters.

  3. Check the number of classes/modules per page : Aim to have just a single class/module per source file.

  4. Check and fix the semi colon misusage : Don’t use ; to terminate statements and expressions.


# bad
puts 'foobar'; # superfluous semicolon

# good
puts 'foobar'

  1. Chceck and fix the spaces after bang : 'No space after !.

# bad
! something

# good
!something

  1. Chceck and fix the spaces aruond braces : No spaces after (, [ or before ], ). Use spaces around { and before }.

# bad
some( arg ).other
[ 1, 2, 3 ].each{|e| puts e}

# good
some(arg).other
[1, 2, 3].each { |e| puts e }

  1. Chceck and fix the white spaces : Avoid trailing whitespace.

🔧 Built with

  • Ruby - Ruby
  • Rspec - A test driven framework

✒️ Autor

👤 Safa ERDEN

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

👍 Show your support

Give a ⭐️ if you like this project!

📝 License

This project is free to use as learning purposes. For any external content (e.g. logo, images, ...), please contact.

About

This custom code linter is the Capstone Project for the Ruby Course. The main goal is to put into practice the main concepts of Object-Oriented Programming. Particularly, classes and access to their attributes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages