ruby capstone linters

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.

8
0
Ruby

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