danger-swiftlint 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71b06256f2784921e22fbdc37355c02c0e254b3
4
- data.tar.gz: c1ea5e23bfb6ad68c56a00df4576c5d0b10298a3
3
+ metadata.gz: 18a143487b60e3af2f374acebf0f22493b1906a8
4
+ data.tar.gz: 80dbc5a826284cc2b73f30c0356974247532a597
5
5
  SHA512:
6
- metadata.gz: bb46882114d80a100b1c4a5cc932c923becc6540c3f893378df3a5c0120b5ae3f5bfcdc29653f19064145a8c0f2fb480764058b61a3fc1c81202159c19aeb403
7
- data.tar.gz: 260ae84694e2b4193376b4df088048f53d0c830f94d66c3bf408fe5efe7bfa727bde836c360db6765af3e699b5c1d648fc7719b0d1c6a5234783df318fce8443
6
+ metadata.gz: eb8c96ef07981c6db9a5b879adfc6a9c51f1fd4bf30ab1f4826d786149fcbfb89e170f3870b50b8447dadf1d868b003d206c80e670890ae8fa5c25771b5e77af
7
+ data.tar.gz: ca3faab2254f588ddf10cf0e4c939c81c5d3f096ea59b0f17ac1b0cfe886a3da531b7276b27cb4b4bcec483bf3f26bb74d3647422e843c2b5145917ac5a85e79
data/bin/danger-swiftlint CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  if $PROGRAM_NAME == __FILE__
4
5
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
@@ -6,6 +7,7 @@ end
6
7
  require 'thor'
7
8
  require 'version'
8
9
 
10
+ # The class defining the CLI interface of the plugin.
9
11
  class DangerSwiftlintCLI < Thor
10
12
  desc 'version', 'The version of the installed danger-swiftlint plugin'
11
13
  def version
@@ -1,12 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../lib/version'
2
4
 
3
5
  namespace :swiftlint do
4
-
5
- desc "Download and install swiftlint tool"
6
+ desc 'Download and install swiftlint tool'
6
7
  task :install do
7
- REPO = "https://github.com/realm/SwiftLint"
8
- VERSION = ENV["SWIFTLINT_VERSION"] || DangerSwiftlint::SWIFTLINT_VERSION
9
- ASSET = "portable_swiftlint.zip"
8
+ REPO = 'https://github.com/realm/SwiftLint'
9
+ VERSION = ENV['SWIFTLINT_VERSION'] || DangerSwiftlint::SWIFTLINT_VERSION
10
+ ASSET = 'portable_swiftlint.zip'
10
11
  URL = "#{REPO}/releases/download/#{VERSION}/#{ASSET}"
11
12
  DESTINATION = File.expand_path(File.join(File.dirname(__FILE__), 'bin'))
12
13
 
@@ -16,9 +17,8 @@ namespace :swiftlint do
16
17
  "curl -s -L #{URL} -o #{ASSET}",
17
18
  "unzip -q #{ASSET} -d #{DESTINATION}",
18
19
  "rm #{ASSET}"
19
- ].join(" && ")
20
+ ].join(' && ')
20
21
  end
21
-
22
22
  end
23
23
 
24
24
  task default: 'swiftlint:install'
@@ -1,15 +1,15 @@
1
+ # frozen_string_literal: true
1
2
 
3
+ # A wrapper to use SwiftLint via a Ruby API.
2
4
  class Swiftlint
3
- def initialize(swiftlint_path=nil)
5
+ def initialize(swiftlint_path = nil)
4
6
  @swiftlint_path = swiftlint_path
5
7
  end
6
8
 
7
9
  # Runs swiftlint
8
- def run(cmd='lint', additional_swiftlint_args='', options={})
10
+ def run(cmd = 'lint', additional_swiftlint_args = '', options = {})
9
11
  # change pwd before run swiftlint
10
- if options.has_key? :pwd
11
- Dir.chdir options.delete(:pwd)
12
- end
12
+ Dir.chdir options.delete(:pwd) if options.key? :pwd
13
13
 
14
14
  # run swiftlint with provided options
15
15
  `#{swiftlint_path} #{cmd} #{swiftlint_arguments(options, additional_swiftlint_args)}`
@@ -21,13 +21,13 @@ class Swiftlint
21
21
  end
22
22
 
23
23
  # Return true if swiftlint is installed or false otherwise
24
- def is_installed?
24
+ def installed?
25
25
  File.exist?(swiftlint_path)
26
26
  end
27
27
 
28
28
  # Return swiftlint execution path
29
29
  def swiftlint_path
30
- @swiftlint_path or default_swiftlint_path
30
+ @swiftlint_path || default_swiftlint_path
31
31
  end
32
32
 
33
33
  private
@@ -35,10 +35,10 @@ class Swiftlint
35
35
  # Parse options into shell arguments how swift expect it to be
36
36
  # more information: https://github.com/Carthage/Commandant
37
37
  # @param options (Hash) hash containing swiftlint options
38
- def swiftlint_arguments (options, additional_swiftlint_args)
38
+ def swiftlint_arguments(options, additional_swiftlint_args)
39
39
  (options.
40
40
  # filter not null
41
- select {|key, value| !value.nil?}.
41
+ reject { |_key, value| value.nil? }.
42
42
  # map booleans arguments equal true
43
43
  map { |key, value| value.is_a?(TrueClass) ? [key, ''] : [key, value] }.
44
44
  # map booleans arguments equal false
@@ -48,7 +48,7 @@ class Swiftlint
48
48
  # prepend '--' into the argument
49
49
  map { |key, value| ["--#{key}", value] }.
50
50
  # reduce everything into a single string
51
- reduce('') { |args, option| "#{args} #{option[0]} #{option[1]}"} +
51
+ reduce('') { |args, option| "#{args} #{option[0]} #{option[1]}" } +
52
52
  " #{additional_swiftlint_args}").
53
53
  # strip leading spaces
54
54
  strip
data/lib/danger_plugin.rb CHANGED
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'find'
2
4
  require 'yaml'
3
5
  require 'shellwords'
4
6
  require_relative '../ext/swiftlint/swiftlint'
5
7
 
6
8
  module Danger
7
-
8
9
  # Lint Swift files inside your projects.
9
10
  # This is done using the [SwiftLint](https://github.com/realm/SwiftLint) tool.
10
11
  # Results are passed out as a table in markdown.
@@ -32,34 +33,34 @@ module Danger
32
33
  attr_accessor :verbose
33
34
 
34
35
  # Lints Swift files. Will fail if `swiftlint` cannot be installed correctly.
35
- # Generates a `markdown` list of warnings for the prose in a corpus of .markdown and .md files.
36
+ # Generates a `markdown` list of warnings for the prose in a corpus of
37
+ # .markdown and .md files.
36
38
  #
37
39
  # @param [String] files
38
- # A globbed string which should return the files that you want to lint, defaults to nil.
40
+ # A globbed string which should return the files that you want to
41
+ # lint, defaults to nil.
39
42
  # if nil, modified and added files from the diff will be used.
40
43
  # @return [void]
41
44
  #
42
- def lint_files(files=nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: "")
45
+ def lint_files(files = nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: '')
43
46
  # Fails if swiftlint isn't installed
44
- raise "swiftlint is not installed" unless swiftlint.is_installed?
47
+ raise 'swiftlint is not installed' unless swiftlint.installed?
45
48
 
46
49
  config = if config_file
47
- File.expand_path(config_file)
48
- elsif File.file?('.swiftlint.yml')
49
- File.expand_path('.swiftlint.yml')
50
- else
51
- nil
52
- end
50
+ File.expand_path(config_file)
51
+ elsif File.file?('.swiftlint.yml')
52
+ File.expand_path('.swiftlint.yml')
53
+ end
53
54
  log "Using config file: #{config}"
54
-
55
- dir_selected = directory ? File.expand_path(directory) : Dir.pwd
55
+
56
+ dir_selected = directory ? File.expand_path(directory) : Shellwords.escape(Dir.pwd)
56
57
  log "Swiftlint will be run from #{dir_selected}"
57
58
 
58
59
  # Extract excluded paths
59
60
  excluded_paths = excluded_files_from_config(config)
60
61
 
61
62
  # Extract swift files (ignoring excluded ones)
62
- files = find_swift_files(files, excluded_paths, dir_selected)
63
+ files = find_swift_files(dir_selected, files, excluded_paths)
63
64
  log "Swiftlint will lint the following files: #{files.join(', ')}"
64
65
 
65
66
  # Prepare swiftlint options
@@ -80,21 +81,19 @@ module Danger
80
81
  errors = issues.select { |issue| issue['severity'] == 'Error' }
81
82
 
82
83
  if inline_mode
83
- # Reprt with inline comment
84
- send_inline_comment(warnings, "warn")
85
- send_inline_comment(errors, "fail")
86
- else
84
+ # Report with inline comment
85
+ send_inline_comment(warnings, 'warn')
86
+ send_inline_comment(errors, 'fail')
87
+ elsif warnings.count.positive? || errors.count.positive?
87
88
  # Report if any warning or error
88
- if warnings.count > 0 || errors.count > 0
89
- message = "### SwiftLint found issues\n\n"
90
- message << markdown_issues(warnings, 'Warnings') unless warnings.empty?
91
- message << markdown_issues(errors, 'Errors') unless errors.empty?
92
- markdown message
93
-
94
- # Fail Danger on errors
95
- if fail_on_error && errors.count > 0
96
- fail "Failed due to SwiftLint errors"
97
- end
89
+ message = +"### SwiftLint found issues\n\n"
90
+ message << markdown_issues(warnings, 'Warnings') unless warnings.empty?
91
+ message << markdown_issues(errors, 'Errors') unless errors.empty?
92
+ markdown message
93
+
94
+ # Fail Danger on errors
95
+ if fail_on_error && errors.count.positive?
96
+ raise 'Failed due to SwiftLint errors'
98
97
  end
99
98
  end
100
99
  end
@@ -104,8 +103,8 @@ module Danger
104
103
  # @return [Array] swiftlint issues
105
104
  def run_swiftlint(files, options, additional_swiftlint_args)
106
105
  files
107
- .map { |file| options.merge({path: file})}
108
- .map { |full_options| swiftlint.lint(full_options, additional_swiftlint_args)}
106
+ .map { |file| options.merge(path: file) }
107
+ .map { |full_options| swiftlint.lint(full_options, additional_swiftlint_args) }
109
108
  .reject { |s| s == '' }
110
109
  .map { |s| JSON.parse(s).flatten }
111
110
  .flatten
@@ -115,29 +114,33 @@ module Danger
115
114
  # If files are not provided it will use git modifield and added files
116
115
  #
117
116
  # @return [Array] swift files
118
- def find_swift_files(files=nil, excluded_paths=[], dir_selected)
117
+ def find_swift_files(dir_selected, files = nil, excluded_paths = [])
119
118
  # Assign files to lint
120
- files = files ? Dir.glob(files) : (git.modified_files - git.deleted_files) + git.added_files
119
+ files = if files.nil?
120
+ (git.modified_files - git.deleted_files) + git.added_files
121
+ else
122
+ Dir.glob(files)
123
+ end
121
124
 
122
125
  # Filter files to lint
123
- return files.
126
+ files.
124
127
  # Ensure only swift files are selected
125
128
  select { |file| file.end_with?('.swift') }.
126
129
  # Make sure we don't fail when paths have spaces
127
130
  map { |file| Shellwords.escape(file) }.
128
131
  # Remove dups
129
- uniq.
130
- map { |file| File.expand_path(file) }.
132
+ uniq
133
+ .map { |file| File.expand_path(file) }.
131
134
  # Ensure only files in the selected directory
132
135
  select { |file| file.start_with?(dir_selected) }.
133
136
  # Reject files excluded on configuration
134
- reject { |file|
135
- excluded_paths.any? { |excluded_path|
136
- Find.find(excluded_path).
137
- map { |excluded_file| Shellwords.escape(excluded_file) }.
138
- include?(file)
139
- }
140
- }
137
+ reject do |file|
138
+ excluded_paths.any? do |excluded_path|
139
+ Find.find(excluded_path)
140
+ .map { |excluded_file| Shellwords.escape(excluded_file) }
141
+ .include?(file)
142
+ end
143
+ end
141
144
  end
142
145
 
143
146
  # Parses the configuration file and return the excluded files
@@ -145,25 +148,25 @@ module Danger
145
148
  # @return [Array] list of files excluded
146
149
  def excluded_files_from_config(filepath)
147
150
  config = if filepath
148
- YAML.load_file(filepath)
149
- else
150
- {"excluded" => []}
151
- end
151
+ YAML.load_file(filepath)
152
+ else
153
+ { 'excluded' => [] }
154
+ end
152
155
 
153
156
  excluded_paths = config['excluded'] || []
154
157
 
155
158
  # Extract excluded paths
156
- return excluded_paths.
157
- map { |path| File.join(File.dirname(filepath), path) }.
158
- map { |path| File.expand_path(path) }.
159
- select { |path| File.exists?(path) || Dir.exists?(path) }
159
+ excluded_paths
160
+ .map { |path| File.join(File.dirname(filepath), path) }
161
+ .map { |path| File.expand_path(path) }
162
+ .select { |path| File.exist?(path) || Dir.exist?(path) }
160
163
  end
161
164
 
162
165
  # Create a markdown table from swiftlint issues
163
166
  #
164
167
  # @return [String]
165
- def markdown_issues (results, heading)
166
- message = "#### #{heading}\n\n"
168
+ def markdown_issues(results, heading)
169
+ message = +"#### #{heading}\n\n"
167
170
 
168
171
  message << "File | Line | Reason |\n"
169
172
  message << "| --- | ----- | ----- |\n"
@@ -182,11 +185,11 @@ module Danger
182
185
  # Send inline comment with danger's warn or fail method
183
186
  #
184
187
  # @return [void]
185
- def send_inline_comment (results, method)
188
+ def send_inline_comment(results, method)
186
189
  dir = "#{Dir.pwd}/"
187
190
  results.each do |r|
188
- filename = r['file'].gsub(dir, "")
189
- send(method, r['reason'], file: filename, line: r['line'])
191
+ filename = r['file'].gsub(dir, '')
192
+ send(method, r['reason'], file: filename, line: r['line'])
190
193
  end
191
194
  end
192
195
 
data/lib/version.rb CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DangerSwiftlint
2
- VERSION = "0.10.1".freeze
3
- SWIFTLINT_VERSION = "0.20.1".freeze
4
+ VERSION = '0.10.2'
5
+ SWIFTLINT_VERSION = '0.20.1'
4
6
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../spec_helper', __FILE__)
2
4
 
3
5
  module Danger
@@ -12,9 +14,9 @@ module Danger
12
14
  allow(@swiftlint.git).to receive(:deleted_files).and_return([])
13
15
  end
14
16
 
15
- it "handles swiftlint not being installed" do
16
- allow_any_instance_of(Swiftlint).to receive(:is_installed?).and_return(false)
17
- expect { @swiftlint.lint_files }.to raise_error("swiftlint is not installed")
17
+ it 'handles swiftlint not being installed' do
18
+ allow_any_instance_of(Swiftlint).to receive(:installed?).and_return(false)
19
+ expect { @swiftlint.lint_files }.to raise_error('swiftlint is not installed')
18
20
  end
19
21
 
20
22
  it 'does not markdown an empty message' do
@@ -35,7 +37,7 @@ module Danger
35
37
 
36
38
  describe :lint_files do
37
39
  before do
38
- allow_any_instance_of(Swiftlint).to receive(:is_installed?).and_return(true)
40
+ allow_any_instance_of(Swiftlint).to receive(:installed?).and_return(true)
39
41
  allow(@swiftlint.git).to receive(:added_files).and_return([])
40
42
  allow(@swiftlint.git).to receive(:modified_files).and_return([])
41
43
 
@@ -44,29 +46,29 @@ module Danger
44
46
 
45
47
  it 'accept files as arguments' do
46
48
  expect_any_instance_of(Swiftlint).to receive(:lint)
47
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '')
49
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
48
50
  .and_return(@swiftlint_response)
49
51
 
50
- @swiftlint.lint_files("spec/fixtures/*.swift")
52
+ @swiftlint.lint_files('spec/fixtures/*.swift')
51
53
 
52
54
  output = @swiftlint.status_report[:markdowns].first.to_s
53
- expect(output).to include("SwiftLint found issues")
54
- expect(output).to include("SwiftFile.swift | 13 | Force casts should be avoided.")
55
+ expect(output).to include('SwiftLint found issues')
56
+ expect(output).to include('SwiftFile.swift | 13 | Force casts should be avoided.')
55
57
  end
56
58
 
57
59
  it 'accepts additional cli arguments' do
58
60
  expect_any_instance_of(Swiftlint).to receive(:lint)
59
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '--lenient')
61
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '--lenient')
60
62
  .and_return(@swiftlint_response)
61
63
 
62
- @swiftlint.lint_files("spec/fixtures/*.swift", additional_swiftlint_args: '--lenient')
64
+ @swiftlint.lint_files('spec/fixtures/*.swift', additional_swiftlint_args: '--lenient')
63
65
  end
64
66
 
65
67
  it 'uses git diff when files are not provided' do
66
68
  allow(@swiftlint.git).to receive(:modified_files).and_return(['spec/fixtures/SwiftFile.swift'])
67
69
  allow(@swiftlint.git).to receive(:added_files).and_return([])
68
70
  allow_any_instance_of(Swiftlint).to receive(:lint)
69
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '')
71
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
70
72
  .and_return(@swiftlint_response)
71
73
 
72
74
  @swiftlint.lint_files
@@ -79,29 +81,39 @@ module Danger
79
81
  @swiftlint.directory = 'spec/fixtures/some_dir'
80
82
 
81
83
  allow_any_instance_of(Swiftlint).to receive(:lint)
82
- .with(hash_including(:pwd => File.expand_path(@swiftlint.directory)), '')
84
+ .with(hash_including(pwd: File.expand_path(@swiftlint.directory)), '')
85
+ .and_return(@swiftlint_response)
86
+
87
+ @swiftlint.lint_files(['spec/fixtures/some_dir/SwiftFile.swift'])
88
+
89
+ output = @swiftlint.status_report[:markdowns].first.to_s
90
+ expect(output).to_not be_empty
91
+ end
92
+
93
+ it 'uses escaped pwd when directory is not set' do
94
+ allow_any_instance_of(Swiftlint).to receive(:lint)
95
+ .with(hash_including(pwd: File.expand_path('.')), '')
83
96
  .and_return(@swiftlint_response)
84
97
 
85
- @swiftlint.lint_files(["spec/fixtures/some_dir/SwiftFile.swift"])
98
+ @swiftlint.lint_files(['spec/fixtures/some\ dir/SwiftFile.swift'])
86
99
 
87
100
  output = @swiftlint.status_report[:markdowns].first.to_s
88
101
  expect(output).to_not be_empty
89
-
90
102
  end
91
103
 
92
104
  it 'only lint files specified in custom dir' do
93
105
  @swiftlint.directory = 'spec/fixtures/some_dir'
94
-
106
+
95
107
  allow(@swiftlint.git).to receive(:added_files).and_return([])
96
108
  allow(@swiftlint.git).to receive(:modified_files).and_return([
97
- 'spec/fixtures/some_dir/SwiftFile.swift',
98
- 'spec/fixtures/SwiftFile.swift'
99
- ])
109
+ 'spec/fixtures/some_dir/SwiftFile.swift',
110
+ 'spec/fixtures/SwiftFile.swift'
111
+ ])
100
112
 
101
113
  expect_any_instance_of(Swiftlint).to receive(:lint)
102
- .with(hash_including(:path => File.expand_path('spec/fixtures/some_dir/SwiftFile.swift')), '')
103
- .once
104
- .and_return(@swiftlint_response)
114
+ .with(hash_including(path: File.expand_path('spec/fixtures/some_dir/SwiftFile.swift')), '')
115
+ .once
116
+ .and_return(@swiftlint_response)
105
117
 
106
118
  @swiftlint.lint_files
107
119
  end
@@ -127,13 +139,13 @@ module Danger
127
139
  it 'does not lint files in the excluded paths' do
128
140
  allow(@swiftlint.git).to receive(:added_files).and_return([])
129
141
  allow(@swiftlint.git).to receive(:modified_files).and_return([
130
- 'spec/fixtures/SwiftFile.swift',
131
- 'spec/fixtures/excluded_dir/SwiftFileThatShouldNotBeIncluded.swift',
132
- 'spec/fixtures/excluded_dir/SwiftFile WithEscaped+CharactersThatShouldNotBeIncluded.swift'
133
- ])
142
+ 'spec/fixtures/SwiftFile.swift',
143
+ 'spec/fixtures/excluded_dir/SwiftFileThatShouldNotBeIncluded.swift',
144
+ 'spec/fixtures/excluded_dir/SwiftFile WithEscaped+CharactersThatShouldNotBeIncluded.swift'
145
+ ])
134
146
 
135
147
  expect_any_instance_of(Swiftlint).to receive(:lint)
136
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '')
148
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
137
149
  .once
138
150
  .and_return(@swiftlint_response)
139
151
 
@@ -144,11 +156,11 @@ module Danger
144
156
  it 'does not crash when excluded is nil' do
145
157
  allow(@swiftlint.git).to receive(:added_files).and_return([])
146
158
  allow(@swiftlint.git).to receive(:modified_files).and_return([
147
- 'spec/fixtures/SwiftFile.swift',
148
- ])
159
+ 'spec/fixtures/SwiftFile.swift'
160
+ ])
149
161
 
150
162
  expect_any_instance_of(Swiftlint).to receive(:lint)
151
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '')
163
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
152
164
  .once
153
165
  .and_return(@swiftlint_response)
154
166
 
@@ -159,11 +171,11 @@ module Danger
159
171
  it 'default config is nil, unspecified' do
160
172
  allow(@swiftlint.git).to receive(:added_files).and_return([])
161
173
  allow(@swiftlint.git).to receive(:modified_files).and_return([
162
- 'spec/fixtures/SwiftFile.swift',
163
- ])
174
+ 'spec/fixtures/SwiftFile.swift'
175
+ ])
164
176
 
165
177
  expect_any_instance_of(Swiftlint).to receive(:lint)
166
- .with(hash_including(:config => nil), '')
178
+ .with(hash_including(config: nil), '')
167
179
  .once
168
180
  .and_return(@swiftlint_response)
169
181
 
@@ -173,13 +185,13 @@ module Danger
173
185
  it 'expands default config file (if present) to absolute path' do
174
186
  allow(@swiftlint.git).to receive(:added_files).and_return([])
175
187
  allow(@swiftlint.git).to receive(:modified_files).and_return([
176
- 'spec/fixtures/SwiftFile.swift',
177
- ])
188
+ 'spec/fixtures/SwiftFile.swift'
189
+ ])
178
190
  expect(File).to receive(:file?).and_return(true)
179
191
  expect(YAML).to receive(:load_file).and_return({})
180
192
 
181
193
  expect_any_instance_of(Swiftlint).to receive(:lint)
182
- .with(hash_including(:config => File.expand_path('.swiftlint.yml')), '')
194
+ .with(hash_including(config: File.expand_path('.swiftlint.yml')), '')
183
195
  .once
184
196
  .and_return(@swiftlint_response)
185
197
 
@@ -189,11 +201,11 @@ module Danger
189
201
  it 'expands specified config file to absolute path' do
190
202
  allow(@swiftlint.git).to receive(:added_files).and_return([])
191
203
  allow(@swiftlint.git).to receive(:modified_files).and_return([
192
- 'spec/fixtures/SwiftFile.swift',
193
- ])
204
+ 'spec/fixtures/SwiftFile.swift'
205
+ ])
194
206
 
195
207
  expect_any_instance_of(Swiftlint).to receive(:lint)
196
- .with(hash_including(:config => File.expand_path('spec/fixtures/some_config.yml')), '')
208
+ .with(hash_including(config: File.expand_path('spec/fixtures/some_config.yml')), '')
197
209
  .once
198
210
  .and_return(@swiftlint_response)
199
211
 
@@ -208,15 +220,15 @@ module Danger
208
220
  # they'd result in file not found errors.
209
221
  allow(@swiftlint.git).to receive(:added_files).and_return([])
210
222
  allow(@swiftlint.git).to receive(:modified_files).and_return([
211
- 'spec/fixtures/SwiftFile.swift',
212
- 'spec/fixtures/DeletedFile.swift'
213
- ])
223
+ 'spec/fixtures/SwiftFile.swift',
224
+ 'spec/fixtures/DeletedFile.swift'
225
+ ])
214
226
  allow(@swiftlint.git).to receive(:deleted_files).and_return([
215
- 'spec/fixtures/DeletedFile.swift'
216
- ])
227
+ 'spec/fixtures/DeletedFile.swift'
228
+ ])
217
229
 
218
230
  expect_any_instance_of(Swiftlint).to receive(:lint)
219
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '')
231
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
220
232
  .once
221
233
  .and_return(@swiftlint_response)
222
234
 
@@ -225,10 +237,10 @@ module Danger
225
237
 
226
238
  it 'generates errors instead of markdown when use inline mode' do
227
239
  allow_any_instance_of(Swiftlint).to receive(:lint)
228
- .with(hash_including(:path => File.expand_path('spec/fixtures/SwiftFile.swift')), '')
240
+ .with(hash_including(path: File.expand_path('spec/fixtures/SwiftFile.swift')), '')
229
241
  .and_return(@swiftlint_response)
230
242
 
231
- @swiftlint.lint_files("spec/fixtures/*.swift", inline_mode: true, fail_on_error: false, additional_swiftlint_args: '')
243
+ @swiftlint.lint_files('spec/fixtures/*.swift', inline_mode: true, fail_on_error: false, additional_swiftlint_args: '')
232
244
 
233
245
  status = @swiftlint.status_report
234
246
  expect(status[:errors]).to_not be_empty
data/spec/spec_helper.rb CHANGED
@@ -1,16 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  ROOT = Pathname.new(File.expand_path('../../', __FILE__))
4
- $:.unshift((ROOT + 'lib').to_s)
5
- $:.unshift((ROOT + 'spec').to_s)
6
+ $LOAD_PATH.unshift((ROOT + 'lib').to_s)
7
+ $LOAD_PATH.unshift((ROOT + 'spec').to_s)
6
8
 
7
9
  RSpec.configure do |config|
8
- # Use color in STDOUT
10
+ # Use color in STDOUT
9
11
  config.color = true
10
12
  end
11
13
 
12
14
  RSpec::Matchers.define :including do |x|
13
- match { |actual| actual.include? x }
15
+ match { |actual| actual.include? x }
14
16
  end
15
17
 
16
18
  require 'bundler/setup'
@@ -32,11 +34,11 @@ end
32
34
  # running a PR on TravisCI
33
35
  def testing_env
34
36
  {
35
- "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
36
- "TRAVIS_PULL_REQUEST" => "800",
37
- "TRAVIS_REPO_SLUG" => "artsy/eigen",
38
- "TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
39
- "DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
37
+ 'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
38
+ 'TRAVIS_PULL_REQUEST' => '800',
39
+ 'TRAVIS_REPO_SLUG' => 'artsy/eigen',
40
+ 'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
41
+ 'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
40
42
  }
41
43
  end
42
44
 
@@ -44,4 +46,4 @@ end
44
46
  def testing_dangerfile
45
47
  env = Danger::EnvironmentManager.new(testing_env)
46
48
  Danger::Dangerfile.new(env, testing_ui)
47
- end
49
+ end
@@ -1,31 +1,33 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../spec_helper', __FILE__)
2
4
  require_relative '../ext/swiftlint/swiftlint'
3
5
 
4
6
  describe Swiftlint do
5
7
  let(:swiftlint) { Swiftlint.new }
6
- it 'is_installed? works based on bin/swiftlint file' do
7
- expect(File).to receive(:exist?).with(/bin\/swiftlint/).and_return(true)
8
- expect(swiftlint.is_installed?).to be_truthy
8
+ it 'installed? works based on bin/swiftlint file' do
9
+ expect(File).to receive(:exist?).with(%r{/bin\/swiftlint}).and_return(true)
10
+ expect(swiftlint.installed?).to be_truthy
9
11
 
10
- expect(File).to receive(:exist?).with(/bin\/swiftlint/).and_return(false)
11
- expect(swiftlint.is_installed?).to be_falsy
12
+ expect(File).to receive(:exist?).with(%r{bin\/swiftlint}).and_return(false)
13
+ expect(swiftlint.installed?).to be_falsy
12
14
  end
13
15
 
14
16
  context 'with binary_path' do
15
17
  let(:binary_path) { '/path/to/swiftlint' }
16
18
  let(:swiftlint) { Swiftlint.new(binary_path) }
17
- it 'is_installed? works based on specific path' do
19
+ it 'installed? works based on specific path' do
18
20
  expect(File).to receive(:exist?).with(binary_path).and_return(true)
19
- expect(swiftlint.is_installed?).to be_truthy
21
+ expect(swiftlint.installed?).to be_truthy
20
22
 
21
23
  expect(File).to receive(:exist?).with(binary_path).and_return(false)
22
- expect(swiftlint.is_installed?).to be_falsy
24
+ expect(swiftlint.installed?).to be_falsy
23
25
  end
24
26
  end
25
27
 
26
28
  it 'runs lint by default with options being optional' do
27
29
  expect(swiftlint).to receive(:`).with(including('swiftlint lint'))
28
- swiftlint.run()
30
+ swiftlint.run
29
31
  end
30
32
 
31
33
  it 'runs accepting symbolized options' do
@@ -36,8 +38,6 @@ describe Swiftlint do
36
38
  '',
37
39
  use_stdin: false,
38
40
  cache_path: '/path',
39
- enable_all_rules: true
40
- )
41
+ enable_all_rules: true)
41
42
  end
42
43
  end
43
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-swiftlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-10-07 00:00:00.000000000 Z
15
+ date: 2017-10-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: danger
@@ -153,28 +153,12 @@ extensions:
153
153
  - ext/swiftlint/Rakefile
154
154
  extra_rdoc_files: []
155
155
  files:
156
- - ".gitignore"
157
- - ".ruby-version"
158
- - Changelog.md
159
- - Gemfile
160
- - Gemfile.lock
161
- - Guardfile
162
- - LICENSE
163
- - README.md
164
- - Rakefile
165
156
  - bin/danger-swiftlint
166
- - danger-swiftlint.gemspec
167
157
  - ext/swiftlint/Rakefile
168
158
  - ext/swiftlint/swiftlint.rb
169
159
  - lib/danger_plugin.rb
170
160
  - lib/version.rb
171
161
  - spec/danger_plugin_spec.rb
172
- - spec/fixtures/SwiftFile.swift
173
- - spec/fixtures/empty_excluded.yml
174
- - spec/fixtures/excluded_dir/SwiftFile WithEscaped+CharactersThatShouldNotBeIncluded.swift
175
- - spec/fixtures/excluded_dir/SwiftFileThatShouldNotBeIncluded.swift
176
- - spec/fixtures/some_config.yml
177
- - spec/fixtures/some_dir/SwiftFile.swift
178
162
  - spec/spec_helper.rb
179
163
  - spec/swiftlint_spec.rb
180
164
  homepage: https://github.com/ashfurrow/danger-swiftlint
@@ -203,11 +187,5 @@ specification_version: 4
203
187
  summary: A Danger plugin for linting Swift with SwiftLint.
204
188
  test_files:
205
189
  - spec/danger_plugin_spec.rb
206
- - spec/fixtures/SwiftFile.swift
207
- - spec/fixtures/empty_excluded.yml
208
- - spec/fixtures/excluded_dir/SwiftFile WithEscaped+CharactersThatShouldNotBeIncluded.swift
209
- - spec/fixtures/excluded_dir/SwiftFileThatShouldNotBeIncluded.swift
210
- - spec/fixtures/some_config.yml
211
- - spec/fixtures/some_dir/SwiftFile.swift
212
190
  - spec/spec_helper.rb
213
191
  - spec/swiftlint_spec.rb
data/.gitignore DELETED
@@ -1,53 +0,0 @@
1
- # Swiftlint extension binary but keep the bin folder
2
- ext/swiftlint/bin
3
-
4
- *.gem
5
- *.rbc
6
- /.config
7
- /coverage/
8
- /InstalledFiles
9
- /pkg/
10
- /spec/reports/
11
- /spec/examples.txt
12
- /test/tmp/
13
- /test/version_tmp/
14
- /tmp/
15
-
16
- # Used by dotenv library to load environment variables.
17
- # .env
18
-
19
- ## Specific to RubyMotion:
20
- .dat*
21
- .repl_history
22
- build/
23
- *.bridgesupport
24
- build-iPhoneOS/
25
- build-iPhoneSimulator/
26
-
27
- ## Specific to RubyMotion (use of CocoaPods):
28
- #
29
- # We recommend against adding the Pods directory to your .gitignore. However
30
- # you should judge for yourself, the pros and cons are mentioned at:
31
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
- #
33
- # vendor/Pods/
34
-
35
- ## Documentation cache and generated files:
36
- /.yardoc/
37
- /_yardoc/
38
- /doc/
39
- /rdoc/
40
-
41
- ## Environment normalization:
42
- /.bundle/
43
- /vendor/bundle
44
- /lib/bundler/man/
45
-
46
- # for a library or gem, you might want to ignore these files since the code is
47
- # intended to run in multiple environments; otherwise, check them in:
48
- # Gemfile.lock
49
- # .ruby-version
50
- # .ruby-gemset
51
-
52
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
- .rvmrc
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.4.1
data/Changelog.md DELETED
@@ -1,74 +0,0 @@
1
- # Changelog
2
-
3
- ## Current Master
4
-
5
- - Nothing yet!
6
-
7
- ## 0.10.1
8
-
9
- - Expands config paths to be absolute when passed to `swiftlint`.
10
- - Adds verbose logging option.
11
-
12
- ## 0.10.0
13
-
14
- - Adds `additional_swiftlint_args` option. See[#57](https://github.com/ashfurrow/danger-swiftlint/issues/57).
15
-
16
- ## 0.9.0
17
-
18
- - Fixes linting of superfluous files in subdirectories. See [#53](https://github.com/ashfurrow/danger-swiftlint/pull/53).
19
-
20
- ## 0.8.0
21
-
22
- - Fixes Directory not found error. See [#51](https://github.com/ashfurrow/danger-swiftlint/pull/51).
23
- - Fixes issue with missing `.swiftlint.yml` file. See [#52](https://github.com/ashfurrow/danger-swiftlint/pull/52).
24
- - Adds `fail_on_error` option. See [#55](https://github.com/ashfurrow/danger-swiftlint/pull/55)
25
-
26
- ## 0.7.0
27
-
28
- - Bump managed SwiftLint version to 0.20.1
29
-
30
- ## 0.6.0
31
-
32
- - Fixes problem with differing swiftlint paths. See [#44](https://github.com/ashfurrow/danger-swiftlint/issues/44).
33
-
34
- ## 0.5.1
35
-
36
- - Fixed excluded files containing characters that need escaping. See [#40](https://github.com/ashfurrow/danger-swiftlint/pull/40).
37
-
38
- ## 0.5.0
39
-
40
- - Bump managed SwiftLint version to 0.18.1
41
-
42
- ## 0.4.1
43
-
44
- - Fixes deleted files being added to the list of files to lint. See [#34](https://github.com/ashfurrow/danger-swiftlint/pull/34).
45
-
46
- ## 0.4.0
47
-
48
- - Support for inline comments. See [#29](https://github.com/ashfurrow/danger-swiftlint/issues/28)
49
-
50
- - Adds SwiftLint installation as part of the gem install process, should make
51
- it easier to track which upstream fixes should or shouldn't be done by
52
- danger-swiftlint. See [#25](https://github.com/ashfurrow/danger-swiftlint/issues/25)
53
-
54
- - Add `danger-swiftlint` CLI, with `swiftlint_version` command to print the version of the SwiftLint binary installed by the plugin. See [#32](https://github.com/ashfurrow/danger-swiftlint/pull/32)
55
-
56
- ## 0.3.0
57
-
58
- - Adds selective linting, now SwiftLint will only run on the PR added and modified files. See [#23](https://github.com/ashfurrow/danger-swiftlint/pull/23)
59
-
60
- ## 0.2.1
61
-
62
- - Adds support for specifying a directory in which to run SwiftLint. See [#19](https://github.com/ashfurrow/danger-swiftlint/pull/19).
63
-
64
- ## 0.1.2
65
-
66
- - Adds support for files with spaces in their names. See [#9](https://github.com/ashfurrow/danger-swiftlint/issues/9).
67
-
68
- ## 0.1.1
69
-
70
- - Fixes double-escaped newline characters. See [#11](https://github.com/ashfurrow/danger-swiftlint/issues/11).
71
-
72
- ## 0.1.0
73
-
74
- - Initial release.
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'mocha'
7
- gem 'bacon'
8
- gem 'mocha-on-bacon'
9
- gem 'prettybacon'
10
- end
data/Gemfile.lock DELETED
@@ -1,130 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- danger-swiftlint (0.10.0)
5
- danger
6
- rake (> 10)
7
- thor (~> 0.19)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- addressable (2.5.2)
13
- public_suffix (>= 2.0.2, < 4.0)
14
- bacon (1.2.0)
15
- claide (1.0.2)
16
- claide-plugins (0.9.2)
17
- cork
18
- nap
19
- open4 (~> 1.3)
20
- coderay (1.1.1)
21
- colored2 (3.1.2)
22
- cork (0.3.0)
23
- colored2 (~> 3.1)
24
- danger (5.5.3)
25
- claide (~> 1.0)
26
- claide-plugins (>= 0.9.2)
27
- colored2 (~> 3.1)
28
- cork (~> 0.1)
29
- faraday (~> 0.9)
30
- faraday-http-cache (~> 1.0)
31
- git (~> 1)
32
- kramdown (~> 1.5)
33
- no_proxy_fix
34
- octokit (~> 4.7)
35
- terminal-table (~> 1)
36
- diff-lcs (1.3)
37
- faraday (0.13.1)
38
- multipart-post (>= 1.2, < 3)
39
- faraday-http-cache (1.3.1)
40
- faraday (~> 0.8)
41
- ffi (1.9.18)
42
- formatador (0.2.5)
43
- git (1.3.0)
44
- guard (2.14.1)
45
- formatador (>= 0.2.4)
46
- listen (>= 2.7, < 4.0)
47
- lumberjack (~> 1.0)
48
- nenv (~> 0.1)
49
- notiffany (~> 0.0)
50
- pry (>= 0.9.12)
51
- shellany (~> 0.0)
52
- thor (>= 0.18.1)
53
- guard-compat (1.2.1)
54
- guard-rspec (4.7.3)
55
- guard (~> 2.1)
56
- guard-compat (~> 1.1)
57
- rspec (>= 2.99.0, < 4.0)
58
- kramdown (1.15.0)
59
- listen (3.0.7)
60
- rb-fsevent (>= 0.9.3)
61
- rb-inotify (>= 0.9.7)
62
- lumberjack (1.0.11)
63
- metaclass (0.0.4)
64
- method_source (0.8.2)
65
- mocha (1.2.1)
66
- metaclass (~> 0.0.1)
67
- mocha-on-bacon (0.2.3)
68
- mocha (>= 0.13.0)
69
- multipart-post (2.0.0)
70
- nap (1.1.0)
71
- nenv (0.3.0)
72
- no_proxy_fix (0.1.1)
73
- notiffany (0.1.1)
74
- nenv (~> 0.1)
75
- shellany (~> 0.0)
76
- octokit (4.7.0)
77
- sawyer (~> 0.8.0, >= 0.5.3)
78
- open4 (1.3.4)
79
- prettybacon (0.0.2)
80
- bacon (~> 1.2)
81
- pry (0.10.4)
82
- coderay (~> 1.1.0)
83
- method_source (~> 0.8.1)
84
- slop (~> 3.4)
85
- public_suffix (3.0.0)
86
- rake (12.1.0)
87
- rb-fsevent (0.9.8)
88
- rb-inotify (0.9.8)
89
- ffi (>= 0.5.0)
90
- rspec (3.5.0)
91
- rspec-core (~> 3.5.0)
92
- rspec-expectations (~> 3.5.0)
93
- rspec-mocks (~> 3.5.0)
94
- rspec-core (3.5.4)
95
- rspec-support (~> 3.5.0)
96
- rspec-expectations (3.5.0)
97
- diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.5.0)
99
- rspec-mocks (3.5.0)
100
- diff-lcs (>= 1.2.0, < 2.0)
101
- rspec-support (~> 3.5.0)
102
- rspec-support (3.5.0)
103
- sawyer (0.8.1)
104
- addressable (>= 2.3.5, < 2.6)
105
- faraday (~> 0.8, < 1.0)
106
- shellany (0.0.1)
107
- slop (3.6.0)
108
- terminal-table (1.8.0)
109
- unicode-display_width (~> 1.1, >= 1.1.1)
110
- thor (0.19.4)
111
- unicode-display_width (1.3.0)
112
-
113
- PLATFORMS
114
- ruby
115
-
116
- DEPENDENCIES
117
- bacon
118
- bundler (~> 1.3)
119
- danger-swiftlint!
120
- guard (~> 2.14)
121
- guard-rspec (~> 4.7)
122
- listen (= 3.0.7)
123
- mocha
124
- mocha-on-bacon
125
- prettybacon
126
- pry
127
- rspec (~> 3.4)
128
-
129
- BUNDLED WITH
130
- 1.15.1
data/Guardfile DELETED
@@ -1,21 +0,0 @@
1
- # A guardfile for making Danger Plugins
2
- # For more info see https://github.com/guard/guard#readme
3
-
4
- # To run, use `bundle exec guard`.
5
-
6
- guard :rspec, cmd: "bundle exec rspec" do
7
- require "guard/rspec/dsl"
8
- dsl = Guard::RSpec::Dsl.new(self)
9
-
10
- # Feel free to open issues for suggestions and improvements
11
-
12
- # RSpec files
13
- rspec = dsl.rspec
14
- watch(rspec.spec_helper) { rspec.spec_dir }
15
- watch(rspec.spec_support) { rspec.spec_dir }
16
- watch(rspec.spec_files)
17
-
18
- # Ruby files
19
- ruby = dsl.ruby
20
- dsl.watch_spec_files_for(ruby.lib_files)
21
- end
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Ash Furrow
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/README.md DELETED
@@ -1,61 +0,0 @@
1
- [![CircleCI](https://circleci.com/gh/ashfurrow/danger-swiftlint.svg?style=svg)](https://circleci.com/gh/ashfurrow/danger-swiftlint)
2
-
3
- # Danger SwiftLint
4
-
5
- A [Danger](https://github.com/danger/danger) plugin for [SwiftLint](https://github.com/realm/SwiftLint) that runs on macOS.
6
-
7
- ## Installation
8
-
9
- Add this line to your Gemfile:
10
-
11
- ```rb
12
- gem 'danger-swiftlint'
13
- ```
14
-
15
- SwiftLint also needs to be installed before you run Danger, which you can do [via Homebrew](https://github.com/realm/SwiftLint#installation) or a [Brewfile](https://github.com/Homebrew/homebrew-bundle).
16
-
17
- ## Usage
18
-
19
- The easiest way to use is just add this to your Dangerfile:
20
-
21
- ```rb
22
- swiftlint.lint_files
23
- ```
24
-
25
- That's going to lint all your Swift files. It would be better to only lint the changed or added ones, which is complicated due. Check out [this issue](https://github.com/ashfurrow/danger-swiftlint/issues/16) for more details.
26
-
27
- ```rb
28
- swiftlint.config_file = '.swiftlint.yml'
29
- swiftlint.binary_path = '/path/to/swiftlint'
30
- swiftlint.lint_files
31
- ```
32
-
33
- If you want the lint result shows in diff instead of comment, you can use `inline_mode` option. Violations that out of the diff will show in danger's fail or warn section.
34
-
35
- ```rb
36
- swiftlint.lint_files inline_mode: true
37
- ```
38
-
39
- If you want lint errors to fail Danger, you can use `fail_on_error` option.
40
-
41
- ```rb
42
- swiftlint.lint_files fail_on_error: true
43
- ```
44
-
45
- If you need to specify options for `swiftlint` that can _only_ be specified by command line arguments, use the `additional_swiftlint_args` option.
46
-
47
- ```rb
48
- swiftlint.lint_files additional_swiftlint_args: '--lenient'
49
- ```
50
-
51
- You can use the `SWIFTLINT_VERSION` environment variable to override the default version installed via the `rake install` task.
52
-
53
- Finally, if something's not working correctly, you can debug this plugin by using setting `swiftlint.verbose = true`.
54
-
55
- ## Attribution
56
-
57
- Original structure, sequence, and organization of repo taken from [danger-prose](https://github.com/dbgrandi/danger-prose) by [David Grandinetti](https://github.com/dbgrandi/).
58
-
59
- ## License
60
-
61
- MIT
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- import 'ext/swiftlint/Rakefile'
2
- require 'bundler/gem_tasks'
3
- require "rspec/core/rake_task"
4
-
5
- RSpec::Core::RakeTask.new(:spec)
6
-
7
- task default: :spec
8
-
9
- task :spec do
10
- Rake::Task['specs'].invoke
11
- end
12
-
13
- task :default => :spec
14
-
@@ -1,45 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'danger-swiftlint'
8
- spec.version = DangerSwiftlint::VERSION
9
- spec.authors = ['Ash Furrow', 'David Grandinetti', 'Orta Therox', 'Thiago Felix', 'Giovanni Lodi']
10
- spec.email = ['ash@ashfurrow.com', 'dbgrandi@gmail.com', 'orta.therox@gmail.com', 'thiago@thiagofelix.com', 'gio@mokacoding.com']
11
- spec.description = %q{A Danger plugin for linting Swift with SwiftLint.}
12
- spec.summary = %q{A Danger plugin for linting Swift with SwiftLint.}
13
- spec.homepage = 'https://github.com/ashfurrow/danger-swiftlint'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ['lib']
19
- spec.extensions = %w(ext/swiftlint/Rakefile)
20
- spec.executables = ['danger-swiftlint']
21
-
22
- spec.add_dependency 'danger'
23
- spec.add_dependency 'thor', '~> 0.19'
24
- spec.add_dependency 'rake', '> 10'
25
-
26
- # General ruby development
27
- spec.add_development_dependency 'bundler', '~> 1.3'
28
-
29
- # Testing support
30
- spec.add_development_dependency "rspec", '~> 3.4'
31
-
32
- # Makes testing easy via `bundle exec guard`
33
- spec.add_development_dependency "guard", '~> 2.14'
34
- spec.add_development_dependency "guard-rspec", '~> 4.7'
35
-
36
- # If you want to work on older builds of ruby
37
- spec.add_development_dependency "listen", '3.0.7'
38
-
39
- # This gives you the chance to run a REPL inside your test
40
- # via
41
- # binding.pry
42
- # This will stop test execution and let you inspect the results
43
- spec.add_development_dependency "pry"
44
-
45
- end
@@ -1 +0,0 @@
1
- // This file intentional left blank-ish.
@@ -1,7 +0,0 @@
1
- disabled_rules:
2
- - todo
3
-
4
- included:
5
- - an/included/folder
6
-
7
- excluded:
@@ -1 +0,0 @@
1
- // This file intentionally left blank-ish.
@@ -1 +0,0 @@
1
- // This file intentionally left blank-ish.
@@ -1,8 +0,0 @@
1
- disabled_rules:
2
- - todo
3
-
4
- included:
5
- - an/included/folder
6
-
7
- excluded:
8
- - excluded_dir
@@ -1 +0,0 @@
1
- // This file intentional left blank-ish.