Skip to content

uimarshall/ruby-capstone-linters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-capstone-linters


📝 Content

About   |    Built with   |    Installing   |    Testing   |    Style Guide   |    Author

✒️ About

This is a ruby linter that helps you check for JavaScript linting errors and enforce good styling guide conventions in your code.

screenshot

Watch the presentation video.

screenshot

🔧 Built with

  • Ruby
  • RSpec for Ruby Testing
  • Colorize gem

🛠 Installing

Pre-requisites

  • Ruby installed on local machine. Check this for Installation Guide
  • Rubocop Linter installed on Machine

    Install Using this command:

    gem install rubocop
    
    
  • Rspec for testing installed on Machine

    Install Using this command:

    gem install rspec
    
    
  • Colorize Gem installed on Machine

    Install Using this command:

    gem install colorize
    
    

Usage

Clone this repository

git clone https://github.com/uimarshall/ruby-capstone-linters.git
cd ruby-capstone-linters

Type in the following command to run the linter on a JavaScript file in the folder

ruby bin/main.rb

Testing Instructions

  • Clone the repository
  • Change directory to the cloned directory cd ruby-capstone-linters
  • Run bundle install to install the dependencies specified in the Gemfile
  • Run rspec to test

Style Guide

This Linter Enforces rules for the following

1. Triple Equality

Checks for triple equality

  ```
  # Bad Code
  let fst = "first"
  let scd = "first"
  fst == scd



  # Good Code
  let fst = "first";
  let scd = "first";
  fst === scd;
  ```

2.Camel Case

  Check for case sensitivity in naming variables.

    ```
    # Bad Code
    let FavColor = "green";
    let Hobby = "football";


    # Good Code
    let favColor = "green";
    let hobby = "football";
    ```

3. No Double Line

   Checks for unexpected double line

    ```
    # Bad Code
    interest = FavColor + Hobby+ best_music;

    function detectoffencies() {
        let arr  = [7, 9, 5, 4, +8];
        var res = showError(arr);
    }



    # Good Code
    interest = FavColor + Hobby+ best_music;
    function detectoffencies() {
        let arr  = [7, 9, 5, 4, +8];
        var res = showError(arr);
    }
    ```

4. Underscore in naming

    Checks that there is no underscore in naming

    ```
    # Bad Code
    food_things = "rice";



    # Good Code
    foodThings = "rice";
    ```

5. Space End Of Line

    Checks that there are no spaces at end of line

    ```
    # Bad Code
   if (condition) {
     "go"




    # Good Code
    if (condition) {
      return "go"
    }
    ```

6. Missing closing braces

   Checks for missing closing braces

    ```
     # Bad Code
   if (condition) {
     "go"



    # Good Code
    if (condition) {
      return "go"
    }
    ```

✒️ Author

👤 Marshall Akpan

Contributing

  • To contribute to this project:
  • Fork this repository & clone locally.
  • Create an upstream remote and sync your local copy.
  • create a new branch.
  • Push your code to your origin repository.
  • Create a new Pull Request .
  • Feel free to check the issues page.

👍 Show your support

Give a ⭐️ if you like this project!

👏 Acknowledgements

  • Microverse

About

This is a ruby linter project that helps you check for JavaScript linting errors and enforce good styling guide conventions in your code. Built with Ruby.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors