danger-clorox 0.0.1 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99c9aa689fb59ed8d38855f1cf54c693e67b3687
4
- data.tar.gz: ad581855f505ec8341b292cf47ec8451e482a620
3
+ metadata.gz: 6b674b32946188d77a7316cc4effc59201f1c487
4
+ data.tar.gz: d41d4a774ea2a346f5608ef6728d7fd602217ed1
5
5
  SHA512:
6
- metadata.gz: a16eb5f79c13def553f4e2b973f59903f318be85de34e59c379bbd1760dcb5f3351933cf2178230387f4134dccb2c21662f48c2bed10cb10ab0d3e4bb91bc521
7
- data.tar.gz: 56c2ec0c04c50c484a8bbac5ee03acb02685c23ee334c1e38ae17588a3bc57b491fb7fd9eefb2be9a4ebb99e1e5aea33a18fb2246a9ed236ec08bea40e3b2369
6
+ metadata.gz: 4e169b4d61f39882461f8320cf4c8cc911f1e33709d0582384610fea7e338d4f337f1919b9790e9234e83bf1d15d10b7949ca8599b1f6af4d9f99a3d177b59ea
7
+ data.tar.gz: 8bcd4aebca1eca8c72acc5baac6562334a22b7b05d713eff6c58a51f4d83ab78ea6a5469b2d72106360a19cacef4b7b0fd92d1998c15ddef25513f3b743b3722
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.swp
1
2
  *.gem
2
3
  *.rbc
3
4
  /.config
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-swiftlint (0.0.1)
4
+ danger-clorox (1.0.0)
5
5
  danger
6
6
 
7
7
  GEM
@@ -10,25 +10,37 @@ GEM
10
10
  addressable (2.4.0)
11
11
  bacon (1.2.0)
12
12
  claide (1.0.0)
13
+ claide-plugins (0.9.1)
14
+ cork
15
+ nap
16
+ open4 (~> 1.3)
13
17
  coderay (1.1.1)
14
18
  colored (1.2)
15
- cork (0.1.0)
19
+ cork (0.2.0)
16
20
  colored (~> 1.2)
17
- danger (0.8.4)
21
+ danger (3.1.0)
18
22
  claide (~> 1.0)
23
+ claide-plugins (> 0.9.0)
19
24
  colored (~> 1.2)
20
25
  cork (~> 0.1)
21
- faraday (~> 0)
26
+ faraday (~> 0.9)
27
+ faraday-http-cache (~> 1.0)
22
28
  git (~> 1)
29
+ gitlab (~> 3.7.0)
30
+ kramdown (~> 1.5)
23
31
  octokit (~> 4.2)
24
- redcarpet (~> 3.3)
25
32
  terminal-table (~> 1)
26
33
  diff-lcs (1.2.5)
27
34
  faraday (0.9.2)
28
35
  multipart-post (>= 1.2, < 3)
36
+ faraday-http-cache (1.3.1)
37
+ faraday (~> 0.8)
29
38
  ffi (1.9.10)
30
39
  formatador (0.2.5)
31
40
  git (1.3.0)
41
+ gitlab (3.7.0)
42
+ httparty (~> 0.13.0)
43
+ terminal-table
32
44
  guard (2.14.0)
33
45
  formatador (>= 0.2.4)
34
46
  listen (>= 2.7, < 4.0)
@@ -43,6 +55,11 @@ GEM
43
55
  guard (~> 2.1)
44
56
  guard-compat (~> 1.1)
45
57
  rspec (>= 2.99.0, < 4.0)
58
+ httparty (0.13.7)
59
+ json (~> 1.8)
60
+ multi_xml (>= 0.5.2)
61
+ json (1.8.3)
62
+ kramdown (1.12.0)
46
63
  listen (3.0.7)
47
64
  rb-fsevent (>= 0.9.3)
48
65
  rb-inotify (>= 0.9.7)
@@ -53,13 +70,16 @@ GEM
53
70
  metaclass (~> 0.0.1)
54
71
  mocha-on-bacon (0.2.2)
55
72
  mocha (>= 0.13.0)
73
+ multi_xml (0.5.5)
56
74
  multipart-post (2.0.0)
75
+ nap (1.1.0)
57
76
  nenv (0.3.0)
58
77
  notiffany (0.1.0)
59
78
  nenv (~> 0.1)
60
79
  shellany (~> 0.0)
61
80
  octokit (4.3.0)
62
81
  sawyer (~> 0.7.0, >= 0.5.3)
82
+ open4 (1.3.4)
63
83
  prettybacon (0.0.2)
64
84
  bacon (~> 1.2)
65
85
  pry (0.10.3)
@@ -70,7 +90,6 @@ GEM
70
90
  rb-fsevent (0.9.7)
71
91
  rb-inotify (0.9.7)
72
92
  ffi (>= 0.5.0)
73
- redcarpet (3.3.4)
74
93
  rspec (3.5.0)
75
94
  rspec-core (~> 3.5.0)
76
95
  rspec-expectations (~> 3.5.0)
@@ -89,8 +108,10 @@ GEM
89
108
  faraday (~> 0.8, < 0.10)
90
109
  shellany (0.0.1)
91
110
  slop (3.6.0)
92
- terminal-table (1.6.0)
111
+ terminal-table (1.7.0)
112
+ unicode-display_width (~> 1.1)
93
113
  thor (0.19.1)
114
+ unicode-display_width (1.1.0)
94
115
 
95
116
  PLATFORMS
96
117
  ruby
@@ -98,7 +119,7 @@ PLATFORMS
98
119
  DEPENDENCIES
99
120
  bacon
100
121
  bundler (~> 1.3)
101
- danger-swiftlint!
122
+ danger-clorox!
102
123
  guard (~> 2.14)
103
124
  guard-rspec (~> 4.7)
104
125
  listen (= 3.0.7)
@@ -3,15 +3,15 @@ module Danger
3
3
 
4
4
  class DangerClorox < Plugin
5
5
 
6
+ # Allows you to specify a directory from where clorox will be run.
7
+ attr_accessor :directory
8
+
6
9
  # Checks presence of file header comments. Will fail if `clorox` cannot be installed correctly.
7
10
  # Generates a `markdown` list of dirty Objective-C and Swift files
8
11
  #
9
- # @param [String] files
10
- # A globbed string which should return the files that you want to check, defaults to nil.
11
- # if nil, modified and added files from the diff will be used.
12
12
  # @return [void]
13
13
  #
14
- def check_files(files=nil)
14
+ def check_files
15
15
  # Installs clorox if needed
16
16
  system "pip install --target /tmp/danger_clorox clorox" unless clorox_installed?
17
17
 
@@ -21,17 +21,21 @@ module Danger
21
21
  return
22
22
  end
23
23
 
24
- # Either use files provided, or use the modified + added
25
- files = files ? Dir.glob(files) : (git.modified_files + git.added_files).uniq
24
+ clorox_command = "python /tmp/danger_clorox/clorox/clorox.py "
25
+ clorox_command += "--path #{directory ? directory : '.'} "
26
+ clorox_command += "--inspection "
27
+ clorox_command += "--report json"
26
28
 
27
29
  require 'json'
28
- result = JSON.parse(`python /tmp/danger_clorox/clorox/clorox.py -p #{files.join(" ")} -i -r json`)
30
+ result_json = JSON.parse(`(#{clorox_command})`)
29
31
 
30
32
  message = ''
31
- if result['status'] == 'dirty'
33
+ if result_json['status'] == 'dirty'
32
34
  message = "### Clorox has found issues\n"
33
35
  message << "Please, remove the header from the files below (those comments on the top of your file):\n\n"
34
- message << parse_results(result['files'])
36
+ result_json['files'].each do |r|
37
+ message << "- #{r}\n"
38
+ end
35
39
  markdown message
36
40
  end
37
41
  end
@@ -1,3 +1,3 @@
1
1
  module DangerClorox
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-clorox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Barbosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-14 00:00:00.000000000 Z
11
+ date: 2016-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger