Skip to content

Final project for the Ruby module of the Microverse full Stack developer Program

License

Notifications You must be signed in to change notification settings

Flakster/JARL-Just-Another-Ruby-Linter-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JARL (Just Another Ruby Linter)

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

Video Presentation

You can see a video with the presentation of this project by clicking here

JARL

Examples

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

Getting started

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]

Usage

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.

Prerequisites

You must have Ruby installed on your computer

Built with

  • Ruby
  • RSpec
  • VSCode

Running the tests

For running the automated tests type rspec spec/linter_spec.rb in the root directory of the project

Author

👤 Carlos Santamaría

🤝 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 licensed under the GNU General Public License v3.0

About

Final project for the Ruby module of the Microverse full Stack developer Program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages