Skip to content

Ruby Capstone Project required at the end of Ruby module in Microverse Curriculum. Specifically is a CSS Linter with the purpose to check for spacing, indentation and format errors.

License

Notifications You must be signed in to change notification settings

rammazzoti2000/Ruby-capstone-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues


Logo

CSS Linter

Ruby Capstone Project --> Build your own linter

Table of Contents

About The Project

This is the Ruby Capstone Project required at the end of Ruby module in Microverse Curriculum. Specifically is a CSS Linter with the purpose to check for spacing, indentation and format errors.

Rules

Indentation

  • 2 space indentation rule

bad code:

  img {
  width: 700px;
  max-width: 100%;
}

good code:

  img {
    width: 700px;
    max-width: 100%;
  }

Line Format

  • One line checking
  • Line missing between css blocks

bad code:

p {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 14px;
}
a {
  color: #111111;
  font-size: 16px;
}

good code:

p {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 14px;
}

a {
  color: #111111;
  font-size: 16px;
}

Spacing

  • Checking for missing spacing after : or ,
  • Checking for missing spacing after { or }
  • Checking for line break after { or } and after each property declaration

bad code:

a,p{color: #111111; font-size: 16px;}
div{color: #222222; font-size: 18px;}

good code:

a {
  color: #111111;
  font-size: 16px;
}

div {
  color: #222222;
  font-size: 18px;
}

Usage

The CSS Linter does basic syntax checking, as well as applying a set of rules to the code and throws back an error if bad syntax is found. The throwback error is being printed out indicating the line and column of the specific syntax issue.

Examples

  • Wrong Indentation, expected n spaces
  • Spacing, expected single space before '{' and '('
  • Spacing, expected single space after ')' and ':' and ','
  • Line Format, Expected line break after '{' and '}' and ';'
  • Line Format, Expected one empty line after '}'

To test out CSS Linter you need to:

  • have Ruby installed on your computer
  • download or clone this repo:
    • Clone with SSH:
    git@github.com:rammazzoti2000/Ruby-capstone-project.git
    
    • Clone with HTTPS:
    https://github.com/rammazzoti2000/Ruby-capstone-project.git
    
  • Navigate to root directory of the repo and run:
$ bin/main path_to_file.css (path_to_file being the file you want to check for linters)

Screenshot

Automated Test

  • Run the command and see the output
$ bundle exec rspec

Screenshot

Built With

This project was built using these technologies.

  • Ruby
  • Rspec
  • Rubocop
  • Atom :atom:

Video Presentation

Check out full presentation here

Potential future features

  • Extend the linter to more complex syntax
  • Improve the terminal interaction
  • Make it an installable gem

Contributors

👤 Alexandru Bangau

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

Acknowledgements

📝 License

This project is MIT licensed.

About

Ruby Capstone Project required at the end of Ruby module in Microverse Curriculum. Specifically is a CSS Linter with the purpose to check for spacing, indentation and format errors.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published