{"id":29554482,"url":"https://github.com/amita-roy/ruby_capstone_css_linter","last_synced_at":"2026-04-13T08:32:04.216Z","repository":{"id":124304857,"uuid":"291937793","full_name":"amita-roy/Ruby_Capstone_CSS_Linter","owner":"amita-roy","description":"This is a Ruby capstone project provided by Microverse for learning purposes. For this project I have created a CSS-Linter with 4 rules ie no-duplicate-selectors, valid-units, lenght-zero-no-unit and selector-typecase.","archived":false,"fork":false,"pushed_at":"2020-09-03T10:49:18.000Z","size":752,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T09:14:29.818Z","etag":null,"topics":["crass","css-linter","rspec","ruby","simplecov","test-coverage"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amita-roy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-01T08:13:41.000Z","updated_at":"2020-12-17T14:06:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"40845d11-dc34-455e-b53a-fc1575456d53","html_url":"https://github.com/amita-roy/Ruby_Capstone_CSS_Linter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amita-roy/Ruby_Capstone_CSS_Linter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amita-roy%2FRuby_Capstone_CSS_Linter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amita-roy%2FRuby_Capstone_CSS_Linter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amita-roy%2FRuby_Capstone_CSS_Linter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amita-roy%2FRuby_Capstone_CSS_Linter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amita-roy","download_url":"https://codeload.github.com/amita-roy/Ruby_Capstone_CSS_Linter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amita-roy%2FRuby_Capstone_CSS_Linter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crass","css-linter","rspec","ruby","simplecov","test-coverage"],"created_at":"2025-07-18T07:09:54.938Z","updated_at":"2026-04-13T08:32:04.210Z","avatar_url":"https://github.com/amita-roy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby Capstone CSS_Linter\n\n\u003e In this project, I have created a css linter with 4 rules.\n\n- You can see the video presentation of the project here: [CSS_Linter](https://www.loom.com/share/a8404b82fdc144bd939c5b1277f4f10c)\n\n## no-duplicate-selectors (Rule 1)\n\n\u003e Disallow duplicate selectors within a stylesheet.\n\n`.foo {} .bar {} .foo {}`\n\n### This rule checks for two types of duplication:\n\n_Duplication of a single selector with a rule's selector list, e.g. a, b, a {}._\n_Duplication of a selector list within a stylesheet, e.g. a, b {} a, b {}. Duplicates are found even if the selectors come in different orders or have different spacing, e.g. a d, b \u003e c {} b\u003ec, a d {}._\n\n![image](.github/duplicate_selectors.png)\n\n## length-zero-no-unit (Rule 2)\n\n\u003e Disallow units for zero lengths.\n\n`a { top: 0px; }`\n\n_Lengths refer to distance measurements. A length is a dimension, which is a number immediately followed by a unit identifier. However, for zero lengths the unit identifier is optional._\n\n![image](.github/length_zero_no_unit.png)\n\n## selector-type-case (Rule 3)\n\n\u003e This rule works if selector typecase is in uppercase\n\n`A {}`\n\n_It will throw an error if any selector in the stylesheet is in uppercase._\n\n![image](.github/selector_typecase.png)\n\n## valid_units (Rule 4)\n\n\u003e Throws an error if invalid units used in the stylesheet\n\n`a { top: 23pixel; }`\n\n_It will provide suggestion for correct way of use for units eg. instead of `23pixel` use `23px`._\n\n![image](.github/valid_units.png)\n\n### Accessing The Linter\n\n- To download the contents of this repository and run the linter locally, follow the steps in the ['Local Installation' section](#local-installation).\n\n## Built With\n\n- Ruby\n- VSCode\n- Rubocop\n- simplecov (gem for test coverage report)\n- crass (gem)\n\n## Local Installation\n\n### Prerequisites\n\nIf you intend to download the project, you will need to have Ruby already installed on your machine. For more information on how to install Ruby, follow [this link](https://www.ruby-lang.org/en/downloads/).\n\n### Installation Instructions\n\nTo get your own copy of our project simply clone the repository to your local machine.\n\n**Step 1**: Using the Command Line, navigate into the location where you would like to have the repository. Then enter the following line of code:\n\n`git@github.com:Amita-Roy/Ruby_Capstone_CSS_Linter.git`\n\n**Step 2**: Once the repo has been cloned, navigate inside it by entering the following command:\n\n`cd ruby_capstone_css_linter`\n\n\u003e I am using crass gem,which is a CSS parser gem\n\n**Step 3**: before running the linter, please install all the required gem with the following command\n\n`bundle install`\n\n**Step 4**: Once in the root directory of the repository, simply enter the following line of code to run the linter on css file.\n\n`bin/main.rb css/no-duplicate-selector/case2.css`\n`bin/main.rb css/length-zero-no-unit/case1.css`\n\n### For your own css file, linter running instruction eg.\n\n_after the `bin/main.rb` you can mention the path of your css file._\n\n`bin/main.rb css-directory/css-file`\n`bin/main.rb styles/style.css`\n\nit will return the errors from the file if any error found in the stylesheet.\n\n## Repository Contents\n\n\u003e In rules directory\n\n- **length_zero_no_unit**, class for rule length_zero_no_unit is defined.\n- **no_duplicate_selector**, class for rule no_duplicate_selector is defined.\n- **selector_typecase**, class for rule selector_typecase is defined.\n- **valid_units**, class for rule valid_units is defined.\n\n\u003e In utils directory\n\n- **utils.rb**, this file has helper method for all the classes.\n- **verify_rules**, this file has all the methods which are required in main.rb.\n\n\u003e In css directory\n\n- **length-zero-no-unit**, directory with css files with each case type.\n- **no_duplicate_selector**, directory with css files with each case type.\n- **selector_typecase**, directory with css files with each case type.\n- **valid_units**, directory with css files with each case type.\n\nIn addition to the above, the repo also contains .rubocop.yml for linting.\n\n## To Test\n\n**Step 1**:\n\n_After cloning the repository, open the terminal and Install RSpec on your local system by running:_\n\n\u003e `gem install rspec` or if you have run the command `bundle install` all required gems will be downloaded itself.\n\n**Step 2**:\n\n_Run the tests with the command:_\n\n`rspec`\n\n\u003e Tests screenshots\n\n![tests](.github/testing.png)\n\n## Test Coverage\n\n**Step 1**:\n\n`gem install simplecov`\n\n**Step 2**:\n\n_Add the below code on the top of the `spec_helper.rb`_\n\n`require 'simplecov'`\n\n`SimpleCov.start do`\n`add_filter '/spec/'`\n`end`\n\n**Step 3**:\n\n_After running the rspec command in the terminal, a coverage directory will be generated_\n_copy the path of index.html and open it in browser to check the test coverage_\n\n\u003e Test Coverage Screenshot\n\n![screenshot](.github/coverage.png)\n\n## Author\n\n👤 **Amita Roy**\n\n- Github: [@Amita-Roy](https://github.com/Amita-Roy)\n- Twitter: [@AmitaRoy14](https://twitter.com/AmitaRoy14)\n- Linkedin: [Amita Roy](https://www.linkedin.com/in/amita-roy-3b823b68/)\n\n## 🤝 Contributing\n\nOur favourite contributions are those that help us improve the project, whether with a contribution, an issue, or a feature request!\n\nFeel free to check the [issues page](https://github.com/Amita-Roy/Ruby_Capstone_CSS_Linter/issues) to either create an issue or help us out by fixing an existing one.\n\n## Show your support\n\nIf you've read this far....give us a ⭐️!\n\n## 📝 License\n\nThis project is licensed by Microverse and the Odin Project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famita-roy%2Fruby_capstone_css_linter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famita-roy%2Fruby_capstone_css_linter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famita-roy%2Fruby_capstone_css_linter/lists"}