|
1 | | -# rubocop-extension-template |
| 1 | +# RuboCop Rails Accessibility |
2 | 2 |
|
3 | | -Custom [RuboCop](https://github.com/rubocop/rubocop) extension template. |
| 3 | +This repository provides recommended [RuboCop](https://github.com/rubocop/rubocop) configuration and additional **accessibility RuboCop Rails cops** for use on open source and internal Rails projects. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +Install the `rubocop-rails-accessibility` gem |
| 8 | + |
| 9 | +```sh |
| 10 | +gem install rubocop-rails-accessibility |
| 11 | +``` |
| 12 | + |
| 13 | +or if you use bundler put this in your `Gemfile` |
| 14 | + |
| 15 | +```ruby |
| 16 | +gem 'rubocop-rails-accessibility' |
| 17 | +gem "rubocop-performance", require: false |
| 18 | +gem "rubocop-rails", require: false |
| 19 | +``` |
4 | 20 |
|
5 | 21 | ## Usage |
6 | 22 |
|
7 | | -1. [Use this template](https://github.com/r7kamura/rubocop-extension-template/generate) to create a repository |
8 | | -2. Rename gem name from `my_extension` to your own |
9 | | -3. Run `bin/setup` |
10 | | -4. Add your custom cop by running `bundle exec rake new_cop[Foo/Bar]` |
11 | | -5. Edit `lib/rubocop/cop/foo/bar.rb` |
| 23 | +You need to tell RuboCop to load RuboCop Rails Accessibility. |
| 24 | + |
| 25 | +Put this into your `.rubocop.yml`. |
| 26 | + |
| 27 | +``` yaml |
| 28 | +inherit_gem: |
| 29 | + rubocop-rails-accessibility: |
| 30 | + - config/default.yml |
| 31 | + - config/rubocop_rails_accessibility.yml |
| 32 | +``` |
| 33 | +
|
| 34 | +## Testing |
| 35 | +
|
| 36 | +Install all of the required gems |
| 37 | +
|
| 38 | +```sh[] |
| 39 | +bundle install |
| 40 | +```[] |
| 41 | +
|
| 42 | +Run the tests |
| 43 | +
|
| 44 | +```sh |
| 45 | +bundle exec rake |
| 46 | +``` |
| 47 | + |
| 48 | +## The Cops |
| 49 | + |
| 50 | +All cops are located under |
| 51 | +[`lib/rubocop/cop/rubocop_rails_accessibility`](lib/rubocop/cop/rubocop_rails_accessibility), and contain |
| 52 | +examples/documentation. |
| 53 | + |
| 54 | +## Rules |
| 55 | + |
| 56 | +- [RuboCop::Cop::Accessibility::ImageHasAlt](guides/image-has-alt.md) |
| 57 | +- [RuboCop::Cop::Accessibility::LinkHasHref](guides/link-has-href.md) |
| 58 | +- [RuboCop::Cop::Accessibility::NoPositiveTabindex](guides/no-positive-tabindex.md) |
| 59 | +- [RuboCop::Cop::Accessibility::NoRedundantImageAlt](guides/no-redundant-image-alt.md) |
| 60 | + |
| 61 | +## Contributing |
| 62 | + |
| 63 | +If you have any suggestion for how this project could be improved, please read the [contributing guidelines](https://github.com/github/rubocop-rails-accessibility/blob/main/CONTRIBUTING.md). |
0 commit comments