Skip to content

Murodjon000/ruby-linter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Capstone Project - Ruby Linter🚀

The Build

The custom Ruby linter currently checks/detects for the following errors/warnings.

  • check for trailing spaces
  • check for wrong indentation
  • check for missing/unexpected tags i.e. '( )', '[ ]', and '{ }'
  • check missing/unexpected end
  • check empty line error

Below are demonstrations of good and bad code for the above cases. I will use the pipe '|' symbol to indicate cursor position where necessary.

Indentation Error Check

# Good Code

class Board
  def initialize(player, board)
    @player = player
    @board = board
  end
end

# Bad Code

class Board
  def initialize(player, board)
    @player = player
      @board = board
  end
end

Trailing spaces

note where the cursor(|) is on the bad code

# Good Code

class Board
  def initialize(player, board)
    @player = player
    @board = board
  end
end

# Bad Code

class Board
  def initialize(player, board)  |
    @player = player
    @board = board
  end
end

Missing/Unexpected Tag

# Good Code

class Board
  def initialize(player, board)
    @player = player
    @board = board
  end
end

# Bad Code

class Board
  def initialize(player, board
    @player = player
    @board = [[board]
  end
end

Missing/unexpected end

# Good Code

class Board
  def initialize(player, board)
    @player = player
    @board = board
  end
end

# Bad Code

class Board
  def initialize(player, board)
    @player = player
    @board = board
  end
  end
end

Empty line error

# Good Code

class Board
  def initialize(player, board)
    @player = player
    @board = board
  end
end

# Bad Code

class Board
  def initialize(player, board)

    @player = player
    @board = board
  end
end

Built With

  • Ruby
  • RSpec for Ruby Testing

Getting Started

To get a local copy of the repository please run the following commands on your terminal:

$ cd <folder>
$ git clone https://github.com/Murodjon000/ruby-linter.git

To check for errors on a file:

$ bin/main app.rb

How to Test

  1. Clone the repo to your local folder
  2. cd into the folder
  3. install gems by bundle install
  4. Run rspec .
  5. 6 examples, 0 failures will be output.

Contributing

​ Contributions, issues, and feature requests are welcome! Feel free to check the issues page. ​

Prerequisites

Ruby,Text editor,Github profile and Git.

Author

👤 Murodjon000

🤝 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!

Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages