danger-readme_docs 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -6
- data/Gemfile.lock +5 -6
- data/lib/danger_plugin.rb +3 -1
- data/lib/danger_readme_docs.rb +3 -1
- data/lib/readme_docs/gem_version.rb +3 -1
- data/lib/readme_docs/plugin.rb +18 -14
- data/spec/readme_docs_spec.rb +7 -5
- data/spec/spec_helper.rb +19 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ca6cfba023e02c516e194c0874490f0ddeeeee3b7de498aef92152875cf06f9
|
4
|
+
data.tar.gz: eb7079d740da7eda311ee493bb089a45e48cd2656df9ddbda24f0d18c0beadda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec4286eb58ccc246a66c369a737ae513a0c0356cad27f2abe3ea80ec5317e545ac59107936253cc932bdeeae227b7b83a4253457d4bdad40d70c1b1f22568c0
|
7
|
+
data.tar.gz: b285a1f7855fa3a0880a84d0031252831ae90206dd2813f2054555fdaa2f527f1e9dd44834b7954c38f3fc6a25f5b5101cc2b32278ea8b42122ac7db00e4743e
|
data/.rubocop.yml
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# If you don't like these settings, just delete this file :)
|
4
4
|
|
5
5
|
AllCops:
|
6
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.6
|
7
7
|
|
8
8
|
Style/StringLiterals:
|
9
|
-
EnforcedStyle:
|
9
|
+
EnforcedStyle: single_quotes
|
10
10
|
Enabled: true
|
11
11
|
|
12
12
|
# kind_of? is a good way to check a type
|
@@ -14,7 +14,7 @@ Style/ClassCheck:
|
|
14
14
|
EnforcedStyle: kind_of?
|
15
15
|
|
16
16
|
# It's better to be more explicit about the type
|
17
|
-
|
17
|
+
Layout/AccessModifierIndentation:
|
18
18
|
Enabled: false
|
19
19
|
|
20
20
|
# specs sometimes have useless assignments, which is fine
|
@@ -23,10 +23,10 @@ Lint/UselessAssignment:
|
|
23
23
|
- '**/spec/**/*'
|
24
24
|
|
25
25
|
# We could potentially enable the 2 below:
|
26
|
-
Layout/
|
26
|
+
Layout/FirstHashElementIndentation:
|
27
27
|
Enabled: false
|
28
28
|
|
29
|
-
Layout/
|
29
|
+
Layout/HashAlignment:
|
30
30
|
Enabled: false
|
31
31
|
|
32
32
|
# HoundCI doesn't like this rule
|
@@ -130,7 +130,7 @@ Style/MixinGrouping:
|
|
130
130
|
Style/FileName:
|
131
131
|
Enabled: false
|
132
132
|
|
133
|
-
Layout/
|
133
|
+
Layout/HeredocIndentation:
|
134
134
|
Enabled: false
|
135
135
|
|
136
136
|
Style/SpecialGlobalVars:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-readme_docs (0.0.
|
4
|
+
danger-readme_docs (0.0.2)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -133,7 +133,6 @@ GEM
|
|
133
133
|
|
134
134
|
PLATFORMS
|
135
135
|
x86_64-darwin-19
|
136
|
-
x86_64-darwin-20
|
137
136
|
|
138
137
|
DEPENDENCIES
|
139
138
|
bundler (~> 2.0)
|
@@ -141,11 +140,11 @@ DEPENDENCIES
|
|
141
140
|
guard (~> 2.14)
|
142
141
|
guard-rspec (~> 4.7)
|
143
142
|
listen (= 3.0.7)
|
144
|
-
pry
|
143
|
+
pry (~> 0.14.0)
|
145
144
|
rake (~> 10.0)
|
146
145
|
rspec (~> 3.4)
|
147
|
-
rubocop
|
148
|
-
yard
|
146
|
+
rubocop (~> 1.12.0)
|
147
|
+
yard (~> 0.9.26)
|
149
148
|
|
150
149
|
BUNDLED WITH
|
151
|
-
2.2.
|
150
|
+
2.2.12
|
data/lib/danger_plugin.rb
CHANGED
data/lib/danger_readme_docs.rb
CHANGED
data/lib/readme_docs/plugin.rb
CHANGED
@@ -1,22 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Danger
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# To be published on the Danger plugins site, you will need to have
|
6
|
-
# the public interface documented. Danger uses [YARD](http://yardoc.org/)
|
7
|
-
# for generating documentation from your plugin source, and you can verify
|
8
|
-
# by running `danger plugins lint` or `bundle exec rake spec`.
|
4
|
+
# Check markdown files inside main README.md.
|
5
|
+
# Results are passed out as a string with warning.
|
9
6
|
#
|
10
|
-
#
|
7
|
+
# @example Running linter
|
11
8
|
#
|
12
|
-
#
|
9
|
+
# # Runs a linter
|
10
|
+
# readme_docs.lint
|
13
11
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# @see Mikhail Georgievskiy/danger-readme_docs
|
12
|
+
# @see https://github.com/mikhailushka
|
17
13
|
# @tags monday, weekends, time, rattata
|
18
14
|
#
|
19
15
|
class DangerReadmeDocs < Plugin
|
16
|
+
# Lints the globbed markdown files. Will fail if changed file was not added in main README.md.
|
17
|
+
# Generates a `string` with warning.
|
18
|
+
#
|
19
|
+
# @param [String] files
|
20
|
+
# A globbed string which should return the files that you want to lint, defaults to nil.
|
21
|
+
# if nil, modified and added files from the diff will be used.
|
22
|
+
# @return [void]
|
23
|
+
#
|
20
24
|
def lint
|
21
25
|
forgotten_files = []
|
22
26
|
|
@@ -27,7 +31,7 @@ module Danger
|
|
27
31
|
file_expand_path = File.path(file)
|
28
32
|
# unless include because excludes for string available in rails >= 4.0.2
|
29
33
|
forgotten_files << file_expand_path unless main_readme_content.include?(file_expand_path)
|
30
|
-
|
34
|
+
|
31
35
|
warn(warning_generator(forgotten_files)) if forgotten_files.any?
|
32
36
|
end
|
33
37
|
end
|
@@ -36,7 +40,7 @@ module Danger
|
|
36
40
|
|
37
41
|
# memoize file content
|
38
42
|
def main_readme_content
|
39
|
-
@
|
43
|
+
@main_readme_content ||= File.read('README.md')
|
40
44
|
end
|
41
45
|
|
42
46
|
def changed_files
|
data/spec/readme_docs_spec.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('spec_helper', __dir__)
|
2
4
|
|
3
5
|
module Danger
|
4
6
|
describe Danger::DangerReadmeDocs do
|
5
|
-
it
|
7
|
+
it 'should be a plugin' do
|
6
8
|
expect(Danger::DangerReadmeDocs.new(nil)).to be_a Danger::Plugin
|
7
9
|
end
|
8
10
|
|
9
11
|
#
|
10
12
|
# You should test your custom attributes and methods here
|
11
13
|
#
|
12
|
-
describe
|
14
|
+
describe 'with Dangerfile' do
|
13
15
|
subject do
|
14
16
|
@readme_docs.lint
|
15
17
|
@readme_docs.status_report[:warnings]
|
@@ -40,7 +42,7 @@ module Danger
|
|
40
42
|
let(:fake_main_readme) { '# Test' }
|
41
43
|
let(:warnings) do
|
42
44
|
[
|
43
|
-
|
45
|
+
'Please add mentions of sub readme files ' \
|
44
46
|
"in main README.md:\n **spec/fixtures/README.md**"
|
45
47
|
]
|
46
48
|
end
|
@@ -49,7 +51,7 @@ module Danger
|
|
49
51
|
|
50
52
|
context 'when files are not readable' do
|
51
53
|
let(:is_files_readable) { false }
|
52
|
-
|
54
|
+
|
53
55
|
it { is_expected.to be_empty }
|
54
56
|
end
|
55
57
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
|
-
|
2
|
-
ROOT = Pathname.new(File.expand_path("../../", __FILE__))
|
3
|
-
$:.unshift((ROOT + "lib").to_s)
|
4
|
-
$:.unshift((ROOT + "spec").to_s)
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
require
|
7
|
-
|
3
|
+
require 'pathname'
|
4
|
+
ROOT = Pathname.new(File.expand_path('..', __dir__))
|
5
|
+
$:.unshift("#{ROOT}lib")
|
6
|
+
$:.unshift("#{ROOT}spec")
|
8
7
|
|
9
|
-
require
|
10
|
-
require
|
8
|
+
require 'bundler/setup'
|
9
|
+
require 'pry'
|
10
|
+
|
11
|
+
require 'rspec'
|
12
|
+
require 'danger'
|
11
13
|
|
12
14
|
if `git remote -v` == ''
|
13
|
-
puts
|
15
|
+
puts 'You cannot run tests without setting a local git remote on this repo'
|
14
16
|
puts "It's a weird side-effect of Danger's internals."
|
15
17
|
exit(0)
|
16
18
|
end
|
17
19
|
|
18
20
|
# Use coloured output, it's the best.
|
19
21
|
RSpec.configure do |config|
|
20
|
-
config.filter_gems_from_backtrace
|
22
|
+
config.filter_gems_from_backtrace 'bundler'
|
21
23
|
config.color = true
|
22
24
|
config.tty = true
|
23
25
|
end
|
24
26
|
|
25
|
-
require
|
27
|
+
require 'danger_plugin'
|
26
28
|
|
27
29
|
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
|
28
30
|
# If you are expanding these files, see if it's already been done ^.
|
@@ -40,7 +42,7 @@ def testing_ui
|
|
40
42
|
|
41
43
|
cork = Cork::Board.new(out: @output)
|
42
44
|
def cork.string
|
43
|
-
out.string.gsub(/\e\[([;\d]+)?m/,
|
45
|
+
out.string.gsub(/\e\[([;\d]+)?m/, '')
|
44
46
|
end
|
45
47
|
cork
|
46
48
|
end
|
@@ -50,11 +52,11 @@ end
|
|
50
52
|
# running a PR on TravisCI
|
51
53
|
def testing_env
|
52
54
|
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
|
56
|
+
'TRAVIS_PULL_REQUEST' => '800',
|
57
|
+
'TRAVIS_REPO_SLUG' => 'artsy/eigen',
|
58
|
+
'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
|
59
|
+
'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
|
58
60
|
}
|
59
61
|
end
|
60
62
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-readme_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Georgievskiy
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
195
|
+
rubygems_version: 3.0.9
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Danger plugin to validate sub README mention in main README file
|