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.
# 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
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
# 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
# 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
# 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
- Ruby
- RSpec for Ruby Testing
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
- Clone the repo to your local folder
- cd into the folder
- install gems by bundle install
- Run rspec .
- 6 examples, 0 failures will be output.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Ruby,Text editor,Github profile and Git.
👤 Murodjon000
- GitHub: @Murodjon000
- Twitter: @Murodjon
- LinkedIn: murodjon-tursunpulatov
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Show your support
Give a ⭐️ if you like this project!
- Project inspired by Microverse