Skip to content

Commit 60b0614

Browse files
committed
Add RuboCop
1 parent 48f239e commit 60b0614

9 files changed

+105
-24
lines changed

.rubocop.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
inherit_from: .rubocop_todo.yml
2+
3+
AllCops:
4+
Exclude:
5+
- 'Carthage/**/*'
6+
7+
Metrics/ParameterLists:
8+
Max: 8
9+
10+
Metrics/MethodLength:
11+
Max: 20

.rubocop_todo.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2017-04-08 20:50:49 -0300 using RuboCop version 0.48.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
Metrics/AbcSize:
11+
Max: 16
12+
13+
# Offense count: 15
14+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
15+
# URISchemes: http, https
16+
Metrics/LineLength:
17+
Max: 250
18+
19+
# Offense count: 2
20+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
21+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
22+
Style/FileName:
23+
Exclude:
24+
- 'Dangerfile'
25+
- 'fastlane/Deliverfile'
26+
27+
# Offense count: 4
28+
# Cop supports --auto-correct.
29+
# Configuration parameters: EnforcedStyle, SupportedStyles.
30+
# SupportedStyles: when_needed, always, never
31+
Style/FrozenStringLiteralComment:
32+
Exclude:
33+
- 'Dangerfile'
34+
- 'Gemfile'
35+
- 'fastlane/Deliverfile'
36+
- 'fastlane/Fastfile'
37+
38+
# Offense count: 3
39+
# Cop supports --auto-correct.
40+
# Configuration parameters: EnforcedStyle, SupportedStyles.
41+
# SupportedStyles: only_raise, only_fail, semantic
42+
Style/SignalException:
43+
Exclude:
44+
- 'Dangerfile'
45+
46+
# Offense count: 3
47+
# Cop supports --auto-correct.
48+
# Configuration parameters: SupportedStyles.
49+
# SupportedStyles: use_perl_names, use_english_names
50+
Style/SpecialGlobalVars:
51+
Exclude:
52+
- 'Rakefile'
53+
54+
# Offense count: 10
55+
# Cop supports --auto-correct.
56+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
57+
# SupportedStyles: single_quotes, double_quotes
58+
Style/StringLiterals:
59+
Exclude:
60+
- 'Dangerfile'
61+
- 'fastlane/Deliverfile'
62+
- 'fastlane/Fastfile'

Dangerfile

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11

22
def warning_important_file_changed(file)
3-
warn "Do you really want to modify #{file}?" if git.modified_files.include?(file)
3+
warn "Modified #{file}?" if git.modified_files.include?(file)
44
end
55

6-
# Sometimes it's a README fix, or something like that - which isn't relevant for
7-
# including in a project's CHANGELOG for example
8-
declared_trivial = github.pr_title.include? '#trivial'
9-
106
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
117
warn 'PR is classed as Work in Progress' if (github.pr_title + github.pr_body).include? "[WIP]"
128

@@ -26,13 +22,15 @@ if github.pr_body.length < 5
2622
fail 'Please provide a summary in the Pull Request description'
2723
end
2824

29-
30-
# Change it later
25+
# Xcode
3126
build_file = File.expand_path 'result.json'
3227
system "rake generate_xcode_summary[#{build_file}]"
33-
json = xcode_summary.report build_file
28+
xcode_summary.report build_file
3429

3530
slather.configure('swift-evolution.xcodeproj', 'swift-evolution')
3631
slather.notify_if_coverage_is_less_than(minimum_coverage: 80, notify_level: :warning)
3732
slather.notify_if_modified_file_is_less_than(minimum_coverage: 50, notify_level: :warning)
3833
slather.show_modified_files_coverage
34+
35+
# RuboCop
36+
rubocop.lint

Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ source 'https://rubygems.org'
66

77
gem 'fastlane'
88
gem 'rake', '12.0.0'
9+
gem 'rubocop', '0.48.1'
910
gem 'xcpretty-json-formatter', '0.1.0'
10-
gem 'xcpretty-travis-formatter', '0.0.4'
11+
gem 'xcpretty-travis-formatter', '0.0.4'

Gemfile.lock

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ GEM
99
tzinfo (~> 1.1)
1010
addressable (2.5.1)
1111
public_suffix (~> 2.0, >= 2.0.2)
12+
ast (2.3.0)
1213
babosa (1.0.2)
1314
claide (1.0.1)
1415
colored (1.2)
@@ -100,13 +101,24 @@ GEM
100101
multipart-post (2.0.0)
101102
nanaimo (0.2.3)
102103
os (0.9.6)
104+
parser (2.4.0.0)
105+
ast (~> 2.2)
103106
plist (3.2.0)
107+
powerpack (0.1.1)
104108
public_suffix (2.0.5)
109+
rainbow (2.2.1)
105110
rake (12.0.0)
106111
representable (2.3.0)
107112
uber (~> 0.0.7)
108113
retriable (2.1.0)
109114
rouge (1.11.1)
115+
rubocop (0.48.1)
116+
parser (>= 2.3.3.1, < 3.0)
117+
powerpack (~> 0.1)
118+
rainbow (>= 1.99.1, < 3.0)
119+
ruby-progressbar (~> 1.7)
120+
unicode-display_width (~> 1.0, >= 1.0.1)
121+
ruby-progressbar (1.8.1)
110122
rubyzip (1.2.1)
111123
security (0.1.3)
112124
signet (0.7.3)
@@ -146,6 +158,7 @@ PLATFORMS
146158
DEPENDENCIES
147159
fastlane
148160
rake (= 12.0.0)
161+
rubocop (= 0.48.1)
149162
xcpretty-json-formatter (= 0.1.0)
150163
xcpretty-travis-formatter (= 0.0.4)
151164

fastlane/Deliverfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# If you want to have even more control, check out the documentation
33
# https://github.com/fastlane/fastlane/blob/master/deliver/Deliverfile.md
44

5-
65
###################### Automatically generated ######################
76
# Feel free to remove the following line if you use fastlane (which you should)
87

fastlane/Fastfile

-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ default_platform :ios
1818
platform :ios do
1919
before_all do
2020
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
21-
22-
2321
end
2422

2523
desc "Runs all the tests"
@@ -65,7 +63,6 @@ platform :ios do
6563
end
6664
end
6765

68-
6966
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
7067
# All available actions: https://docs.fastlane.tools/actions
7168

rakelib/build-test.rake

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ def xcode(scheme: '',
104104
other_options = 'CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE=' unless actions.include? 'archive'
105105
archive_options = archive_path.to_s.strip.empty? ? '-enableCodeCoverage YES' : "-archivePath '#{archive_path}'"
106106

107-
if WORKSPACE_PATH.nil?
108-
project = "-project #{PROJECT_PATH}"
109-
else
110-
project = "-workspace '#{WORKSPACE_PATH}'"
111-
end
107+
project = if WORKSPACE_PATH.nil?
108+
"-project #{PROJECT_PATH}"
109+
else
110+
"-workspace '#{WORKSPACE_PATH}'"
111+
end
112112

113113
sh "rm -f '#{xcode_log_file}' '#{report_file}'"
114114
sh "set -o pipefail && xcodebuild #{other_options} #{xcode_configuration} -destination '#{destination}' #{project} -scheme '#{scheme}' #{archive_options} #{actions} | tee '#{xcode_log_file}' | xcpretty --color --no-utf -r junit -o '#{report_file}'"

rakelib/setup-project.rake

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ end
2525
CARTHAGE_OPTIONS = '--platform iOS --no-use-binaries'
2626

2727
desc 'Install dependencies in Carthage'
28-
task :carthage_install, [ :dependency ] do |_t, args|
28+
task :carthage_install, [:dependency] do |_t, args|
2929
dependency = args[:dependency]
3030
sh "carthage bootstrap #{CARTHAGE_OPTIONS} #{dependency}"
3131
end
3232

33-
task :carthage_update, [ :dependency ] do |_t, args|
33+
task :carthage_update, [:dependency] do |_t, args|
3434
dependency = args[:dependency]
3535
sh "carthage update #{CARTHAGE_OPTIONS} #{dependency}"
3636
end
3737

38-
task :carthage_clean, [ :dependency ] do |_t, args|
39-
has_dependency = args[:dependency].to_s.strip.length != 0
38+
task :carthage_clean, [:dependency] do |_t, args|
39+
has_dependency = !args[:dependency].to_s.strip.empty?
4040
sh 'rm -rf "~/Library/Caches/org.carthage.CarthageKit/"' unless has_dependency
4141
sh "rm -rf '#{BASE_PATH}/Carthage/'" unless has_dependency
4242
end
@@ -47,7 +47,7 @@ def brew_update
4747
sh 'brew update || brew update'
4848
end
4949

50-
def brew_install( formula )
51-
fail 'no formula' if formula.to_s.strip.length == 0
50+
def brew_install(formula)
51+
raise 'no formula' if formula.to_s.strip.empty?
5252
sh " ( brew list #{formula} ) && ( brew outdated #{formula} || brew upgrade #{formula} ) || ( brew install #{formula} ) "
5353
end

0 commit comments

Comments
 (0)