generated from r7kamura/rubocop-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from github/rubocop-rules-set
Adapt repo to be a rules set
- Loading branch information
Showing
36 changed files
with
626 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
strategy: | ||
matrix: | ||
ruby: | ||
- '2.6' | ||
- '2.7' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ | |
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
|
||
vendor/ | ||
# rspec failure tracking | ||
.rspec_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
AllCops: | ||
NewCops: enable | ||
SuggestExtensions: false | ||
TargetRubyVersion: 2.6 | ||
inherit_gem: | ||
rubocop-github: | ||
- config/default.yml | ||
- config/rails.yml | ||
|
||
Metrics: | ||
Enabled: false | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
Naming/FileName: | ||
Enabled: true | ||
Exclude: | ||
- "rubocop-rails-accessibility.gemspec" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# How to contribute | ||
|
||
This is an open source project, so if you have suggestions for how this project could be improved, or want to report a bug, open an issue! I'd love all and any contributions. You can submit issues and enhancement requests through the [issues page on GitHub](https://github.com/github/rubocop-rails-accessibility/issues). If you have any question, please don't hesitate to contact me, I'd love to hear from you. | ||
|
||
### Contributing guidelines | ||
|
||
In general, I follow the "fork-and-pull" Git workflow: | ||
|
||
1. **Fork and clone** the repo on GitHub. | ||
2. **Configure and install** the dependencies `npm install`. | ||
3. **Create** a new branch: `git checkout -b branch-name`. | ||
4. **Commit** all your changes to your branch. Please write a [good commit message](https://chris.beams.io/posts/git-commit/). | ||
5. **Push** your work back up to your fork. | ||
6. **Submit a Pull Request** so that I can review your changes. Please add documentation and some details to the PR. | ||
|
||
Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you. | ||
|
||
## Resources | ||
|
||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) | ||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) | ||
- [GitHub Help](https://help.github.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
source "https://rubygems.org" | ||
|
||
# Specify your gem's dependencies in my_extension.gemspec | ||
# Specify your gem's dependencies in rubocop-rails-accessibility.gemspec | ||
gemspec | ||
|
||
gem 'rake', '~> 13.0' | ||
gem 'rspec', '~> 3.0' | ||
gem 'rubocop', '~> 1.21' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 GitHub | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,63 @@ | ||
# rubocop-extension-template | ||
# RuboCop Rails Accessibility | ||
|
||
Custom [RuboCop](https://github.com/rubocop/rubocop) extension template. | ||
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. | ||
|
||
## Installation | ||
|
||
Install the `rubocop-rails-accessibility` gem | ||
|
||
```sh | ||
gem install rubocop-rails-accessibility | ||
``` | ||
|
||
or if you use bundler put this in your `Gemfile` | ||
|
||
```ruby | ||
gem 'rubocop-rails-accessibility' | ||
gem "rubocop-performance", require: false | ||
gem "rubocop-rails", require: false | ||
``` | ||
|
||
## Usage | ||
|
||
1. [Use this template](https://github.com/r7kamura/rubocop-extension-template/generate) to create a repository | ||
2. Rename gem name from `my_extension` to your own | ||
3. Run `bin/setup` | ||
4. Add your custom cop by running `bundle exec rake new_cop[Foo/Bar]` | ||
5. Edit `lib/rubocop/cop/foo/bar.rb` | ||
You need to tell RuboCop to load RuboCop Rails Accessibility. | ||
|
||
Put this into your `.rubocop.yml`. | ||
|
||
``` yaml | ||
inherit_gem: | ||
rubocop-rails-accessibility: | ||
- config/default.yml | ||
- config/rubocop_rails_accessibility.yml | ||
``` | ||
## Testing | ||
Install all of the required gems | ||
```sh[] | ||
bundle install | ||
```[] | ||
Run the tests | ||
```sh | ||
bundle exec rake | ||
``` | ||
|
||
## The Cops | ||
|
||
All cops are located under | ||
[`lib/rubocop/cop/rubocop_rails_accessibility`](lib/rubocop/cop/rubocop_rails_accessibility), and contain | ||
examples/documentation. | ||
|
||
## Rules | ||
|
||
- [RuboCop::Cop::Accessibility::ImageHasAlt](guides/image-has-alt.md) | ||
- [RuboCop::Cop::Accessibility::LinkHasHref](guides/link-has-href.md) | ||
- [RuboCop::Cop::Accessibility::NoPositiveTabindex](guides/no-positive-tabindex.md) | ||
- [RuboCop::Cop::Accessibility::NoRedundantImageAlt](guides/no-redundant-image-alt.md) | ||
|
||
## Contributing | ||
|
||
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.