Skip to content

Commit 1719803

Browse files
committed
Add Rubocop
1 parent 8b7b694 commit 1719803

File tree

6 files changed

+50
-62
lines changed

6 files changed

+50
-62
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.orig
33

44
/.rspec_failures
5+
/.rubocop-*
56
/Gemfile.lock
67

78
/_misc/

.rubocop.yml

Lines changed: 14 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,27 @@
1-
require:
2-
- rubocop-rspec
3-
4-
Rails:
5-
Enabled: true
1+
inherit_from:
2+
- https://relaxed.ruby.style/rubocop.yml
63

74
AllCops:
8-
TargetRubyVersion: 2.3.8
9-
TargetRailsVersion: 5.2
105
Exclude:
11-
- db/schema.rb
126
- bin/*
13-
- node_modules/**/*
14-
# Temporary files
15-
- tmp/**/*
7+
- spec/dummy/**/*
8+
NewCops: enable
169

17-
Rails/InverseOf:
10+
Gemspec/RequiredRubyVersion:
1811
Enabled: false
1912

20-
Style/Documentation:
13+
Naming/FileName:
2114
Enabled: false
2215

23-
Metrics/ClassLength:
24-
# Default value is 100
25-
Max: 150
26-
27-
Metrics/LineLength:
28-
# Default is 80
16+
Layout/LineLength:
17+
Enabled: true
2918
Max: 120
3019

31-
Metrics/ModuleLength:
32-
# Default is 100
33-
Max: 150
34-
35-
Metrics/ParameterLists:
36-
# Default is 5
37-
Max: 6
38-
39-
RSpec/ExampleLength:
40-
# Default is 10
41-
Max: 20
42-
43-
Style/FrozenStringLiteralComment:
44-
# Deface DOES edit strings in place
45-
Exclude:
46-
- 'app/overrides/**/*'
47-
48-
RSpec/MultipleExpectations:
49-
# Default is 3
50-
Max: 5
51-
52-
RSpec/NestedGroups:
53-
# Default is 3
54-
Max: 6
55-
56-
Metrics/AbcSize:
57-
Max: 25
58-
59-
Metrics/BlockLength:
60-
# This value double the rubocop default
61-
Max: 50
62-
63-
Metrics/CyclomaticComplexity:
64-
# This value double the rubocop default
65-
Max: 12
20+
Style/HashEachMethods:
21+
Enabled: true
6622

67-
Metrics/MethodLength:
68-
# This value double the rubocop default
69-
Max: 20
23+
Style/HashTransformKeys:
24+
Enabled: true
7025

71-
Metrics/PerceivedComplexity:
72-
# Default is 7
73-
Max: 10
26+
Style/HashTransformValues:
27+
Enabled: true

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
gemspec
4-

activeadmin_dynamic_fields.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
2525
spec.add_development_dependency 'puma', '~> 4.3.5'
2626
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
2727
spec.add_development_dependency 'rspec-rails', '~> 4.0.1'
28+
spec.add_development_dependency 'rubocop', '~> 0.90.0'
2829
spec.add_development_dependency 'selenium-webdriver', '~> 3.142.7'
2930
spec.add_development_dependency 'simplecov', '~> 0.19.0'
3031
spec.add_development_dependency 'sqlite3', '~> 1.4.2'

bin/rubocop

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rubocop' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rubocop", "rubocop")

spec/system/dynamic_fields_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
it 'changes the value of target when the source element is blank' do
3636
visit "/admin/posts/#{post.id}/edit"
3737

38-
expect(page).to have_css('#post_description[data-if="blank"][data-action="setValue no title"][data-target="#post_category"]')
38+
expect(page).to have_css(
39+
'#post_description[data-if="blank"][data-action="setValue no title"][data-target="#post_category"]'
40+
)
3941
expect(find('#post_category').value).to eq 'no title'
4042
find('#post_category').set('...')
4143
find('#post_description').set('...')

0 commit comments

Comments
 (0)