appium_doc_lint 0.0.3 → 0.0.4
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 +4 -4
- data/lib/appium_doc_lint/lint.rb +2 -1
- data/lib/appium_doc_lint/lint/ext_missing.rb +42 -0
- data/lib/appium_doc_lint/version.rb +2 -2
- data/release_notes.md +10 -0
- data/spec/data/sub/3.md +5 -1
- data/spec/helper.rb +1 -0
- data/spec/lint_spec.rb +34 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9a90d2baebe2ed13db1355e50c3a3917eb9a161
|
4
|
+
data.tar.gz: c91fd0b231071843d57892b66b567a99f3ee9735
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 470605d83b8fc7aa33def2be3ca456f38ee13eae133ee0a089b775e3a4f39ddae3e03feb94a78b4bc991bce1c45bedab85a65e2af2a0990823fc7f07b9262ae0
|
7
|
+
data.tar.gz: bcb2a93f069a8bf49b0db79bfb77be2d39e29f60ec7aa7b213ba5ebc14ee376ddb259e18bcc17aaf1d0fc499cba3a7c9a69b4fba9d56f43d3ba9bbb161c4ff1d
|
data/lib/appium_doc_lint/lint.rb
CHANGED
@@ -3,6 +3,7 @@ require 'ostruct'
|
|
3
3
|
module Appium
|
4
4
|
class Lint
|
5
5
|
require_relative 'lint/base'
|
6
|
+
require_relative 'lint/ext_missing'
|
6
7
|
require_relative 'lint/h1_invalid'
|
7
8
|
require_relative 'lint/h1_multiple'
|
8
9
|
require_relative 'lint/h1_missing'
|
@@ -14,7 +15,7 @@ module Appium
|
|
14
15
|
attr_reader :input
|
15
16
|
|
16
17
|
def initialize
|
17
|
-
@rules = [H1Missing, H1Multiple, H1Invalid, H2Invalid, H456Invalid, LineBreakInvalid]
|
18
|
+
@rules = [ExtMissing, H1Missing, H1Multiple, H1Invalid, H2Invalid, H456Invalid, LineBreakInvalid]
|
18
19
|
end
|
19
20
|
|
20
21
|
def self.init_data opts={}, input
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Appium
|
2
|
+
class Lint
|
3
|
+
###
|
4
|
+
# all markdown links must have an extension
|
5
|
+
#
|
6
|
+
# [link to read](readme.md)
|
7
|
+
#
|
8
|
+
# invalid examples:
|
9
|
+
# [link](readme)
|
10
|
+
# [link](readme#testing)
|
11
|
+
class ExtMissing < Base
|
12
|
+
def call
|
13
|
+
input.lines.each_with_index do |line, index|
|
14
|
+
# regex from github.com/appium/api-docs/lib/api_docs.rb
|
15
|
+
# /(?<!!) -- negative look behind. excludes image links
|
16
|
+
match_data = line.match(/(?<!!) \[ ( [^\[]* ) \] \( ( [^)\/]+ ) \)/x)
|
17
|
+
next unless match_data # skip nil matches
|
18
|
+
link_text = match_data[1]
|
19
|
+
link_target = match_data[2]
|
20
|
+
|
21
|
+
if link_target && !link_target.include?('/')
|
22
|
+
ext = File.extname link_target
|
23
|
+
if ext.empty?
|
24
|
+
warn index
|
25
|
+
else
|
26
|
+
ext, hash = ext.split '#'
|
27
|
+
warn index if ext.empty?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
warnings
|
33
|
+
end
|
34
|
+
|
35
|
+
FAIL = 'Relative markdown links must have an extension. [readme](readme.md)'
|
36
|
+
|
37
|
+
def fail
|
38
|
+
FAIL
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Appium
|
2
2
|
class Lint
|
3
|
-
VERSION = '0.0.
|
4
|
-
DATE = '2014-04-
|
3
|
+
VERSION = '0.0.4' unless defined? ::Appium::Lint::VERSION
|
4
|
+
DATE = '2014-04-26' unless defined? ::Appium::Lint::DATE
|
5
5
|
end
|
6
6
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
#### v0.0.2 2014-04-19
|
2
|
+
|
3
|
+
- [5bcd5c5](https://github.com/appium/appium_doc_lint/commit/5bcd5c58d25dace3ec356394d54f0a5d988602dd) Release 0.0.3
|
4
|
+
- [b77dbb8](https://github.com/appium/appium_doc_lint/commit/b77dbb8c2d262cd9254a9cd2cf79227400632720) Set exit code when issues are detected
|
5
|
+
- [aaf8ccf](https://github.com/appium/appium_doc_lint/commit/aaf8ccf1c596f4d50410622ecf6933c671b125b3) Improve test
|
6
|
+
- [0c62101](https://github.com/appium/appium_doc_lint/commit/0c6210113c7eb9ccf62a59f36d894dd58b7ad173) Make h1 duplicate detection code block aware
|
7
|
+
- [542859c](https://github.com/appium/appium_doc_lint/commit/542859c5059e411b483bfd74b9910b99ae58742d) Fix h1 detection and improve tests
|
8
|
+
- [3ab939a](https://github.com/appium/appium_doc_lint/commit/3ab939aea1989e823c1fd3c27d6428f539c212eb) Detect more than one h1 per doc
|
9
|
+
|
10
|
+
|
1
11
|
####
|
2
12
|
|
3
13
|
- [910d158](https://github.com/appium/appium_doc_lint/commit/910d1583b5286c9c13242f97722ce50c99023944) Release 0.0.2
|
data/spec/data/sub/3.md
CHANGED
data/spec/helper.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rspec'
|
3
3
|
require_relative '../lib/appium_doc_lint/lint'
|
4
4
|
require_relative '../lib/appium_doc_lint/lint/base'
|
5
|
+
require_relative '../lib/appium_doc_lint/lint/ext_missing'
|
5
6
|
require_relative '../lib/appium_doc_lint/lint/h1_missing'
|
6
7
|
require_relative '../lib/appium_doc_lint/lint/h1_multiple'
|
7
8
|
require_relative '../lib/appium_doc_lint/lint/h1_invalid'
|
data/spec/lint_spec.rb
CHANGED
@@ -16,7 +16,8 @@ class Appium::Lint
|
|
16
16
|
7 => [LineBreakInvalid::FAIL],
|
17
17
|
9 => [H1Multiple::FAIL],
|
18
18
|
11 => [H456Invalid::FAIL],
|
19
|
-
21
|
19
|
+
21 => [H1Multiple::FAIL],
|
20
|
+
23 => [ExtMissing::FAIL] } }
|
20
21
|
|
21
22
|
# convert path/to/0.md to 0.md
|
22
23
|
actual.keys.each do |key|
|
@@ -45,6 +46,7 @@ class Appium::Lint
|
|
45
46
|
9: #{H1Multiple::FAIL}
|
46
47
|
11: #{H456Invalid::FAIL}
|
47
48
|
21: #{H1Multiple::FAIL}
|
49
|
+
23: #{ExtMissing::FAIL}
|
48
50
|
REPORT
|
49
51
|
|
50
52
|
expect(actual).to eq(expected)
|
@@ -282,4 +284,35 @@ markdown--
|
|
282
284
|
expect(actual).to eq(expected)
|
283
285
|
end
|
284
286
|
end
|
287
|
+
|
288
|
+
describe ExtMissing do
|
289
|
+
it 'detects missing extensions in markdown links' do
|
290
|
+
data = <<-MARKDOWN
|
291
|
+
[link to read](readme)
|
292
|
+
[ok](ok#ok)
|
293
|
+
[intro](intro#start)
|
294
|
+
MARKDOWN
|
295
|
+
rule = ExtMissing.new data: data
|
296
|
+
expected = { 1 => [rule.fail],
|
297
|
+
2 => [rule.fail],
|
298
|
+
3 => [rule.fail] }
|
299
|
+
actual = rule.call
|
300
|
+
|
301
|
+
expect(actual).to eq(expected)
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'detects accepts valid links' do
|
305
|
+
data = <<-MARKDOWN
|
306
|
+
[link to read](readme.md)
|
307
|
+
[README](README.md)
|
308
|
+
[intro](intro.md#start)
|
309
|
+
[example](https://example.com/)
|
310
|
+
MARKDOWN
|
311
|
+
rule = ExtMissing.new data: data
|
312
|
+
expected = {}
|
313
|
+
actual = rule.call
|
314
|
+
|
315
|
+
expect(actual).to eq(expected)
|
316
|
+
end
|
317
|
+
end
|
285
318
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_doc_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/appium_doc_lint.rb
|
72
72
|
- lib/appium_doc_lint/lint.rb
|
73
73
|
- lib/appium_doc_lint/lint/base.rb
|
74
|
+
- lib/appium_doc_lint/lint/ext_missing.rb
|
74
75
|
- lib/appium_doc_lint/lint/h1_invalid.rb
|
75
76
|
- lib/appium_doc_lint/lint/h1_missing.rb
|
76
77
|
- lib/appium_doc_lint/lint/h1_multiple.rb
|