mohamedSabry0 / ruLint

Basic Ruby conventional rules linter. Using Ruby. From scratch using regex with OOP structure and unit testing.

Home Page:https://repl.it/@mohammadSabri/ruLint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ruLint

simple ruby linter with basic functionalities that will look only for naming conventions for variables, classes and modules

Introduction Video

Loom Link

Status Github Issues GitHub2 Pull Requests License

Getting Started

The Followed Style Guide

  • Guide
  • Please refer to this guide for any concerns about the followed rules for this linter

Live Demo

  • Demo
  • to run online type bin/ruLint in the interactive shell
  • to run tests online type rspec in the interactive shell

To get a local copy up and running follow these simple example steps.

Prerequisites

  • Text Editor (VSCode is suggested.)
  • Ruby

Setup

  • Install git
  • Open Terminal
  • Change directory to folder to download repository
  • Use cd <file-path>
  • Run git clone https://github.com/mohamedSabry0/ruLint.git
  • Install Ruby
  • cd ruLint

Testing

  • Install gem install rspec
  • Initialize rspec --init
  • create a new file on the project's root directory touch example.rb
  • copy all the code provided in Example Input File section and make sure to include all the lines
  • paste that code in the example.rb and save
  • Run rspec

Note: without the mentioned file all the tests will fail

Use Instruction

using the example

  • copy the code example provided below in Example Input File section and add it to a new ruby file in a directory
  • in terminal cd to that dir then apply the following steps:
  • run bin/ruLint command or
  • give it file paths as arguments to run on specific ones e.g: bin/ruLint file1 dir/file2.rb

a bit shorter running command

  • if you have the following directory in your PATH /usr/local/bin/

  • you can run this in your terminal from the project directory ln -s $PWD/bin/ruLint /usr/local/bin/

  • then simply use command ruLint instead of bin/ruLint

Example Input File

# rubocop:disable all
class bad_example
end

class bad; end

class Bad_Example
end

class GoodExample
    var = 1
    sec += 1
end

class Mu_Foo; end

class BADNAME
end

class badname; end
class GoodName; end

module bad_example
end

module bad; end

module Bad_Example
end

module GoodExample
    var = 1
    sec += 1
end

module Mu_Foo; end

module BADNAME
end

module badname; end
module GoodName; end

Example Output

naming_warning @(example.rb, line#2):
'bad_example' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#5):
'bad' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#7):
'Bad_Example' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#15):
'Mu_Foo' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#20):
'badname' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#23):
'bad_example' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#26):
'bad' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#28):
'Bad_Example' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#36):
'Mu_Foo' is not a good class/module name. Follow CamelCase naming convention

naming_warning @(example.rb, line#41):
'badname' is not a good class/module name. Follow CamelCase naming convention


Built With

  • Ruby

Author

👤 Mohamed Sabry

🤝 Contributing

Contributions, issues and feature requests are welcome! Start by:

  • Forking the project
  • Cloning the project to your local machine
  • cd into the project directory
  • Run git checkout -b your-branch-name
  • Make your contributions
  • Push your branch up to your forked repository
  • Open a Pull Request with a detailed description to the development branch of the original project for a review

Show your support

Give a ⭐️ if you like this project!

About

Basic Ruby conventional rules linter. Using Ruby. From scratch using regex with OOP structure and unit testing.

https://repl.it/@mohammadSabri/ruLint


Languages

Language:Ruby 100.0%