danger-toc 0.1.2 → 0.1.3

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
- SHA1:
3
- metadata.gz: 8d6f07178a26d9c1cc6267388640e6f4c21ad15b
4
- data.tar.gz: 6cd82b36ca80b580f402cbbd2a31b5a319dfb9e3
2
+ SHA256:
3
+ metadata.gz: 6f762724f89edff7e76c51e6ffae851d257b1f4f5ef2fd668a9c7e28c5a62c0f
4
+ data.tar.gz: 9b9cd63986e67d85dda7a1067eb70abdd782ed27ad684ac72b781fb5145f5493
5
5
  SHA512:
6
- metadata.gz: f41167916836adaea70857524473e43654cff465430046b6342a9a77049294c834c2be9f33d5ad0a5610a164dff0611c0a8cced4763985655450d923befcef13
7
- data.tar.gz: 6713504e51a68041100b89c05e1210294172cd725032f5628ce51aa1b1e2539bc06f59ab0054a5d2f0c79a522847293a6b513616ccf4897a80d55828925f8659
6
+ metadata.gz: 18157fc64bfcc1efb3db474d650b771a314a90b15838bfe5d222a21ab344c18a80bb848b41f5623e1391f30921b3ae058f4f3c40e0076f5a5b7af2e840b02993
7
+ data.tar.gz: 932ac02e3ebaac4ada45b08fe6353bcbf7bc84b66f87e44e4c35f799e0a881db35843f6c31dafa6f22fcf0631a6b3551c8ce25cacffde51f81eb5a5ee8c7c255
@@ -1,6 +1,4 @@
1
1
  AllCops:
2
- Include:
3
- - Rakefile
4
2
  Exclude:
5
3
  - vendor/**/*
6
4
 
@@ -10,4 +8,7 @@ Metrics/BlockLength:
10
8
  Metrics/LineLength:
11
9
  Enabled: fale
12
10
 
11
+ Style/ModuleFunction:
12
+ Enabled: false
13
+
13
14
  inherit_from: .rubocop_todo.yml
@@ -1,27 +1,61 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-03-23 17:04:14 +0300 using RuboCop version 0.41.2.
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: 24
14
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
15
- # URISchemes: http, https
16
- Metrics/LineLength:
17
- Max: 119
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: 6
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: 1
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: 1
49
- # Configuration parameters: EnforcedStyle, SupportedStyles.
50
- # SupportedStyles: module_function, extend_self
51
- Style/ModuleFunction:
52
- Exclude:
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
@@ -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
@@ -4,7 +4,7 @@ require 'rubocop/rake_task'
4
4
 
5
5
  RSpec::Core::RakeTask.new(:specs)
6
6
 
7
- task default: %i(rubocop specs)
7
+ task default: %i[rubocop specs]
8
8
 
9
9
  task :spec do
10
10
  Rake::Task['specs'].invoke
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
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', '3.0.7'
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', '~> 0.41.0'
32
- spec.add_development_dependency 'yard', '~> 0.8'
31
+ spec.add_development_dependency 'rubocop', '0.58.2'
32
+ spec.add_development_dependency 'yard'
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module Toc
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
@@ -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
@@ -54,7 +54,7 @@ Here's the expected TOC for #{filename}:
54
54
 
55
55
  #{toc_file.toc_from_headers.join("\n")}
56
56
  ```
57
- MARKDOWN
57
+ MARKDOWN
58
58
  if toc_file.has_toc?
59
59
  messaging.fail("The TOC found in #{filename} doesn't match the sections of the file.", sticky: false)
60
60
  else
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require File.expand_path('spec_helper', __dir__)
2
2
 
3
3
  describe Danger::Toc::Config do
4
4
  after(:each) do
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require File.expand_path('spec_helper', __dir__)
2
2
 
3
3
  describe Danger::Toc::Constructors do
4
4
  describe '.get' do
@@ -12,7 +12,11 @@ The quick brown fox jumps over the lazy dog.
12
12
  The quick brown fox jumps over the lazy dog.
13
13
 
14
14
  ```ruby
15
- # example config.ru
15
+ # one
16
+
17
+ require 'danger-toc'
18
+
19
+ # two
16
20
 
17
21
  require 'danger-toc'
18
22
  ```
@@ -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('../../../README.md', __FILE__) }
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('../../fixtures/markdown_file/one_section.md', __FILE__) }
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('../../fixtures/markdown_file/one_section_with_toc_level.md', __FILE__) }
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('../../fixtures/markdown_file/one_section_with_toc.md', __FILE__) }
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('../../fixtures/markdown_file/with_quoted_example.md', __FILE__) }
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('../../fixtures/markdown_file/one_section_with_underscore_in_name.md', __FILE__)
6
+ File.expand_path('../fixtures/markdown_file/one_section_with_underscore_in_name.md', __dir__)
7
7
  end
8
8
 
9
9
  subject do
@@ -1,5 +1,5 @@
1
1
  require 'pathname'
2
- ROOT = Pathname.new(File.expand_path('../../', __FILE__))
2
+ ROOT = Pathname.new(File.expand_path('..', __dir__))
3
3
  $LOAD_PATH.unshift((ROOT + 'lib').to_s)
4
4
  $LOAD_PATH.unshift((ROOT + 'spec').to_s)
5
5
 
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
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('../fixtures/markdown_file/one_section_with_toc.md', __FILE__) }
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('../fixtures/markdown_file/one_section.md', __FILE__) }
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('../fixtures/markdown_file/one_section_with_invalid_toc.md', __FILE__) }
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('../fixtures/markdown_file/one_section.md', __FILE__) }
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('../fixtures/markdown_file/one_section_with_custom_toc.md', __FILE__) }
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.2
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-04-02 00:00:00.000000000 Z
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: 3.0.7
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: 3.0.7
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.41.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.41.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.8'
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.8'
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.11
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.