rubocop-rails-accessibility 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CODEOWNERS +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -3
- data/config/default.yml +0 -3
- data/lib/rubocop/cop/rubocop_rails_accessibility_cops.rb +0 -1
- data/lib/rubocop/cop/version.rb +1 -1
- metadata +3 -4
- data/guides/link-has-href.md +0 -29
- data/lib/rubocop/cop/rubocop-rails-accessibility/link_has_href.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2def62d1c73f8ef14e06d1eaca55ca244d12cd2e924f8a0d7025ade68f0b36a4
|
4
|
+
data.tar.gz: 8b229af38423902ebe468cf0d2a77803dcf0f3df785ffab6e1f43e45a55bc246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91d417a156fb4c761264ad623f762a52b2864f0848c38e7ff15d7f467fa26c283d7ab1170fd00b880b177158dfaeafc343264c286a9bcf8cd70c25fd10a19df8
|
7
|
+
data.tar.gz: 38e510e2d4014dc6ccccc71ee97841425e3f55df36b3b673092a0a7101dc5fb019d8b3eb8a4f6692530b933f2ce0d9a6eb99cc679401f573ee017c905521c68e
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @github/accessibility-reviewers
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,6 @@ Put this into your `.rubocop.yml`.
|
|
28
28
|
inherit_gem:
|
29
29
|
rubocop-rails-accessibility:
|
30
30
|
- config/default.yml
|
31
|
-
- config/rubocop_rails_accessibility.yml
|
32
31
|
```
|
33
32
|
|
34
33
|
## Testing
|
@@ -48,13 +47,12 @@ bundle exec rake
|
|
48
47
|
## The Cops
|
49
48
|
|
50
49
|
All cops are located under
|
51
|
-
[`lib/rubocop/cop/
|
50
|
+
[`lib/rubocop/cop/rubocop-rails-accessibility`](lib/rubocop/cop/rubocop-rails-accessibility), and contain
|
52
51
|
examples/documentation.
|
53
52
|
|
54
53
|
## Rules
|
55
54
|
|
56
55
|
- [RuboCop::Cop::Accessibility::ImageHasAlt](guides/image-has-alt.md)
|
57
|
-
- [RuboCop::Cop::Accessibility::LinkHasHref](guides/link-has-href.md)
|
58
56
|
- [RuboCop::Cop::Accessibility::NoPositiveTabindex](guides/no-positive-tabindex.md)
|
59
57
|
- [RuboCop::Cop::Accessibility::NoRedundantImageAlt](guides/no-redundant-image-alt.md)
|
60
58
|
|
data/config/default.yml
CHANGED
@@ -7,9 +7,6 @@ AllCops:
|
|
7
7
|
RubocopRailsAccessibility/ImageHasAlt:
|
8
8
|
Enabled: true
|
9
9
|
StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/image-has-alt.md
|
10
|
-
RubocopRailsAccessibility/LinkHasHref:
|
11
|
-
Enabled: true
|
12
|
-
StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/link-has-href.md
|
13
10
|
RubocopRailsAccessibility/NoPositiveTabindex:
|
14
11
|
Enabled: true
|
15
12
|
StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/no-positive-tabindex.md
|
@@ -6,6 +6,5 @@ require "yaml"
|
|
6
6
|
require_relative "inject"
|
7
7
|
require_relative "version"
|
8
8
|
require_relative "rubocop-rails-accessibility/image_has_alt"
|
9
|
-
require_relative "rubocop-rails-accessibility/link_has_href"
|
10
9
|
require_relative "rubocop-rails-accessibility/no_positive_tabindex"
|
11
10
|
require_relative "rubocop-rails-accessibility/no_redundant_image_alt"
|
data/lib/rubocop/cop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails-accessibility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Accessibility Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".rspec"
|
133
133
|
- ".rubocop.yml"
|
134
|
+
- CODEOWNERS
|
134
135
|
- CONTRIBUTING.md
|
135
136
|
- Gemfile
|
136
137
|
- Gemfile.lock
|
@@ -139,12 +140,10 @@ files:
|
|
139
140
|
- Rakefile
|
140
141
|
- config/default.yml
|
141
142
|
- guides/image-has-alt.md
|
142
|
-
- guides/link-has-href.md
|
143
143
|
- guides/no-positive-tabindex.md
|
144
144
|
- guides/no-redundant-image-alt.md
|
145
145
|
- lib/rubocop/cop/inject.rb
|
146
146
|
- lib/rubocop/cop/rubocop-rails-accessibility/image_has_alt.rb
|
147
|
-
- lib/rubocop/cop/rubocop-rails-accessibility/link_has_href.rb
|
148
147
|
- lib/rubocop/cop/rubocop-rails-accessibility/no_positive_tabindex.rb
|
149
148
|
- lib/rubocop/cop/rubocop-rails-accessibility/no_redundant_image_alt.rb
|
150
149
|
- lib/rubocop/cop/rubocop_rails_accessibility_cops.rb
|
data/guides/link-has-href.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# RubocopRailsAccessibility/LinkHasHref
|
2
|
-
|
3
|
-
## Rule Details
|
4
|
-
|
5
|
-
Links should go somewhere, you probably want to use a `<button>` instead.
|
6
|
-
|
7
|
-
## Resources
|
8
|
-
|
9
|
-
- [`<a>`: The Anchor element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
|
10
|
-
- [Primer: Links](https://primer.style/design/accessibility/links)
|
11
|
-
- [HTML Spec: The a element](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element)
|
12
|
-
|
13
|
-
## Examples
|
14
|
-
### **Incorrect** code for this rule 👎
|
15
|
-
|
16
|
-
```erb
|
17
|
-
<%= link_to 'Go to GitHub' %>
|
18
|
-
```
|
19
|
-
|
20
|
-
```erb
|
21
|
-
<%= link_to 'Go to GitHub', '#' %>
|
22
|
-
```
|
23
|
-
|
24
|
-
### **Correct** code for this rule 👍
|
25
|
-
|
26
|
-
```erb
|
27
|
-
<!-- good -->
|
28
|
-
<%= link_to 'Go to GitHub', 'https://github.com/' %>
|
29
|
-
```
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rubocop"
|
4
|
-
|
5
|
-
module RuboCop
|
6
|
-
module Cop
|
7
|
-
module RubocopRailsAccessibility
|
8
|
-
class LinkHasHref < Base
|
9
|
-
MSG = "Links should go somewhere, you probably want to use a `<button>` instead."
|
10
|
-
|
11
|
-
def on_send(node)
|
12
|
-
receiver, method_name, *args = *node
|
13
|
-
|
14
|
-
return unless receiver.nil? && method_name == :link_to
|
15
|
-
|
16
|
-
return unless args.length == 1 || (args.length > 1 && args[1].type == :str && args[1].children.first == "#")
|
17
|
-
|
18
|
-
add_offense(node.loc.selector)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|