Skip to content

Commit 5c9cd89

Browse files
author
Adrián Bolonio
authored
Merge pull request #2 from github/kh-suggestions
Suggestions for PR #1
2 parents 5a11b4b + e48f8ab commit 5c9cd89

20 files changed

+109
-90
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
ruby:
16-
- '2.6'
16+
- '2.7'
1717

1818
steps:
1919
- uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
/pkg/
77
/spec/reports/
88
/tmp/
9-
9+
vendor/
1010
# rspec failure tracking
1111
.rspec_status

.rubocop.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
AllCops:
2-
NewCops: enable
3-
SuggestExtensions: false
4-
TargetRubyVersion: 2.6
1+
inherit_gem:
2+
rubocop-github:
3+
- config/default.yml
4+
- config/rails.yml
55

66
Naming/FileName:
77
Enabled: true
88
Exclude:
9-
- "rubocop-rails-accessibility.gemspec"
9+
- "rubocop-rails-accessibility.gemspec"

Gemfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

55
# Specify your gem's dependencies in rubocop-rails-accessibility.gemspec
66
gemspec
7-
8-
gem 'rake', '~> 13.0'
9-
gem 'rspec', '~> 3.0'
10-
gem 'rubocop', '~> 1.21'

Gemfile.lock

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PATH
22
remote: .
33
specs:
44
rubocop-rails-accessibility (0.1.0)
5-
rubocop
5+
rubocop (>= 1.0.0)
66

77
GEM
88
remote: https://rubygems.org/
@@ -31,12 +31,15 @@ GEM
3131
crass (~> 1.0.2)
3232
nokogiri (>= 1.5.9)
3333
minitest (5.16.3)
34+
nokogiri (1.13.8-x86_64-darwin)
35+
racc (~> 1.4)
3436
nokogiri (1.13.8-x86_64-linux)
3537
racc (~> 1.4)
3638
parallel (1.22.1)
3739
parser (3.1.2.0)
3840
ast (~> 2.4.1)
3941
racc (1.6.0)
42+
rack (2.2.4)
4043
rails-dom-testing (2.0.3)
4144
activesupport (>= 4.2.0)
4245
nokogiri (>= 1.6)
@@ -71,20 +74,34 @@ GEM
7174
unicode-display_width (>= 1.4.0, < 3.0)
7275
rubocop-ast (1.19.1)
7376
parser (>= 3.1.1.0)
77+
rubocop-github (0.18.0)
78+
rubocop (>= 1.0.0)
79+
rubocop-performance
80+
rubocop-rails
81+
rubocop-performance (1.14.3)
82+
rubocop (>= 1.7.0, < 2.0)
83+
rubocop-ast (>= 0.4.0)
84+
rubocop-rails (2.15.2)
85+
activesupport (>= 4.2.0)
86+
rack (>= 1.1)
87+
rubocop (>= 1.7.0, < 2.0)
7488
ruby-progressbar (1.11.0)
7589
tzinfo (2.0.5)
7690
concurrent-ruby (~> 1.0)
7791
unicode-display_width (2.2.0)
7892

7993
PLATFORMS
94+
x86_64-darwin-19
8095
x86_64-linux
8196

8297
DEPENDENCIES
8398
actionview
8499
minitest
85100
rake (~> 13.0)
86101
rspec (~> 3.0)
87-
rubocop (~> 1.21)
102+
rubocop-github
103+
rubocop-performance
104+
rubocop-rails
88105
rubocop-rails-accessibility!
89106

90107
BUNDLED WITH

Rakefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# frozen_string_literal: true
22

3-
require 'bundler/gem_tasks'
4-
require 'rake/testtask'
5-
require 'rspec/core/rake_task'
3+
require "bundler/gem_tasks"
4+
require "rake/testtask"
5+
require "rspec/core/rake_task"
66

77
Rake::TestTask.new
88

99
RSpec::Core::RakeTask.new(:spec)
1010

11-
require 'rubocop/rake_task'
11+
require "rubocop/rake_task"
1212

1313
RuboCop::RakeTask.new
1414

1515
task default: %i[test rubocop]
1616

17-
desc 'Generate a new cop with a template'
17+
desc "Generate a new cop with a template"
1818
task :new_cop, [:cop] do |_task, args|
19-
require 'rubocop'
19+
require "rubocop"
2020

2121
cop_name = args.fetch(:cop) do
2222
warn "usage: bundle exec rake 'new_cop[Department/Name]'"
@@ -27,8 +27,8 @@ task :new_cop, [:cop] do |_task, args|
2727

2828
generator.write_source
2929
generator.write_spec
30-
generator.inject_require(root_file_path: 'lib/rubocop-rails-accessibility.rb')
31-
generator.inject_config(config_file_path: 'config/default.yml')
30+
generator.inject_require(root_file_path: "lib/rubocop-rails-accessibility.rb")
31+
generator.inject_config(config_file_path: "config/default.yml")
3232

3333
puts generator.todo
3434
end

config/default.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require:
22
- rubocop/cop/rubocop_rails_accessibility_cops
3-
- rubocop-performance
43

54
AllCops:
65
DisabledByDefault: true

lib/rubocop/cop/inject.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'rubocop'
3+
require "rubocop"
44

55
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/main/lib/rubocop/rspec/inject.rb
66
# See https://github.com/rubocop/rubocop-rspec/blob/main/MIT-LICENSE.md

lib/rubocop/cop/rubocop-rails-accessibility/image_has_alt.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# frozen_string_literal: true
22

3-
require 'rubocop'
3+
require "rubocop"
44

55
module RuboCop
66
module Cop
77
module RubocopRailsAccessibility
88
class ImageHasAlt < Base
9-
MSG = 'Images should have an alt prop with meaningful text or an empty string for decorative images'
9+
MSG = "Images should have an alt prop with meaningful text or an empty string for decorative images"
1010

11-
def_node_search :has_alt_attribute?, '(sym :alt)'
11+
def_node_search :has_alt_attribute?, "(sym :alt)"
1212

1313
def on_send(node)
1414
receiver, method_name, = *node

lib/rubocop/cop/rubocop-rails-accessibility/link_has_href.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# frozen_string_literal: true
22

3-
require 'rubocop'
3+
require "rubocop"
44

55
module RuboCop
66
module Cop
77
module RubocopRailsAccessibility
88
class LinkHasHref < Base
9-
MSG = 'Links should go somewhere, you probably want to use a `<button>` instead.'
9+
MSG = "Links should go somewhere, you probably want to use a `<button>` instead."
1010

1111
def on_send(node)
1212
receiver, method_name, *args = *node
1313

1414
return unless receiver.nil? && method_name == :link_to
1515

16-
return unless args.length == 1 || (args.length > 1 && args[1].type == :str && args[1].children.first == '#')
16+
return unless args.length == 1 || (args.length > 1 && args[1].type == :str && args[1].children.first == "#")
1717

1818
add_offense(node.loc.selector)
1919
end

0 commit comments

Comments
 (0)