danger-changelog 0.3.0 → 0.4.0
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 +11 -7
- data/.rubocop_todo.yml +5 -36
- data/CHANGELOG.md +9 -4
- data/README.md +1 -1
- data/danger-changelog.gemspec +2 -2
- data/lib/changelog/changelog_file.rb +2 -0
- data/lib/changelog/changelog_line/changelog_entry_line.rb +5 -0
- data/lib/changelog/changelog_line/changelog_header_line.rb +7 -1
- data/lib/changelog/changelog_line/changelog_line_parser.rb +1 -0
- data/lib/changelog/changelog_line/changelog_placeholder_line.rb +1 -0
- data/lib/changelog/gem_version.rb +1 -1
- data/lib/changelog/plugin.rb +3 -3
- data/spec/changelog_entry_line_spec.rb +1 -1
- data/spec/changelog_file_spec.rb +31 -4
- data/spec/changelog_header_line_spec.rb +43 -2
- data/spec/changelog_line_parser_spec.rb +1 -1
- data/spec/changelog_placeholder_line_spec.rb +1 -1
- data/spec/changelog_spec.rb +8 -8
- data/spec/config_spec.rb +1 -1
- data/spec/fixtures/changelogs/with_bad_dates.md +25 -0
- data/spec/fixtures/changelogs/with_bad_semver.md +12 -0
- data/spec/spec_helper.rb +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7fb5aff25f4ccf5fc339a15cf5a542348e92929f87d0b41945f190c08caee0db
|
|
4
|
+
data.tar.gz: d4f672480a57b9c21fcd75f68ec0153917ce308d263e8cc4fe41df14be644c5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3623da33104a8ef38cc1a05916afc9ed22c1294e93e3e39c6520d29b69ded74357d31045398b25c596a8083abd2b5194a0653248b4f151512b94fec08468f18c
|
|
7
|
+
data.tar.gz: b31a67bcd03090eb70bdbbd5b64b8ba903a9df163b4a60dae4f18757efab974bcdf0c252ea5ad88d5ef3949e8c9c885769456f1efab4271a20018b883b7ff570
|
data/.rubocop.yml
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
Include:
|
|
3
|
-
- Rakefile
|
|
4
2
|
Exclude:
|
|
5
3
|
- vendor/**/*
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Naming/MethodName:
|
|
6
|
+
Enabled: false
|
|
7
|
+
|
|
8
|
+
Style/Documentation:
|
|
9
|
+
Enabled: false
|
|
10
|
+
|
|
11
|
+
Metrics:
|
|
12
|
+
Enabled: false
|
|
13
|
+
|
|
14
|
+
Metrics/LineLength:
|
|
15
|
+
Max: 256
|
|
12
16
|
|
|
13
17
|
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2018-
|
|
3
|
+
# on 2018-12-16 11:08:47 -0500 using RuboCop version 0.61.1.
|
|
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
|
|
@@ -20,28 +20,10 @@ Lint/DuplicateMethods:
|
|
|
20
20
|
- 'lib/changelog/config.rb'
|
|
21
21
|
|
|
22
22
|
# Offense count: 1
|
|
23
|
-
|
|
23
|
+
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
|
|
24
|
+
Lint/UselessAccessModifier:
|
|
24
25
|
Exclude:
|
|
25
|
-
- 'lib/changelog/changelog_line/
|
|
26
|
-
|
|
27
|
-
# Offense count: 1
|
|
28
|
-
Metrics/AbcSize:
|
|
29
|
-
Max: 25
|
|
30
|
-
|
|
31
|
-
# Offense count: 3
|
|
32
|
-
# Configuration parameters: CountComments.
|
|
33
|
-
Metrics/MethodLength:
|
|
34
|
-
Max: 14
|
|
35
|
-
|
|
36
|
-
# Offense count: 4
|
|
37
|
-
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
38
|
-
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
|
39
|
-
Naming/FileName:
|
|
40
|
-
Exclude:
|
|
41
|
-
- 'Dangerfile'
|
|
42
|
-
- 'Gemfile'
|
|
43
|
-
- 'Guardfile'
|
|
44
|
-
- 'danger-changelog.gemspec'
|
|
26
|
+
- 'lib/changelog/changelog_line/changelog_line_parser.rb'
|
|
45
27
|
|
|
46
28
|
# Offense count: 2
|
|
47
29
|
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
|
|
@@ -54,28 +36,15 @@ Naming/PredicateName:
|
|
|
54
36
|
- 'spec/**/*'
|
|
55
37
|
- 'lib/changelog/plugin.rb'
|
|
56
38
|
|
|
57
|
-
# Offense count: 3
|
|
58
|
-
Style/Documentation:
|
|
59
|
-
Exclude:
|
|
60
|
-
- 'spec/**/*'
|
|
61
|
-
- 'test/**/*'
|
|
62
|
-
- 'lib/changelog/config.rb'
|
|
63
|
-
- 'lib/changelog/plugin.rb'
|
|
64
|
-
|
|
65
39
|
# Offense count: 3
|
|
66
40
|
Style/DoubleNegation:
|
|
67
41
|
Exclude:
|
|
68
42
|
- 'lib/changelog/changelog_file.rb'
|
|
69
43
|
|
|
70
44
|
# Offense count: 1
|
|
45
|
+
# Cop supports --auto-correct.
|
|
71
46
|
# Configuration parameters: EnforcedStyle.
|
|
72
47
|
# SupportedStyles: module_function, extend_self
|
|
73
48
|
Style/ModuleFunction:
|
|
74
49
|
Exclude:
|
|
75
50
|
- 'lib/changelog/config.rb'
|
|
76
|
-
|
|
77
|
-
# Offense count: 112
|
|
78
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
79
|
-
# URISchemes: http, https
|
|
80
|
-
Metrics/LineLength:
|
|
81
|
-
Max: 254
|
data/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
-
### 0.
|
|
3
|
+
### 0.4.0 (2018/12/16)
|
|
4
|
+
|
|
5
|
+
* [#35](https://github.com/dblock/danger-changelog/pull/35): Check that dates in headers are ISO8601 - [@dblock](https://github.com/dblock).
|
|
6
|
+
* [#36](https://github.com/dblock/danger-changelog/pull/36): Check the format of the version number - [@dblock](https://github.com/dblock).
|
|
7
|
+
|
|
8
|
+
### 0.3.0 (2018/5/17)
|
|
4
9
|
|
|
5
10
|
* [#25](https://github.com/dblock/danger-changelog/pull/25): Add information how to configure the plugin in README.md - [@antondomashnev](https://github.com/antondomashnev).
|
|
6
11
|
* [#24](https://github.com/dblock/danger-changelog/pull/24): Added support for custom '* Your contribution here.' line - [@antondomashnev](https://github.com/antondomashnev).
|
|
7
12
|
* [#31](https://github.com/dblock/danger-changelog/pull/31): Stop checking for placeholder line when `Danger::Changelog.config.placeholder_line` is set to `nil` - [@dblock](https://github.com/dblock).
|
|
8
13
|
* [#28](https://github.com/dblock/danger-changelog/issues/28): Improve wording suggesting that CHANGELOG should be updated unless one is improving documentation - [@dblock](https://github.com/dblock).
|
|
9
14
|
|
|
10
|
-
### 0.2.1 (12/04
|
|
15
|
+
### 0.2.1 (2016/12/04)
|
|
11
16
|
|
|
12
17
|
* [#17](https://github.com/dblock/danger-changelog/pull/17): Fix: handle CHANGELOG lines that mistakenly start with a symbol other than * - [@antondomashnev](https://github.com/antondomashnev).
|
|
13
18
|
* [#19](https://github.com/dblock/danger-changelog/pull/19): Added: RELEASING.md document to formalize the process - [@antondomashnev](https://github.com/antondomashnev).
|
|
14
19
|
* [#20](https://github.com/dblock/danger-changelog/pull/20): Fix: flag extra period and column in CHANGELOG - [@antondomashnev](https://github.com/antondomashnev).
|
|
15
20
|
|
|
16
|
-
### 0.2.0 (11/21
|
|
21
|
+
### 0.2.0 (2016/11/21)
|
|
17
22
|
|
|
18
23
|
* [#13](https://github.com/dblock/danger-changelog/pull/13): Fix: suggested CHANGELOG entry may not be of correct format - [@dblock](https://github.com/dblock).
|
|
19
24
|
* [#18](https://github.com/dblock/danger-changelog/pull/18): Fix: incorrect CHANGELOG filename reported when file doesn't exist - [@dblock](https://github.com/dblock).
|
|
20
25
|
|
|
21
|
-
### 0.1.0 (8/26
|
|
26
|
+
### 0.1.0 (2016/8/26)
|
|
22
27
|
|
|
23
28
|
* [#2](https://github.com/dblock/danger-changelog/pull/2): Added `is_changelog_format_correct?` - [@dblock](https://github.com/dblock).
|
|
24
29
|
* [#1](https://github.com/dblock/danger-changelog/pull/1): Added `have_you_updated_changelog?`, have you updated CHANGELOG.md? - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# danger-changelog
|
|
2
2
|
|
|
3
3
|
A plugin for [danger.systems](http://danger.systems) that obsessive-compulsively lints your project’s `CHANGELOG.md`.
|
|
4
|
-
It can make sure, for example, that changes are attributed properly, and that they’re always terminated with a period.
|
|
4
|
+
It can make sure, for example, that changes are attributed properly, have a valid version number, a date in the ISO8601 format, and that they’re always terminated with a period.
|
|
5
5
|
|
|
6
6
|
[](https://badge.fury.io/rb/danger-changelog)
|
|
7
7
|
[](https://travis-ci.org/dblock/danger-changelog)
|
data/danger-changelog.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 'changelog/gem_version.rb'
|
|
4
4
|
|
|
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.add_development_dependency 'pry'
|
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
|
29
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 0.61.1'
|
|
30
30
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
|
31
31
|
end
|
|
@@ -7,6 +7,7 @@ module Danger
|
|
|
7
7
|
def valid?
|
|
8
8
|
return true if line =~ %r{^\*\s[\`[:upper:]].*[^.,] \- \[\@[\w\d\-\_]+\]\(https:\/\/github\.com\/.*[\w\d\-\_]+\).$}
|
|
9
9
|
return true if line =~ %r{^\*\s\[\#\d+\]\(https:\/\/github\.com\/.*\d+\)\: [\`[:upper:]].*[^.,] \- \[\@[\w\d\-\_]+\]\(https:\/\/github\.com\/.*[\w\d\-\_]+\).$}
|
|
10
|
+
|
|
10
11
|
false
|
|
11
12
|
end
|
|
12
13
|
|
|
@@ -34,24 +35,28 @@ module Danger
|
|
|
34
35
|
# checks whether line starts with *
|
|
35
36
|
def self.starts_with_star?(line)
|
|
36
37
|
return true if line =~ /^\*\s/
|
|
38
|
+
|
|
37
39
|
false
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
# checks whether line contains a MARKDOWN link to a PR
|
|
41
43
|
def self.with_pr_link?(line)
|
|
42
44
|
return true if line =~ %r{\[\#\d+\]\(http[s]?:\/\/github\.com\/.*\d+[\/]?\)}
|
|
45
|
+
|
|
43
46
|
false
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
# checks whether line contains a capitalized Text, treated as a description
|
|
47
50
|
def self.with_changelog_description?(line)
|
|
48
51
|
return true if line =~ /[\`[:upper:]].*/
|
|
52
|
+
|
|
49
53
|
false
|
|
50
54
|
end
|
|
51
55
|
|
|
52
56
|
# checks whether line contains a MARKDOWN link to an author
|
|
53
57
|
def self.with_author_link?(line)
|
|
54
58
|
return true if line =~ %r{\[\@[\w\d\-\_]+\]\(http[s]?:\/\/github\.com\/.*[\w\d\-\_]+[\/]?\)}
|
|
59
|
+
|
|
55
60
|
false
|
|
56
61
|
end
|
|
57
62
|
end
|
|
@@ -3,11 +3,17 @@ module Danger
|
|
|
3
3
|
# A CHANGELOG.md line represents the version header.
|
|
4
4
|
class ChangelogHeaderLine < ChangelogLine
|
|
5
5
|
def valid?
|
|
6
|
-
|
|
6
|
+
return true if line.strip =~ /^\#{1,4}\s[\w\s]*$/ # title
|
|
7
|
+
return true if line.strip =~ /^\#{1,4}\s(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ # no date at all
|
|
8
|
+
return true if line.strip =~ /^\#{1,4}\s(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?\s\(\w*\)$/ # next date
|
|
9
|
+
return true if line.strip =~ %r{^\#{1,4}\s(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?\s\(([0-9]{4})[-/]?(1[0-2]|0?[1-9])[-/]+(3[01]|0?[1-9]|[12][0-9])\)$} # iso 8601 date
|
|
10
|
+
|
|
11
|
+
false
|
|
7
12
|
end
|
|
8
13
|
|
|
9
14
|
def self.validates_as_changelog_line?(line)
|
|
10
15
|
return true if line =~ /^\#{1,4}\s.+/
|
|
16
|
+
|
|
11
17
|
false
|
|
12
18
|
end
|
|
13
19
|
end
|
data/lib/changelog/plugin.rb
CHANGED
|
@@ -50,7 +50,7 @@ Here's an example of a #{filename} entry:
|
|
|
50
50
|
```markdown
|
|
51
51
|
#{Danger::Changelog::ChangelogEntryLine.example(github)}
|
|
52
52
|
```
|
|
53
|
-
MARKDOWN
|
|
53
|
+
MARKDOWN
|
|
54
54
|
warn "Unless you're refactoring existing code or improving documentation, please update #{filename}.", sticky: false
|
|
55
55
|
false
|
|
56
56
|
end
|
|
@@ -65,9 +65,9 @@ MARKDOWN
|
|
|
65
65
|
markdown <<-MARKDOWN
|
|
66
66
|
```markdown
|
|
67
67
|
#{line}```
|
|
68
|
-
MARKDOWN
|
|
68
|
+
MARKDOWN
|
|
69
69
|
end
|
|
70
|
-
messaging.fail("One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to periods and
|
|
70
|
+
messaging.fail("One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats.", sticky: false) if changelog_file.bad_lines?
|
|
71
71
|
messaging.fail("Please put back the `#{Danger::Changelog.config.placeholder_line.chomp}` line into #{filename}.", sticky: false) unless changelog_file.your_contribution_here? || !Danger::Changelog.config.placeholder_line?
|
|
72
72
|
changelog_file.good?
|
|
73
73
|
else
|
data/spec/changelog_file_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::Changelog::ChangelogFile do
|
|
4
4
|
let(:filename) { 'CHANGELOG.md' }
|
|
@@ -6,7 +6,7 @@ describe Danger::Changelog::ChangelogFile do
|
|
|
6
6
|
Danger::Changelog::ChangelogFile.new(filename)
|
|
7
7
|
end
|
|
8
8
|
context 'minimal example' do
|
|
9
|
-
let(:filename) { File.expand_path('
|
|
9
|
+
let(:filename) { File.expand_path('fixtures/changelogs/minimal.md', __dir__) }
|
|
10
10
|
it 'exists?' do
|
|
11
11
|
expect(subject.exists?).to be true
|
|
12
12
|
end
|
|
@@ -22,7 +22,7 @@ describe Danger::Changelog::ChangelogFile do
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
context 'missing your contribution here' do
|
|
25
|
-
let(:filename) { File.expand_path('
|
|
25
|
+
let(:filename) { File.expand_path('fixtures/changelogs/missing_your_contribution_here.md', __dir__) }
|
|
26
26
|
it 'is valid' do
|
|
27
27
|
expect(subject.bad_lines?).to be false
|
|
28
28
|
end
|
|
@@ -41,7 +41,7 @@ describe Danger::Changelog::ChangelogFile do
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
context 'with bad lines' do
|
|
44
|
-
let(:filename) { File.expand_path('
|
|
44
|
+
let(:filename) { File.expand_path('fixtures/changelogs/with_bad_lines.md', __dir__) }
|
|
45
45
|
it 'is invalid' do
|
|
46
46
|
expect(subject.bad_lines?).to be true
|
|
47
47
|
end
|
|
@@ -58,4 +58,31 @@ describe Danger::Changelog::ChangelogFile do
|
|
|
58
58
|
expect(subject.your_contribution_here?).to be true
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
|
+
context 'with bad dates' do
|
|
62
|
+
let(:filename) { File.expand_path('fixtures/changelogs/with_bad_dates.md', __dir__) }
|
|
63
|
+
it 'is invalid' do
|
|
64
|
+
expect(subject.bad_lines?).to be true
|
|
65
|
+
end
|
|
66
|
+
it 'reports all bad dates' do
|
|
67
|
+
expect(subject.bad_lines).to eq [
|
|
68
|
+
"### 1.2.3 (1/2/2018)\n",
|
|
69
|
+
"### 1.2.3 (2018/13/1)\n",
|
|
70
|
+
"### 1.2.3 (2018/13)\n",
|
|
71
|
+
"### 1.2.3 (2018/1/1/3)\n"
|
|
72
|
+
]
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
context 'with bad semver' do
|
|
76
|
+
let(:filename) { File.expand_path('fixtures/changelogs/with_bad_semver.md', __dir__) }
|
|
77
|
+
it 'is invalid' do
|
|
78
|
+
expect(subject.bad_lines?).to be true
|
|
79
|
+
end
|
|
80
|
+
it 'reports all bad dates' do
|
|
81
|
+
expect(subject.bad_lines).to eq [
|
|
82
|
+
"### 0 (2018/1/1)\n",
|
|
83
|
+
"### 0. (2018/1/1)\n",
|
|
84
|
+
"### 0.1. (2018/1/1)\n"
|
|
85
|
+
]
|
|
86
|
+
end
|
|
87
|
+
end
|
|
61
88
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require File.expand_path('
|
|
1
|
+
require File.expand_path('spec_helper', __dir__)
|
|
2
2
|
|
|
3
3
|
describe Danger::Changelog::ChangelogHeaderLine do
|
|
4
4
|
context 'changelog line' do
|
|
@@ -7,6 +7,7 @@ describe Danger::Changelog::ChangelogHeaderLine do
|
|
|
7
7
|
expect(described_class.validates_as_changelog_line?('## Version 1.0.1')).to be true
|
|
8
8
|
expect(described_class.validates_as_changelog_line?('### Lollypop')).to be true
|
|
9
9
|
expect(described_class.validates_as_changelog_line?('#### Four hashes is too much')).to be true
|
|
10
|
+
expect(described_class.validates_as_changelog_line?('# 1.0.1 (1/2/3)')).to be true
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
it 'doesnt validate as changelog line' do
|
|
@@ -29,8 +30,32 @@ describe Danger::Changelog::ChangelogHeaderLine do
|
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
context 'with a Next date' do
|
|
34
|
+
subject { Danger::Changelog::ChangelogHeaderLine.new('# 1.0.1 (Next)') }
|
|
35
|
+
|
|
36
|
+
it 'is valid' do
|
|
37
|
+
expect(subject.valid?).to be true
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context 'with a date in ISO 8601 format' do
|
|
42
|
+
subject { Danger::Changelog::ChangelogHeaderLine.new('# 1.0.1 (2018/1/2)') }
|
|
43
|
+
|
|
44
|
+
it 'is valid' do
|
|
45
|
+
expect(subject.valid?).to be true
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context 'with a date not in ISO 8601 format' do
|
|
50
|
+
subject { Danger::Changelog::ChangelogHeaderLine.new('# 1.0.1 (1/2/2018)') }
|
|
51
|
+
|
|
52
|
+
it 'is valid' do
|
|
53
|
+
expect(subject.valid?).to be false
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
32
57
|
context 'when two hash symbols' do
|
|
33
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('##
|
|
58
|
+
subject { Danger::Changelog::ChangelogHeaderLine.new('## 1.0.1') }
|
|
34
59
|
|
|
35
60
|
it 'is valid' do
|
|
36
61
|
expect(subject.valid?).to be true
|
|
@@ -100,5 +125,21 @@ describe Danger::Changelog::ChangelogHeaderLine do
|
|
|
100
125
|
expect(subject.invalid?).to be true
|
|
101
126
|
end
|
|
102
127
|
end
|
|
128
|
+
|
|
129
|
+
context 'with a string as semver' do
|
|
130
|
+
subject { Danger::Changelog::ChangelogHeaderLine.new('# Invalid (Next)') }
|
|
131
|
+
|
|
132
|
+
it 'is invalid' do
|
|
133
|
+
expect(subject.valid?).to be false
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
context 'with an invalid semver' do
|
|
138
|
+
subject { Danger::Changelog::ChangelogHeaderLine.new('# 0.1.') }
|
|
139
|
+
|
|
140
|
+
it 'is invalid' do
|
|
141
|
+
expect(subject.valid?).to be false
|
|
142
|
+
end
|
|
143
|
+
end
|
|
103
144
|
end
|
|
104
145
|
end
|
data/spec/changelog_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::Changelog do
|
|
4
4
|
it 'is a Danger plugin' do
|
|
@@ -6,7 +6,7 @@ describe Danger::Changelog do
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
describe 'with Dangerfile' do
|
|
9
|
-
let(:filename) { File.expand_path('
|
|
9
|
+
let(:filename) { File.expand_path('fixtures/changelogs/minimal.md', __dir__) }
|
|
10
10
|
let(:dangerfile) { testing_dangerfile }
|
|
11
11
|
let(:changelog) do
|
|
12
12
|
dangerfile.changelog.filename = filename
|
|
@@ -108,7 +108,7 @@ describe Danger::Changelog do
|
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
-
let(:filename) { File.expand_path('
|
|
111
|
+
let(:filename) { File.expand_path('fixtures/changelogs/customized.md', __dir__) }
|
|
112
112
|
it 'is ok' do
|
|
113
113
|
expect(subject).to be true
|
|
114
114
|
expect(status_report[:errors]).to eq []
|
|
@@ -118,7 +118,7 @@ describe Danger::Changelog do
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
context 'missing your contribution here' do
|
|
121
|
-
let(:filename) { File.expand_path('
|
|
121
|
+
let(:filename) { File.expand_path('fixtures/changelogs/missing_your_contribution_here.md', __dir__) }
|
|
122
122
|
|
|
123
123
|
context 'when placeholder line is customized' do
|
|
124
124
|
before do
|
|
@@ -161,7 +161,7 @@ describe Danger::Changelog do
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
context 'minimal example' do
|
|
164
|
-
let(:filename) { File.expand_path('
|
|
164
|
+
let(:filename) { File.expand_path('fixtures/changelogs/minimal.md', __dir__) }
|
|
165
165
|
it 'is ok' do
|
|
166
166
|
expect(subject).to be true
|
|
167
167
|
expect(status_report[:errors]).to eq []
|
|
@@ -178,7 +178,7 @@ describe Danger::Changelog do
|
|
|
178
178
|
|
|
179
179
|
it 'complains' do
|
|
180
180
|
expect(subject).to be false
|
|
181
|
-
expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to periods and
|
|
181
|
+
expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats."]
|
|
182
182
|
expect(status_report[:warnings]).to eq []
|
|
183
183
|
expect(status_report[:markdowns].map(&:message)).to eq [
|
|
184
184
|
"```markdown\n* Your contribution here.\n```\n"
|
|
@@ -188,10 +188,10 @@ describe Danger::Changelog do
|
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
context 'with bad lines' do
|
|
191
|
-
let(:filename) { File.expand_path('
|
|
191
|
+
let(:filename) { File.expand_path('fixtures/changelogs/with_bad_lines.md', __dir__) }
|
|
192
192
|
it 'complains' do
|
|
193
193
|
expect(subject).to be false
|
|
194
|
-
expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to periods and
|
|
194
|
+
expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats."]
|
|
195
195
|
expect(status_report[:warnings]).to eq []
|
|
196
196
|
expect(status_report[:markdowns].map(&:message)).to eq [
|
|
197
197
|
"```markdown\nMissing star - [@dblock](https://github.com/dblock).\n```\n",
|
data/spec/config_spec.rb
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## Changelog
|
|
2
|
+
|
|
3
|
+
### 1.2.3 (Next)
|
|
4
|
+
|
|
5
|
+
* Your contribution here.
|
|
6
|
+
|
|
7
|
+
### 1.2.3 (2018/1/2)
|
|
8
|
+
|
|
9
|
+
* [#1](https://github.com/dblock/danger-changelog/pull/1): Change - [@dblock](https://github.com/dblock).
|
|
10
|
+
|
|
11
|
+
### 1.2.3 (1/2/2018)
|
|
12
|
+
|
|
13
|
+
* [#1](https://github.com/dblock/danger-changelog/pull/1): Change - [@dblock](https://github.com/dblock).
|
|
14
|
+
|
|
15
|
+
### 1.2.3 (2018/13/1)
|
|
16
|
+
|
|
17
|
+
* [#1](https://github.com/dblock/danger-changelog/pull/1): Change - [@dblock](https://github.com/dblock).
|
|
18
|
+
|
|
19
|
+
### 1.2.3 (2018/13)
|
|
20
|
+
|
|
21
|
+
* [#1](https://github.com/dblock/danger-changelog/pull/1): Change - [@dblock](https://github.com/dblock).
|
|
22
|
+
|
|
23
|
+
### 1.2.3 (2018/1/1/3)
|
|
24
|
+
|
|
25
|
+
* [#1](https://github.com/dblock/danger-changelog/pull/1): Change - [@dblock](https://github.com/dblock).
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-changelog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
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-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: danger-plugin-api
|
|
@@ -128,14 +128,14 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 0.
|
|
131
|
+
version: 0.61.1
|
|
132
132
|
type: :development
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 0.
|
|
138
|
+
version: 0.61.1
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: yard
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -195,7 +195,9 @@ files:
|
|
|
195
195
|
- spec/fixtures/changelogs/customized.md
|
|
196
196
|
- spec/fixtures/changelogs/minimal.md
|
|
197
197
|
- spec/fixtures/changelogs/missing_your_contribution_here.md
|
|
198
|
+
- spec/fixtures/changelogs/with_bad_dates.md
|
|
198
199
|
- spec/fixtures/changelogs/with_bad_lines.md
|
|
200
|
+
- spec/fixtures/changelogs/with_bad_semver.md
|
|
199
201
|
- spec/spec_helper.rb
|
|
200
202
|
homepage: https://github.com/dblock/danger-changelog
|
|
201
203
|
licenses:
|
|
@@ -217,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
217
219
|
version: '0'
|
|
218
220
|
requirements: []
|
|
219
221
|
rubyforge_project:
|
|
220
|
-
rubygems_version: 2.6
|
|
222
|
+
rubygems_version: 2.7.6
|
|
221
223
|
signing_key:
|
|
222
224
|
specification_version: 4
|
|
223
225
|
summary: A danger.systems plugin that is OCD about your CHANGELOG.
|
|
@@ -232,5 +234,7 @@ test_files:
|
|
|
232
234
|
- spec/fixtures/changelogs/customized.md
|
|
233
235
|
- spec/fixtures/changelogs/minimal.md
|
|
234
236
|
- spec/fixtures/changelogs/missing_your_contribution_here.md
|
|
237
|
+
- spec/fixtures/changelogs/with_bad_dates.md
|
|
235
238
|
- spec/fixtures/changelogs/with_bad_lines.md
|
|
239
|
+
- spec/fixtures/changelogs/with_bad_semver.md
|
|
236
240
|
- spec/spec_helper.rb
|