danger-toc 0.1.2 → 0.1.3
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 +5 -5
- data/.rubocop.yml +3 -2
- data/.rubocop_todo.yml +47 -25
- data/CHANGELOG.md +4 -0
- data/Rakefile +1 -1
- data/danger-toc.gemspec +4 -4
- data/lib/toc/gem_version.rb +1 -1
- data/lib/toc/markdown_file.rb +1 -1
- data/lib/toc/plugin.rb +1 -1
- data/spec/config_spec.rb +1 -1
- data/spec/constructors_spec.rb +1 -1
- data/spec/fixtures/markdown_file/with_quoted_example.md +5 -1
- data/spec/markdown_file/danger_toc_readme_spec.rb +1 -1
- data/spec/markdown_file/one_section_spec.rb +1 -1
- data/spec/markdown_file/one_section_with_toc_level_spec.rb +1 -1
- data/spec/markdown_file/one_section_with_toc_spec.rb +1 -1
- data/spec/markdown_file/with_quoted_example_spec.rb +1 -1
- data/spec/markdown_file/with_underscore_in_section_name_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/toc_spec.rb +8 -8
- metadata +15 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6f762724f89edff7e76c51e6ffae851d257b1f4f5ef2fd668a9c7e28c5a62c0f
|
|
4
|
+
data.tar.gz: 9b9cd63986e67d85dda7a1067eb70abdd782ed27ad684ac72b781fb5145f5493
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18157fc64bfcc1efb3db474d650b771a314a90b15838bfe5d222a21ab344c18a80bb848b41f5623e1391f30921b3ae058f4f3c40e0076f5a5b7af2e840b02993
|
|
7
|
+
data.tar.gz: 932ac02e3ebaac4ada45b08fe6353bcbf7bc84b66f87e44e4c35f799e0a881db35843f6c31dafa6f22fcf0631a6b3551c8ce25cacffde51f81eb5a5ee8c7c255
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,27 +1,61 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2018-
|
|
3
|
+
# on 2018-08-15 11:59:49 -0400 using RuboCop version 0.58.2.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
+
# Offense count: 3
|
|
10
|
+
# Cop supports --auto-correct.
|
|
11
|
+
# Configuration parameters: EnforcedStyle.
|
|
12
|
+
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
|
13
|
+
Layout/IndentHeredoc:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'lib/toc/plugin.rb'
|
|
16
|
+
- 'spec/toc_spec.rb'
|
|
17
|
+
|
|
18
|
+
# Offense count: 2
|
|
19
|
+
Lint/DuplicateMethods:
|
|
20
|
+
Exclude:
|
|
21
|
+
- 'lib/toc/config.rb'
|
|
22
|
+
|
|
9
23
|
# Offense count: 4
|
|
10
24
|
Metrics/AbcSize:
|
|
11
25
|
Max: 19
|
|
12
26
|
|
|
13
|
-
# Offense count:
|
|
14
|
-
# Configuration parameters:
|
|
15
|
-
#
|
|
16
|
-
Metrics/
|
|
17
|
-
Max:
|
|
27
|
+
# Offense count: 8
|
|
28
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
29
|
+
# ExcludedMethods: refine
|
|
30
|
+
Metrics/BlockLength:
|
|
31
|
+
Max: 109
|
|
18
32
|
|
|
19
33
|
# Offense count: 3
|
|
20
34
|
# Configuration parameters: CountComments.
|
|
21
35
|
Metrics/MethodLength:
|
|
22
36
|
Max: 21
|
|
23
37
|
|
|
24
|
-
# Offense count:
|
|
38
|
+
# Offense count: 2
|
|
39
|
+
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
|
|
40
|
+
# NamePrefix: is_, has_, have_
|
|
41
|
+
# NamePrefixBlacklist: is_, has_, have_
|
|
42
|
+
# NameWhitelist: is_a?
|
|
43
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
44
|
+
Naming/PredicateName:
|
|
45
|
+
Exclude:
|
|
46
|
+
- 'spec/**/*'
|
|
47
|
+
- 'lib/toc/markdown_file.rb'
|
|
48
|
+
- 'lib/toc/plugin.rb'
|
|
49
|
+
|
|
50
|
+
# Offense count: 3
|
|
51
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
52
|
+
# AllowedNames: io, id, to, by, on, in, at, ip
|
|
53
|
+
Naming/UncommunicativeMethodParamName:
|
|
54
|
+
Exclude:
|
|
55
|
+
- 'lib/toc/constructors/kramdown_constructor.rb'
|
|
56
|
+
- 'lib/toc/extractor.rb'
|
|
57
|
+
|
|
58
|
+
# Offense count: 8
|
|
25
59
|
Style/Documentation:
|
|
26
60
|
Exclude:
|
|
27
61
|
- 'spec/**/*'
|
|
@@ -39,26 +73,14 @@ Style/DoubleNegation:
|
|
|
39
73
|
Exclude:
|
|
40
74
|
- 'lib/toc/markdown_file.rb'
|
|
41
75
|
|
|
42
|
-
# Offense count:
|
|
76
|
+
# Offense count: 2
|
|
43
77
|
# Configuration parameters: MinBodyLength.
|
|
44
78
|
Style/GuardClause:
|
|
45
79
|
Exclude:
|
|
46
80
|
- 'lib/toc/markdown_file.rb'
|
|
47
81
|
|
|
48
|
-
# Offense count:
|
|
49
|
-
# Configuration parameters:
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- 'lib/toc/config.rb'
|
|
54
|
-
|
|
55
|
-
# Offense count: 2
|
|
56
|
-
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
|
57
|
-
# NamePrefix: is_, has_, have_
|
|
58
|
-
# NamePrefixBlacklist: is_, has_, have_
|
|
59
|
-
# NameWhitelist: is_a?
|
|
60
|
-
Style/PredicateName:
|
|
61
|
-
Exclude:
|
|
62
|
-
- 'spec/**/*'
|
|
63
|
-
- 'lib/toc/markdown_file.rb'
|
|
64
|
-
- 'lib/toc/plugin.rb'
|
|
82
|
+
# Offense count: 26
|
|
83
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
84
|
+
# URISchemes: http, https
|
|
85
|
+
Metrics/LineLength:
|
|
86
|
+
Max: 119
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 0.1.3 (2018/08/15)
|
|
4
|
+
|
|
5
|
+
* [#7](https://github.com/dblock/danger-toc/issues/7): Parse documents as Github Flavored Markdown by default - [@dblock](https://github.com/dblock).
|
|
6
|
+
|
|
3
7
|
### 0.1.2 (2018/04/02)
|
|
4
8
|
|
|
5
9
|
* [#14](https://github.com/dblock/danger-toc/pull/14): Configure "Table of Contents" format with `toc.format`. Allow values: github (by default) and kramdown - [@mr-dxdy](https://github.com/mr-dxdy).
|
data/Rakefile
CHANGED
data/danger-toc.gemspec
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
lib = File.expand_path('
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
require 'toc/gem_version.rb'
|
|
4
4
|
|
|
@@ -24,10 +24,10 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
25
25
|
spec.add_development_dependency 'guard', '~> 2.14'
|
|
26
26
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
|
27
|
-
spec.add_development_dependency 'listen'
|
|
27
|
+
spec.add_development_dependency 'listen'
|
|
28
28
|
spec.add_development_dependency 'pry'
|
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
|
31
|
-
spec.add_development_dependency 'rubocop', '
|
|
32
|
-
spec.add_development_dependency 'yard'
|
|
31
|
+
spec.add_development_dependency 'rubocop', '0.58.2'
|
|
32
|
+
spec.add_development_dependency 'yard'
|
|
33
33
|
end
|
data/lib/toc/gem_version.rb
CHANGED
data/lib/toc/markdown_file.rb
CHANGED
|
@@ -52,7 +52,7 @@ module Danger
|
|
|
52
52
|
# Parse markdown file for TOC.
|
|
53
53
|
def parse!
|
|
54
54
|
md = File.read(filename)
|
|
55
|
-
doc = Kramdown::Document.new(md)
|
|
55
|
+
doc = Kramdown::Document.new(md, input: 'GFM')
|
|
56
56
|
|
|
57
57
|
# extract toc
|
|
58
58
|
toc_start, toc_end = Danger::Toc::Extractor.convert(doc.root).first
|
data/lib/toc/plugin.rb
CHANGED
data/spec/config_spec.rb
CHANGED
data/spec/constructors_spec.rb
CHANGED
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Danger::Toc::MarkdownFile do
|
|
4
4
|
describe 'danger-toc README' do
|
|
5
|
-
let(:filename) { File.expand_path('
|
|
5
|
+
let(:filename) { File.expand_path('../../README.md', __dir__) }
|
|
6
6
|
subject do
|
|
7
7
|
Danger::Toc::MarkdownFile.new(filename)
|
|
8
8
|
end
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Danger::Toc::MarkdownFile do
|
|
4
4
|
describe 'with a single section' do
|
|
5
|
-
let(:filename) { File.expand_path('
|
|
5
|
+
let(:filename) { File.expand_path('../fixtures/markdown_file/one_section.md', __dir__) }
|
|
6
6
|
subject do
|
|
7
7
|
Danger::Toc::MarkdownFile.new(filename)
|
|
8
8
|
end
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Danger::Toc::MarkdownFile do
|
|
4
4
|
describe 'one section that is not at the root level' do
|
|
5
|
-
let(:filename) { File.expand_path('
|
|
5
|
+
let(:filename) { File.expand_path('../fixtures/markdown_file/one_section_with_toc_level.md', __dir__) }
|
|
6
6
|
subject do
|
|
7
7
|
Danger::Toc::MarkdownFile.new(filename)
|
|
8
8
|
end
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Danger::Toc::MarkdownFile do
|
|
4
4
|
describe 'one section with TOC' do
|
|
5
|
-
let(:filename) { File.expand_path('
|
|
5
|
+
let(:filename) { File.expand_path('../fixtures/markdown_file/one_section_with_toc.md', __dir__) }
|
|
6
6
|
subject do
|
|
7
7
|
Danger::Toc::MarkdownFile.new(filename)
|
|
8
8
|
end
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Danger::Toc::MarkdownFile do
|
|
4
4
|
describe 'with a code example' do
|
|
5
|
-
let(:filename) { File.expand_path('
|
|
5
|
+
let(:filename) { File.expand_path('../fixtures/markdown_file/with_quoted_example.md', __dir__) }
|
|
6
6
|
subject do
|
|
7
7
|
Danger::Toc::MarkdownFile.new(filename)
|
|
8
8
|
end
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe Danger::Toc::MarkdownFile do
|
|
4
4
|
describe 'with a underscore in section name' do
|
|
5
5
|
let(:filename) do
|
|
6
|
-
File.expand_path('
|
|
6
|
+
File.expand_path('../fixtures/markdown_file/one_section_with_underscore_in_name.md', __dir__)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
subject do
|
data/spec/spec_helper.rb
CHANGED
data/spec/toc_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require File.expand_path('
|
|
1
|
+
require File.expand_path('spec_helper', __dir__)
|
|
2
2
|
|
|
3
3
|
describe Danger::Toc do
|
|
4
4
|
after(:each) do
|
|
@@ -10,7 +10,7 @@ describe Danger::Toc do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe 'with Dangerfile' do
|
|
13
|
-
let(:filename) { File.expand_path('
|
|
13
|
+
let(:filename) { File.expand_path('fixtures/markdown_file/one_section_with_toc.md', __dir__) }
|
|
14
14
|
let(:dangerfile) { testing_dangerfile }
|
|
15
15
|
let(:toc) do
|
|
16
16
|
dangerfile.toc.filenames = [filename]
|
|
@@ -69,7 +69,7 @@ describe Danger::Toc do
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
context 'with missing TOC' do
|
|
72
|
-
let(:filename) { File.expand_path('
|
|
72
|
+
let(:filename) { File.expand_path('fixtures/markdown_file/one_section.md', __dir__) }
|
|
73
73
|
it 'reports errors' do
|
|
74
74
|
expect(subject).to be false
|
|
75
75
|
expect(status_report[:errors]).to eq ["The #{filename} file is missing a TOC."]
|
|
@@ -82,13 +82,13 @@ Here's the expected TOC for #{filename}:
|
|
|
82
82
|
|
|
83
83
|
- [What is This?](#what-is-this)
|
|
84
84
|
```
|
|
85
|
-
MARKDOWN
|
|
85
|
+
MARKDOWN
|
|
86
86
|
]
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
context 'with invalid TOC' do
|
|
91
|
-
let(:filename) { File.expand_path('
|
|
91
|
+
let(:filename) { File.expand_path('fixtures/markdown_file/one_section_with_invalid_toc.md', __dir__) }
|
|
92
92
|
it 'reports errors' do
|
|
93
93
|
expect(subject).to be false
|
|
94
94
|
expect(status_report[:errors]).to eq ["The TOC found in #{filename} doesn't match the sections of the file."]
|
|
@@ -101,7 +101,7 @@ Here's the expected TOC for #{filename}:
|
|
|
101
101
|
|
|
102
102
|
- [What is This?](#what-is-this)
|
|
103
103
|
```
|
|
104
|
-
MARKDOWN
|
|
104
|
+
MARKDOWN
|
|
105
105
|
]
|
|
106
106
|
end
|
|
107
107
|
end
|
|
@@ -114,7 +114,7 @@ MARKDOWN
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
context 'with missing TOC' do
|
|
117
|
-
let(:filename) { File.expand_path('
|
|
117
|
+
let(:filename) { File.expand_path('fixtures/markdown_file/one_section.md', __dir__) }
|
|
118
118
|
it 'reports errors' do
|
|
119
119
|
expect(subject).to be false
|
|
120
120
|
expect(status_report[:markdowns].first.message).to include "\n# Custom TOC\n"
|
|
@@ -122,7 +122,7 @@ MARKDOWN
|
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
context 'with a custom TOC' do
|
|
125
|
-
let(:filename) { File.expand_path('
|
|
125
|
+
let(:filename) { File.expand_path('fixtures/markdown_file/one_section_with_custom_toc.md', __dir__) }
|
|
126
126
|
it 'has no complaints' do
|
|
127
127
|
expect(subject).to be true
|
|
128
128
|
expect(status_report[:errors]).to eq []
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-toc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dblock
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -98,16 +98,16 @@ dependencies:
|
|
|
98
98
|
name: listen
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- -
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
103
|
+
version: '0'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- -
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
110
|
+
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: pry
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,30 +154,30 @@ dependencies:
|
|
|
154
154
|
name: rubocop
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
156
156
|
requirements:
|
|
157
|
-
- -
|
|
157
|
+
- - '='
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 0.
|
|
159
|
+
version: 0.58.2
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
|
-
- -
|
|
164
|
+
- - '='
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 0.
|
|
166
|
+
version: 0.58.2
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: yard
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
|
-
- - "
|
|
171
|
+
- - ">="
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: '0
|
|
173
|
+
version: '0'
|
|
174
174
|
type: :development
|
|
175
175
|
prerelease: false
|
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
|
-
- - "
|
|
178
|
+
- - ">="
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: '0
|
|
180
|
+
version: '0'
|
|
181
181
|
description: A danger.systems plugin for your markdown TOC.
|
|
182
182
|
email:
|
|
183
183
|
- dblock@dblock.org
|
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
248
248
|
version: '0'
|
|
249
249
|
requirements: []
|
|
250
250
|
rubyforge_project:
|
|
251
|
-
rubygems_version: 2.6
|
|
251
|
+
rubygems_version: 2.7.6
|
|
252
252
|
signing_key:
|
|
253
253
|
specification_version: 4
|
|
254
254
|
summary: A danger.systems plugin for your markdown TOC.
|