The main goal of this linter is to validate the HTML file and inform the customer about errors in the document. The user will get a sorted overview list with clearly marked items and suggestions on what to do.
Linter checks for seven types of errors and returns different messages for each situation along with the number of lines.
It runs this set of tests:
- trailing spaces detection
- indentation by two: every line, except for the first and last, must be indented with an even number of spaces
- indentation of the first, and last not empty line must be zero. If the last line is not empty, it is going to trigger a different error.
- vertical indentation: must be different by zero or two compared to previous/next line (empty lines are ignored)
- open braces (unclosed tags) detection
- the last line must be empty
- missing alt detection.
All possible outcomes are accounted for:
- If there is a lot of offenses in a file
- if there is only one error in the file
- if there are no offenses in a document
- if an argument not given, the wrong document name entered or the file is empty
Results are displayed as a sorted list of lines containing offenses, along with the total count of errors.
- Ruby
- RSpec for Ruby Testing
- Text editor
- GitHub
- Git
- Ruby
- Click on the
Code
green button - By the right end of the read-only input containing the repository link click the clipboard icon to copy the link
- In your local PC, open your terminal in the folder you would like to clone the repository into
- Clone the repository with the command:
git clone (copied link)
; like so:git clone https://github.com/1v4n4/HTML-linter
- After the clone, type in the command
cd HTML-linter
to access the directory on the terminal
To install RSPEC run gem install rspec
in your Terminal.
Linter is using a Ruby gem 'colorize', and it is already in HTML-linter repository.
- After cloning the project and installation, go to test_files folder and run any of the files using the command
lint (filename)
. You can also run a program on any other custom file.
To run the tests, go to the spec folder and run the files file_validator_spec.rb and logic_spec.rb using rspec command (rspec logic_spec.rb
).
A linter is software that helps detect errors in the document. It is a static code analysis tool used to flag programming errors, bugs, stylistic errors, and suspicious constructs. The term originates from a Unix utility that examined C language source code. Wikipedia
👤 Ivana Novakovic-Lekovic
- GitHub: @githubhandle
- Twitter: @twitterhandle
- LinkedIn: LinkedIn
Contributions, issues, and feature requests are welcome! Feel free to contribute
Give a ⭐️ if you like this project!