danger-static_analyzer_comments 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ce7ad11872af2cc93486068c15ec7b9f4cde3d5
4
+ data.tar.gz: 45c3abedd75501ab6ca3a07ec8f2875b25f5032d
5
+ SHA512:
6
+ metadata.gz: a603b0877bfe0a5f0e018edf7720f410d600e0ce262049da373408875eb44b9caedd205a2ac623569dc5f82c2e2358fa385f1427023b53078d6ac98b66342531
7
+ data.tar.gz: edb94a98543bc9d4e41207acda0dc8689a53035ac3d3dff14597bd6b8fd33a8f7c44a64c2da2db0be9a49086e95f59de5489daaf8da93067f09002a29e30001a
data/.idea/misc.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="false" project-jdk-name="ruby-2.3.3-p222-new" project-jdk-type="RUBY_SDK">
4
+ <output url="file://$PROJECT_DIR$/out" />
5
+ </component>
6
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/danger-static_analyzer_comments.iml" filepath="$PROJECT_DIR$/danger-static_analyzer_comments.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,143 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-static_analyzer_comments (0.0.1)
5
+ danger-plugin-api (~> 1.0)
6
+ oga
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
+ ansi (1.5.0)
14
+ ast (2.4.0)
15
+ claide (1.0.2)
16
+ claide-plugins (0.9.2)
17
+ cork
18
+ nap
19
+ open4 (~> 1.3)
20
+ coderay (1.1.2)
21
+ colored2 (3.1.2)
22
+ cork (0.3.0)
23
+ colored2 (~> 3.1)
24
+ danger (5.10.1)
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.5)
32
+ kramdown (~> 1.5)
33
+ no_proxy_fix
34
+ octokit (~> 4.7)
35
+ terminal-table (~> 1)
36
+ danger-plugin-api (1.0.0)
37
+ danger (> 2.0)
38
+ diff-lcs (1.3)
39
+ faraday (0.15.4)
40
+ multipart-post (>= 1.2, < 3)
41
+ faraday-http-cache (1.3.1)
42
+ faraday (~> 0.8)
43
+ ffi (1.9.18)
44
+ formatador (0.2.5)
45
+ git (1.5.0)
46
+ guard (2.14.1)
47
+ formatador (>= 0.2.4)
48
+ listen (>= 2.7, < 4.0)
49
+ lumberjack (~> 1.0)
50
+ nenv (~> 0.1)
51
+ notiffany (~> 0.0)
52
+ pry (>= 0.9.12)
53
+ shellany (~> 0.0)
54
+ thor (>= 0.18.1)
55
+ guard-compat (1.2.1)
56
+ guard-rspec (4.7.3)
57
+ guard (~> 2.1)
58
+ guard-compat (~> 1.1)
59
+ rspec (>= 2.99.0, < 4.0)
60
+ kramdown (1.17.0)
61
+ listen (3.0.7)
62
+ rb-fsevent (>= 0.9.3)
63
+ rb-inotify (>= 0.9.7)
64
+ lumberjack (1.0.12)
65
+ method_source (0.9.0)
66
+ multipart-post (2.0.0)
67
+ nap (1.1.0)
68
+ nenv (0.3.0)
69
+ no_proxy_fix (0.1.2)
70
+ notiffany (0.1.1)
71
+ nenv (~> 0.1)
72
+ shellany (~> 0.0)
73
+ octokit (4.13.0)
74
+ sawyer (~> 0.8.0, >= 0.5.3)
75
+ oga (2.15)
76
+ ast
77
+ ruby-ll (~> 2.1)
78
+ open4 (1.3.4)
79
+ parallel (1.12.1)
80
+ parser (2.4.0.2)
81
+ ast (~> 2.3)
82
+ powerpack (0.1.1)
83
+ pry (0.11.3)
84
+ coderay (~> 1.1.0)
85
+ method_source (~> 0.9.0)
86
+ public_suffix (3.0.3)
87
+ rainbow (2.2.2)
88
+ rake
89
+ rake (10.5.0)
90
+ rb-fsevent (0.10.2)
91
+ rb-inotify (0.9.10)
92
+ ffi (>= 0.5.0, < 2)
93
+ rspec (3.7.0)
94
+ rspec-core (~> 3.7.0)
95
+ rspec-expectations (~> 3.7.0)
96
+ rspec-mocks (~> 3.7.0)
97
+ rspec-core (3.7.0)
98
+ rspec-support (~> 3.7.0)
99
+ rspec-expectations (3.7.0)
100
+ diff-lcs (>= 1.2.0, < 2.0)
101
+ rspec-support (~> 3.7.0)
102
+ rspec-mocks (3.7.0)
103
+ diff-lcs (>= 1.2.0, < 2.0)
104
+ rspec-support (~> 3.7.0)
105
+ rspec-support (3.7.0)
106
+ rubocop (0.49.1)
107
+ parallel (~> 1.10)
108
+ parser (>= 2.3.3.1, < 3.0)
109
+ powerpack (~> 0.1)
110
+ rainbow (>= 1.99.1, < 3.0)
111
+ ruby-progressbar (~> 1.7)
112
+ unicode-display_width (~> 1.0, >= 1.0.1)
113
+ ruby-ll (2.1.2)
114
+ ansi
115
+ ast
116
+ ruby-progressbar (1.9.0)
117
+ sawyer (0.8.1)
118
+ addressable (>= 2.3.5, < 2.6)
119
+ faraday (~> 0.8, < 1.0)
120
+ shellany (0.0.1)
121
+ terminal-table (1.8.0)
122
+ unicode-display_width (~> 1.1, >= 1.1.1)
123
+ thor (0.20.0)
124
+ unicode-display_width (1.4.0)
125
+ yard (0.9.12)
126
+
127
+ PLATFORMS
128
+ ruby
129
+
130
+ DEPENDENCIES
131
+ bundler (~> 1.3)
132
+ danger-static_analyzer_comments!
133
+ guard (~> 2.14)
134
+ guard-rspec (~> 4.7)
135
+ listen (= 3.0.7)
136
+ pry
137
+ rake (~> 10.0)
138
+ rspec (~> 3.4)
139
+ rubocop (~> 0.49.0)
140
+ yard (~> 0.9.11)
141
+
142
+ BUNDLED WITH
143
+ 1.16.4
data/Guardfile ADDED
@@ -0,0 +1,19 @@
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
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ This project is licensed under the MIT license.
2
+
3
+ Copyright (c) 2014 Boris Bügling <boris@buegling.com> and CocoaPods Dev Team
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
13
+ all 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
21
+ THE SOFTWARE.
Binary file
@@ -0,0 +1,22 @@
1
+ Copyright (c) ${YEAR} ${USER_NAME} <${USER_EMAIL}>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/PLUGIN_README.md ADDED
@@ -0,0 +1,20 @@
1
+ # ${PLUGIN_NAME}
2
+
3
+ A description of ${PLUGIN_NAME}.
4
+
5
+ ## Installation
6
+
7
+ $ gem install ${PLUGIN_NAME}
8
+
9
+ ## Usage
10
+
11
+ Methods and attributes from this plugin are available in
12
+ your `Dangerfile` under the `${PLUGIN_FILE}` namespace.
13
+
14
+ ## Development
15
+
16
+ 1. Clone this repo
17
+ 2. Run `bundle install` to setup dependencies.
18
+ 3. Run `bundle exec rake spec` to run the tests.
19
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
20
+ 5. Make your changes.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:specs)
6
+
7
+ task default: :specs
8
+
9
+ task :spec do
10
+ Rake::Task['specs'].invoke
11
+ Rake::Task['rubocop'].invoke
12
+ Rake::Task['spec_docs'].invoke
13
+ end
14
+
15
+ desc 'Run RuboCop on the lib/specs directory'
16
+ RuboCop::RakeTask.new(:rubocop) do |task|
17
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
18
+ end
19
+
20
+ desc 'Ensure that the plugin passes `danger plugins lint`'
21
+ task :spec_docs do
22
+ sh 'bundle exec danger plugins lint'
23
+ end
data/configure ADDED
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ module Pod
4
+ class TemplateConfigurator
5
+
6
+ attr_reader :plugin_file
7
+ attr_reader :plugin_name
8
+
9
+ def initialize(plugin_name)
10
+ unless plugin_name
11
+ puts "Please specify a plugin name on the command line."
12
+ exit
13
+ end
14
+
15
+ @plugin_file = plugin_name.split("-").last
16
+ @plugin_name = plugin_name
17
+ end
18
+
19
+ def run
20
+ unless plugin_name =~ /danger-.+/
21
+ puts "Plugin name needs to be of the form 'danger-*'."
22
+ exit
23
+ end
24
+
25
+ if plugin_name.count("-") > 1
26
+ puts "Plugin name should have one '-', and then '_'s to separate words in your plugin name"
27
+ puts "See http://guides.rubygems.org/name-your-gem/ for more info"
28
+ exit
29
+ end
30
+
31
+ puts "Configuring #{plugin_name}"
32
+ print_info
33
+ clean_template_files
34
+ replace_variables_in_files
35
+ rename_template_files
36
+ reinitialize_git_repo
37
+ end
38
+
39
+ #----------------------------------------#
40
+
41
+ def print_info
42
+ puts "user name:#{user_name}"
43
+ puts "user email:#{user_email}"
44
+ puts "year:#{year}"
45
+ end
46
+
47
+ def clean_template_files
48
+ `rm -rf configure`
49
+ `rm -rf README.md`
50
+ `rm -rf LICENSE`
51
+ end
52
+
53
+ def replace_variables_in_files
54
+ file_names = [
55
+ 'PLUGIN_LICENSE.txt',
56
+ 'PLUGIN_README.md',
57
+ 'Gemfile',
58
+ 'static_analyzer_comments.gemspec',
59
+ 'lib/static_analyzer_comments.rb',
60
+ 'lib/static_analyzer_comments/gem_version.rb',
61
+ 'lib/danger_plugin.rb',
62
+ 'lib/static_analyzer_comments/plugin.rb',
63
+ 'spec/static_analyzer_comments_spec.rb'
64
+ ]
65
+
66
+ file_names.each do |file_name|
67
+ text = File.read(file_name)
68
+ # danger-no_eggs_please -> DangerNoEggsPlease
69
+ text.gsub!("${PLUGIN_CLASS}", plugin_name.split(%r{\-|_}).map(&:capitalize).join)
70
+ # danger-no_eggs_please -> NoEggsPlease
71
+ text.gsub!("${PLUGIN_MODULE}", plugin_name.gsub("danger-","").split('_').map(&:capitalize).join)
72
+ # danger-no_eggs_please -> no_eggs_please
73
+ text.gsub!("${PLUGIN_FILE}", plugin_file)
74
+ text.gsub!("${PLUGIN_NAME}", plugin_name)
75
+ text.gsub!("${USER_NAME}", user_name)
76
+ text.gsub!("${USER_EMAIL}", user_email)
77
+ text.gsub!("${YEAR}", year)
78
+ File.open(file_name, "w") { |file| file.puts text }
79
+ end
80
+ end
81
+
82
+ def rename_template_files
83
+ `mv PLUGIN_LICENSE.txt LICENSE.txt`
84
+ `mv PLUGIN_README.md README.md`
85
+ `mv static_analyzer_comments.gemspec #{plugin_name}.gemspec`
86
+ `mv lib/static_analyzer_comments.rb lib/danger_#{plugin_file}.rb`
87
+ `mv lib/static_analyzer_comments lib/#{plugin_file}`
88
+ `mv spec/static_analyzer_comments_spec.rb spec/#{plugin_file}_spec.rb`
89
+ end
90
+
91
+ def reinitialize_git_repo
92
+ `rm -rf .git`
93
+ `git init`
94
+ `git add -A`
95
+ `git commit -m "Initial commit"`
96
+ end
97
+
98
+ #----------------------------------------#
99
+
100
+ def user_name
101
+ (ENV['GIT_COMMITTER_NAME'] || `git config user.name`).strip
102
+ end
103
+
104
+ def user_email
105
+ (ENV['GIT_COMMITTER_EMAIL'] || `git config user.email`).strip
106
+ end
107
+
108
+ def year
109
+ Time.now.year.to_s
110
+ end
111
+
112
+ #----------------------------------------#
113
+ end
114
+ end
115
+
116
+ #-----------------------------------------------------------------------------#
117
+
118
+ # TODO: Handle description
119
+ # TODO: Handle usage
120
+ # TODO: Handle GitHub URL
121
+
122
+ plugin_name = ARGV.shift
123
+ Pod::TemplateConfigurator.new(plugin_name).run
@@ -0,0 +1,49 @@
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-static_analyzer_comments'
8
+ spec.version = DangerStaticAnalyzerComments::VERSION
9
+ spec.authors = ['Vibin Reddy']
10
+ spec.email = ['vibin@meesho.com']
11
+ spec.description = %q{A Danger plugin which turns static analyzers' output into inline Github comments}
12
+ spec.summary = %q{A Danger plugin which turns static analyzers' output into inline Github comments}
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f)}
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'oga'
20
+
21
+ spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
22
+
23
+ # General ruby development
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+
27
+ # Testing support
28
+ spec.add_development_dependency 'rspec', '~> 3.4'
29
+
30
+ # Linting code and docs
31
+ spec.add_development_dependency "rubocop", "~> 0.49.0"
32
+ spec.add_development_dependency "yard", "~> 0.9.11"
33
+
34
+ # Makes testing easy via `bundle exec guard`
35
+ spec.add_development_dependency 'guard', '~> 2.14'
36
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
37
+
38
+ # If you want to work on older builds of ruby
39
+ spec.add_development_dependency 'listen', '3.0.7'
40
+
41
+ # This gives you the chance to run a REPL inside your tests
42
+ # via:
43
+ #
44
+ # require 'pry'
45
+ # binding.pry
46
+ #
47
+ # This will stop test execution and let you inspect the results
48
+ spec.add_development_dependency 'pry'
49
+ end
@@ -0,0 +1,64 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.5.2, ruby-2.3.3-p222-new) [gem]" level="application" />
9
+ <orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, ruby-2.3.3-p222-new) [gem]" level="application" />
10
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.0, ruby-2.3.3-p222-new) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.4, ruby-2.3.3-p222-new) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="claide (v1.0.2, ruby-2.3.3-p222-new) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="claide-plugins (v0.9.2, ruby-2.3.3-p222-new) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, ruby-2.3.3-p222-new) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="colored2 (v3.1.2, ruby-2.3.3-p222-new) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="cork (v0.3.0, ruby-2.3.3-p222-new) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="danger (v5.10.1, ruby-2.3.3-p222-new) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="danger-plugin-api (v1.0.0, ruby-2.3.3-p222-new) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.3.3-p222-new) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="faraday (v0.15.4, ruby-2.3.3-p222-new) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="faraday-http-cache (v1.3.1, ruby-2.3.3-p222-new) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.18, ruby-2.3.3-p222-new) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="formatador (v0.2.5, ruby-2.3.3-p222-new) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="git (v1.5.0, ruby-2.3.3-p222-new) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="guard (v2.14.1, ruby-2.3.3-p222-new) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="guard-compat (v1.2.1, ruby-2.3.3-p222-new) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="guard-rspec (v4.7.3, ruby-2.3.3-p222-new) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="kramdown (v1.17.0, ruby-2.3.3-p222-new) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="listen (v3.0.7, ruby-2.3.3-p222-new) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="lumberjack (v1.0.12, ruby-2.3.3-p222-new) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.0, ruby-2.3.3-p222-new) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.0.0, ruby-2.3.3-p222-new) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="nap (v1.1.0, ruby-2.3.3-p222-new) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="nenv (v0.3.0, ruby-2.3.3-p222-new) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="no_proxy_fix (v0.1.2, ruby-2.3.3-p222-new) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="notiffany (v0.1.1, ruby-2.3.3-p222-new) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="octokit (v4.13.0, ruby-2.3.3-p222-new) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="oga (v2.15, ruby-2.3.3-p222-new) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="open4 (v1.3.4, ruby-2.3.3-p222-new) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.12.1, ruby-2.3.3-p222-new) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="parser (v2.4.0.2, ruby-2.3.3-p222-new) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="powerpack (v0.1.1, ruby-2.3.3-p222-new) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="pry (v0.11.3, ruby-2.3.3-p222-new) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v3.0.3, ruby-2.3.3-p222-new) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v2.2.2, ruby-2.3.3-p222-new) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.3.3-p222-new) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.10.2, ruby-2.3.3-p222-new) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.9.10, ruby-2.3.3-p222-new) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.7.0, ruby-2.3.3-p222-new) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.7.0, ruby-2.3.3-p222-new) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.7.0, ruby-2.3.3-p222-new) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.7.0, ruby-2.3.3-p222-new) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.7.0, ruby-2.3.3-p222-new) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.49.1, ruby-2.3.3-p222-new) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="ruby-ll (v2.1.2, ruby-2.3.3-p222-new) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.9.0, ruby-2.3.3-p222-new) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="sawyer (v0.8.1, ruby-2.3.3-p222-new) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="shellany (v0.0.1, ruby-2.3.3-p222-new) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="terminal-table (v1.8.0, ruby-2.3.3-p222-new) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="thor (v0.20.0, ruby-2.3.3-p222-new) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.4.0, ruby-2.3.3-p222-new) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="yard (v0.9.12, ruby-2.3.3-p222-new) [gem]" level="application" />
63
+ </component>
64
+ </module>
@@ -0,0 +1,47 @@
1
+ require 'oga'
2
+
3
+ module Danger
4
+
5
+ # A Danger plugin which turns static analyzers' output into inline Github comments
6
+ class DangerStaticAnalyzerComments < Plugin
7
+ LINT_SEVERITY_LEVELS = ["Warning", "Error", "Fatal"]
8
+
9
+ attr_accessor :lint_report_file
10
+
11
+ def run
12
+ lint()
13
+ end
14
+
15
+ def lint
16
+ unless File.exists?(@lint_report_file)
17
+ fail("Lint report not found at `#{@lint_report_file}`.")
18
+ end
19
+
20
+ file = File.open(@lint_report_file)
21
+ report = Oga.parse_xml(file)
22
+ issues = report.xpath('//issue')
23
+ send_lint_inline_comment(issues)
24
+ end
25
+
26
+
27
+ # Send inline comment with danger's warn or fail method
28
+ def send_lint_inline_comment(issues)
29
+ target_files = (git.modified_files - git.deleted_files) + git.added_files
30
+ print target_files.to_a
31
+ dir = "#{Dir.pwd}/"
32
+ LINT_SEVERITY_LEVELS.reverse.each do |level|
33
+ filtered = issues.select {|issue| issue.get("severity") == level}
34
+ next if filtered.empty?
35
+ filtered.each do |r|
36
+ location = r.xpath('location').first
37
+ filename = location.get('file').gsub(dir, "")
38
+ print "location: #{location}, file: #{location.get('file')}, filename: #{filename}"
39
+ next unless (target_files.include? filename)
40
+ print "target_files includes #{filename}"
41
+ line = (location.get('line') || "0").to_i
42
+ send(level === "Warning" ? "warn" : "fail", r.get('message'), file: filename, line: line)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module DangerStaticAnalyzerComments
2
+ VERSION = "0.0.1".freeze
3
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module Danger
4
+ describe Danger::DangerStaticAnalyzerComments do
5
+ it 'should be a plugin' do
6
+ expect(Danger::DangerStaticAnalyzerComments.new(nil)).to be_a Danger::Plugin
7
+ end
8
+
9
+ describe 'with Dangerfile' do
10
+ before do
11
+ @dangerfile = testing_dangerfile
12
+ @static_analyzer_comments = @dangerfile.static_analyzer_comments
13
+ allow(@static_analyzer_comments.git).to receive(:deleted_files).and_return([])
14
+ allow(@static_analyzer_comments.git).to receive(:added_files).and_return([])
15
+ allow(@static_analyzer_comments.git).to receive(:modified_files).and_return(
16
+ [
17
+ "/Users/gustavo/Developer/app-android/app/src/main/java/com/loadsmart/common/views/AvatarView.java",
18
+ "/Users/gustavo/Developer/app-android/app/src/main/java/com/loadsmart/analytics/Events.java"
19
+ ])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,65 @@
1
+ require "pathname"
2
+ ROOT = Pathname.new(File.expand_path("../../", __FILE__))
3
+ $:.unshift((ROOT + "lib").to_s)
4
+ $:.unshift((ROOT + "spec").to_s)
5
+
6
+ require "bundler/setup"
7
+ require "pry"
8
+
9
+ require "rspec"
10
+ require "danger"
11
+
12
+ if `git remote -v` == ''
13
+ puts "You cannot run tests without setting a local git remote on this repo"
14
+ puts "It's a weird side-effect of Danger's internals."
15
+ exit(0)
16
+ end
17
+
18
+ # Use coloured output, it's the best.
19
+ RSpec.configure do |config|
20
+ config.filter_gems_from_backtrace "bundler"
21
+ config.color = true
22
+ config.tty = true
23
+ end
24
+
25
+ require "danger_plugin"
26
+
27
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
28
+ # If you are expanding these files, see if it's already been done ^.
29
+
30
+ # A silent version of the user interface,
31
+ # it comes with an extra function `.string` which will
32
+ # strip all ANSI colours from the string.
33
+
34
+ # rubocop:disable Lint/NestedMethodDefinition
35
+ def testing_ui
36
+ @output = StringIO.new
37
+ def @output.winsize
38
+ [20, 9999]
39
+ end
40
+
41
+ cork = Cork::Board.new(out: @output)
42
+ def cork.string
43
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
44
+ end
45
+ cork
46
+ end
47
+ # rubocop:enable Lint/NestedMethodDefinition
48
+
49
+ # Example environment (ENV) that would come from
50
+ # running a PR on TravisCI
51
+ def testing_env
52
+ {
53
+ "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
54
+ "TRAVIS_PULL_REQUEST" => "800",
55
+ "TRAVIS_REPO_SLUG" => "artsy/eigen",
56
+ "TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
57
+ "DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
58
+ }
59
+ end
60
+
61
+ # A stubbed out Dangerfile for use in tests
62
+ def testing_dangerfile
63
+ env = Danger::EnvironmentManager.new(testing_env)
64
+ Danger::Dangerfile.new(env, testing_ui)
65
+ end
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-static_analyzer_comments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Vibin Reddy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oga
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: danger-plugin-api
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.9.11
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.9.11
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.14'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.14'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: listen
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 3.0.7
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 3.0.7
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: A Danger plugin which turns static analyzers' output into inline Github
168
+ comments
169
+ email:
170
+ - vibin@meesho.com
171
+ executables: []
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - ".idea/misc.xml"
176
+ - ".idea/modules.xml"
177
+ - Gemfile
178
+ - Gemfile.lock
179
+ - Guardfile
180
+ - LICENSE
181
+ - PLUGIN.gemspec.template.cpgz
182
+ - PLUGIN_LICENSE.txt
183
+ - PLUGIN_README.md
184
+ - Rakefile
185
+ - configure
186
+ - danger-static_analyzer_comments.gemspec
187
+ - danger-static_analyzer_comments.iml
188
+ - lib/danger_plugin.rb
189
+ - lib/version.rb
190
+ - spec/danger_static_analyzer_comments_spec.rb
191
+ - spec/spec_helper.rb
192
+ homepage:
193
+ licenses: []
194
+ metadata: {}
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 2.4.5
212
+ signing_key:
213
+ specification_version: 4
214
+ summary: A Danger plugin which turns static analyzers' output into inline Github comments
215
+ test_files:
216
+ - spec/danger_static_analyzer_comments_spec.rb
217
+ - spec/spec_helper.rb