danger-changelog 0.6.1 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/danger.yml +23 -0
- data/.github/workflows/lint.yml +16 -0
- data/.github/workflows/test.yml +20 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -2
- data/.rubocop_todo.yml +127 -1
- data/CHANGELOG.md +10 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +4 -2
- data/README.md +1 -1
- data/RELEASING.md +1 -1
- data/danger-changelog.gemspec +2 -2
- data/lib/changelog/changelog_line/changelog_entry_line.rb +7 -7
- data/lib/changelog/changelog_line/changelog_header_line.rb +5 -5
- data/lib/changelog/changelog_line/changelog_line.rb +1 -2
- data/lib/changelog/config.rb +1 -1
- data/lib/changelog/gem_version.rb +1 -1
- data/lib/changelog/parsers/intridea_format.rb +7 -4
- data/lib/changelog/parsers/keep_a_changelog.rb +5 -5
- data/lib/changelog/plugin.rb +1 -1
- data/spec/changelog_spec.rb +10 -16
- data/spec/config_spec.rb +15 -2
- data/spec/intridea/changelog_entry_line_spec.rb +3 -0
- data/spec/intridea/changelog_file_spec.rb +27 -1
- data/spec/intridea/changelog_line_parser_spec.rb +5 -0
- data/spec/intridea/changelog_spec.rb +20 -2
- data/spec/intridea/fixtures/dates.md +3 -0
- data/spec/intridea/fixtures/validation_result.md +6 -0
- data/spec/keep_a_changelog/changelog_spec.rb +5 -2
- data/spec/plugin_spec.rb +2 -1
- data/spec/spec_helper.rb +3 -3
- metadata +13 -33
- data/.travis.yml +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13e8dd279d1b68b2703760929b9c2ab4420db154c5420f27c8f6e6a25834719
|
4
|
+
data.tar.gz: a6d5eb4a335dc87df1d586f7f644da0965bb88f7040049797684ac315b3c1ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ad171e3366fafab0a20cbf65b5a67e8b77d1fd0d0833f8c45d2668b7e796d51556e939c337ecb08ea67f23462a13902c31034a315102a596747a08e48ef8699
|
7
|
+
data.tar.gz: d191579322f931bbc1e4848cc7c4252c3a5a617a1e3291f9c96d11ceb2171156b487b9879ff5f6631a3de8c44c10b1388dcf2d8b1ce491588cb4248605dc0b7d
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Danger
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
types: [ opened, reopened, edited, synchronize ]
|
5
|
+
jobs:
|
6
|
+
danger:
|
7
|
+
name: Danger
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- name: Checkout
|
11
|
+
uses: actions/checkout@v3
|
12
|
+
with:
|
13
|
+
fetch-depth: 0
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7
|
18
|
+
bundler-cache: true
|
19
|
+
- name: Run Danger
|
20
|
+
run: |
|
21
|
+
# the personal token is public, this is ok, base64 encode to avoid tripping Github
|
22
|
+
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
|
23
|
+
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
|
@@ -0,0 +1,16 @@
|
|
1
|
+
name: Lint
|
2
|
+
on: [ push, pull_request ]
|
3
|
+
jobs:
|
4
|
+
rubocop:
|
5
|
+
name: RuboCop
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- name: Checkout
|
9
|
+
uses: actions/checkout@v3
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 2.7
|
14
|
+
bundler-cache: true
|
15
|
+
- name: RuboCop
|
16
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Test
|
2
|
+
on: [ push, pull_request ]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
name: Test (Ruby ${{ matrix.ruby-version }})
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
strategy:
|
8
|
+
fail-fast: false
|
9
|
+
matrix:
|
10
|
+
ruby-version: [ '2.7', '3.1', '3.3' ]
|
11
|
+
steps:
|
12
|
+
- name: Checkout
|
13
|
+
uses: actions/checkout@v3
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby-version }}
|
18
|
+
bundler-cache: true
|
19
|
+
- name: Run test
|
20
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
NewCops: enable
|
2
3
|
Exclude:
|
3
4
|
- vendor/**/*
|
4
5
|
|
@@ -11,7 +12,7 @@ Style/Documentation:
|
|
11
12
|
Metrics:
|
12
13
|
Enabled: false
|
13
14
|
|
14
|
-
|
15
|
+
Layout/LineLength:
|
15
16
|
Max: 256
|
16
17
|
|
17
18
|
Style/FrozenStringLiteralComment:
|
@@ -19,9 +20,12 @@ Style/FrozenStringLiteralComment:
|
|
19
20
|
|
20
21
|
Naming/PredicateName:
|
21
22
|
Enabled: true
|
22
|
-
|
23
|
+
AllowedMethods:
|
23
24
|
- is_a?
|
24
25
|
- have_you_updated_changelog?
|
25
26
|
- is_changelog_format_correct?
|
26
27
|
|
27
28
|
inherit_from: .rubocop_todo.yml
|
29
|
+
require:
|
30
|
+
- rubocop-rake
|
31
|
+
- rubocop-rspec
|
data/.rubocop_todo.yml
CHANGED
@@ -1,7 +1,133 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-04-12 18:13:29 UTC using RuboCop version 1.63.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
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Severity, Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'danger-changelog.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 3
|
17
|
+
# This cop supports safe autocorrection (--autocorrect).
|
18
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
19
|
+
# URISchemes: http, https
|
20
|
+
Layout/LineLength:
|
21
|
+
Exclude:
|
22
|
+
- 'spec/intridea/changelog_spec.rb'
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
26
|
+
Lint/DuplicateBranch:
|
27
|
+
Exclude:
|
28
|
+
- 'lib/changelog/plugin.rb'
|
29
|
+
|
30
|
+
# Offense count: 2
|
31
|
+
Lint/MixedRegexpCaptureTypes:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/changelog/changelog_line/changelog_header_line.rb'
|
34
|
+
|
35
|
+
# Offense count: 30
|
36
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
37
|
+
# Prefixes: when, with, without
|
38
|
+
RSpec/ContextWording:
|
39
|
+
Exclude:
|
40
|
+
- 'spec/changelog_spec.rb'
|
41
|
+
- 'spec/config_spec.rb'
|
42
|
+
- 'spec/intridea/changelog_entry_line_spec.rb'
|
43
|
+
- 'spec/intridea/changelog_file_spec.rb'
|
44
|
+
- 'spec/intridea/changelog_header_line_spec.rb'
|
45
|
+
- 'spec/intridea/changelog_line_parser_spec.rb'
|
46
|
+
- 'spec/intridea/changelog_spec.rb'
|
47
|
+
- 'spec/keep_a_changelog/changelog_spec.rb'
|
48
|
+
|
49
|
+
# Offense count: 9
|
50
|
+
# Configuration parameters: CountAsOne.
|
51
|
+
RSpec/ExampleLength:
|
52
|
+
Max: 12
|
53
|
+
|
54
|
+
# Offense count: 10
|
55
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
56
|
+
# Include: **/*_spec*rb*, **/spec/**/*
|
57
|
+
RSpec/FilePath:
|
58
|
+
Exclude:
|
59
|
+
- 'spec/changelog_spec.rb'
|
60
|
+
- 'spec/config_spec.rb'
|
61
|
+
- 'spec/intridea/changelog_entry_line_spec.rb'
|
62
|
+
- 'spec/intridea/changelog_file_spec.rb'
|
63
|
+
- 'spec/intridea/changelog_header_line_spec.rb'
|
64
|
+
- 'spec/intridea/changelog_line_parser_spec.rb'
|
65
|
+
- 'spec/intridea/changelog_placeholder_line_spec.rb'
|
66
|
+
- 'spec/intridea/changelog_spec.rb'
|
67
|
+
- 'spec/keep_a_changelog/changelog_spec.rb'
|
68
|
+
- 'spec/plugin_spec.rb'
|
69
|
+
|
70
|
+
# Offense count: 25
|
71
|
+
RSpec/MultipleExpectations:
|
72
|
+
Max: 8
|
73
|
+
|
74
|
+
# Offense count: 44
|
75
|
+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
76
|
+
# SupportedStyles: always, named_only
|
77
|
+
RSpec/NamedSubject:
|
78
|
+
Exclude:
|
79
|
+
- 'spec/changelog_spec.rb'
|
80
|
+
- 'spec/intridea/changelog_file_spec.rb'
|
81
|
+
- 'spec/intridea/changelog_spec.rb'
|
82
|
+
- 'spec/keep_a_changelog/changelog_spec.rb'
|
83
|
+
- 'spec/plugin_spec.rb'
|
84
|
+
|
85
|
+
# Offense count: 32
|
86
|
+
# Configuration parameters: AllowedGroups.
|
87
|
+
RSpec/NestedGroups:
|
88
|
+
Max: 7
|
89
|
+
|
90
|
+
# Offense count: 2
|
91
|
+
RSpec/RepeatedExampleGroupBody:
|
92
|
+
Exclude:
|
93
|
+
- 'spec/intridea/changelog_header_line_spec.rb'
|
94
|
+
|
95
|
+
# Offense count: 2
|
96
|
+
RSpec/RepeatedExampleGroupDescription:
|
97
|
+
Exclude:
|
98
|
+
- 'spec/intridea/changelog_header_line_spec.rb'
|
99
|
+
|
100
|
+
# Offense count: 4
|
101
|
+
RSpec/RepeatedIncludeExample:
|
102
|
+
Exclude:
|
103
|
+
- 'spec/intridea/changelog_entry_line_spec.rb'
|
104
|
+
- 'spec/intridea/changelog_header_line_spec.rb'
|
105
|
+
|
106
|
+
# Offense count: 10
|
107
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
108
|
+
# Include: **/*_spec.rb
|
109
|
+
RSpec/SpecFilePathFormat:
|
110
|
+
Exclude:
|
111
|
+
- '**/spec/routing/**/*'
|
112
|
+
- 'spec/changelog_spec.rb'
|
113
|
+
- 'spec/config_spec.rb'
|
114
|
+
- 'spec/intridea/changelog_entry_line_spec.rb'
|
115
|
+
- 'spec/intridea/changelog_file_spec.rb'
|
116
|
+
- 'spec/intridea/changelog_header_line_spec.rb'
|
117
|
+
- 'spec/intridea/changelog_line_parser_spec.rb'
|
118
|
+
- 'spec/intridea/changelog_placeholder_line_spec.rb'
|
119
|
+
- 'spec/intridea/changelog_spec.rb'
|
120
|
+
- 'spec/keep_a_changelog/changelog_spec.rb'
|
121
|
+
- 'spec/plugin_spec.rb'
|
122
|
+
|
123
|
+
# Offense count: 1
|
124
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
125
|
+
RSpec/VerifiedDoubles:
|
126
|
+
Exclude:
|
127
|
+
- 'spec/intridea/changelog_entry_line_spec.rb'
|
128
|
+
|
129
|
+
# Offense count: 1
|
130
|
+
# This cop supports safe autocorrection (--autocorrect).
|
131
|
+
Rake/Desc:
|
132
|
+
Exclude:
|
133
|
+
- 'Rakefile'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
### 0.7.1 (2024/04/12)
|
4
|
+
|
5
|
+
* [#63](https://github.com/dblock/danger-changelog/pull/63): Fix: report on lines that start with a - and cannot be parsed - [@dblock](https://github.com/dblock).
|
6
|
+
* [#64](https://github.com/dblock/danger-changelog/pull/64): Upgraded to RuboCop 1.63.1 - [@dblock](https://github.com/dblock).
|
7
|
+
|
8
|
+
### 0.7.0 (2023/11/21)
|
9
|
+
|
10
|
+
* [#62](https://github.com/dblock/danger-changelog/pull/62): Migrate CI from Travis to GitHub Actions - [@mathroule](https://github.com/mathroule).
|
11
|
+
* [#61](https://github.com/dblock/danger-changelog/pull/61): Add support for ISO date & time - [@mathroule](https://github.com/mathroule).
|
12
|
+
|
3
13
|
### 0.6.1 (2020/05/08)
|
4
14
|
|
5
15
|
* [#33](https://github.com/dblock/danger-changelog/issues/33): Attempt to point out known problems in Intridea format - [@dblock](https://github.com/dblock).
|
data/CONTRIBUTING.md
CHANGED
@@ -114,7 +114,7 @@ git push origin my-feature-branch -f
|
|
114
114
|
|
115
115
|
### Check on Your Pull Request
|
116
116
|
|
117
|
-
Go back to your pull request after a few minutes and see whether it passed muster with
|
117
|
+
Go back to your pull request after a few minutes and see whether it passed muster with GitHub Actions. Everything should look green, otherwise fix issues and amend your commit as described above.
|
118
118
|
|
119
119
|
### Be Patient
|
120
120
|
|
data/Gemfile
CHANGED
@@ -10,8 +10,10 @@ group :development, :test do
|
|
10
10
|
gem 'guard-rspec', '~> 4.7'
|
11
11
|
gem 'listen', '3.0.7'
|
12
12
|
gem 'pry'
|
13
|
-
gem 'rake', '~>
|
13
|
+
gem 'rake', '~> 13.2.1'
|
14
14
|
gem 'rspec', '~> 3.4'
|
15
|
-
gem 'rubocop', '~>
|
15
|
+
gem 'rubocop', '~> 1.63.1'
|
16
|
+
gem 'rubocop-rake'
|
17
|
+
gem 'rubocop-rspec'
|
16
18
|
gem 'yard', '~> 0.9.11'
|
17
19
|
end
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A plugin for [danger.systems](http://danger.systems) that obsessive-compulsively
|
|
4
4
|
It can make sure, for example, that changes are attributed properly, have a valid version number, a date in the ISO8601 format, balanced parenthesis and brackets, and that they’re always terminated with a period.
|
5
5
|
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/danger-changelog.svg)](https://badge.fury.io/rb/danger-changelog)
|
7
|
-
[![Build Status](https://
|
7
|
+
[![Build Status](https://github.com/dblock/danger-changelog/actions/workflows/test.yml/badge.svg?branch=master&event=push)](https://github.com/dblock/danger-changelog/actions/workflows/test.yml)
|
8
8
|
|
9
9
|
# Table of Contents
|
10
10
|
|
data/RELEASING.md
CHANGED
@@ -11,7 +11,7 @@ bundle install
|
|
11
11
|
rake
|
12
12
|
```
|
13
13
|
|
14
|
-
Check that the last build succeeded in [
|
14
|
+
Check that the last build succeeded in [GitHub Actions](https://github.com/dblock/danger-changelog/actions) for all supported platforms.
|
15
15
|
|
16
16
|
Increment the version, modify [lib/changelog/gem_version.rb](lib/changelog/gem_version.rb).
|
17
17
|
|
data/danger-changelog.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'changelog/gem_version
|
3
|
+
require 'changelog/gem_version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'danger-changelog'
|
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
17
|
spec.require_paths = ['lib']
|
19
18
|
|
20
19
|
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
20
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
21
21
|
end
|
@@ -12,8 +12,8 @@ module Danger
|
|
12
12
|
validation_result.error! 'too many parenthesis' unless balanced?(line)
|
13
13
|
return false if validation_result.invalid?
|
14
14
|
|
15
|
-
return true if line =~ %r{^\*\s[
|
16
|
-
return true if line =~ %r{^\*\s\[\#\d+\]\(https
|
15
|
+
return true if line =~ %r{^\*\s[`[:upper:]].*[^.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$}
|
16
|
+
return true if line =~ %r{^\*\s\[\#\d+\]\(https://github\.com/.*\d+\): [`[:upper:]].*[^.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$}
|
17
17
|
|
18
18
|
validation_result.error! 'does not start with a star' unless ChangelogEntryLine.starts_with_star?(line)
|
19
19
|
validation_result.error! 'does not include a pull request link' unless ChangelogEntryLine.with_pr_link?(line)
|
@@ -22,8 +22,8 @@ module Danger
|
|
22
22
|
validation_result.error! 'has an extra trailing space' if ChangelogEntryLine.ends_with_space?(line)
|
23
23
|
validation_result.error! 'is missing a period at the end of the line' unless ChangelogEntryLine.ends_with_period?(line)
|
24
24
|
validation_result.error! 'has an extra period or comma at the end of the description' if
|
25
|
-
line =~ %r{^\*\s[
|
26
|
-
line =~ %r{^\*\s\[\#\d+\]\(https
|
25
|
+
line =~ %r{^\*\s[`[:upper:]].*[.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$} ||
|
26
|
+
line =~ %r{^\*\s\[\#\d+\]\(https://github\.com/.*\d+\): [`[:upper:]].*[.,] - \[@[\w\d\-_]+\]\(https://github\.com/.*[\w\d\-_]+\).$}
|
27
27
|
|
28
28
|
false
|
29
29
|
end
|
@@ -72,21 +72,21 @@ module Danger
|
|
72
72
|
|
73
73
|
# checks whether line contains a MARKDOWN link to a PR
|
74
74
|
def self.with_pr_link?(line)
|
75
|
-
return true if line =~ %r{\[\#\d+\]\(
|
75
|
+
return true if line =~ %r{\[\#\d+\]\(https?://github\.com/.*\d+/?\)}
|
76
76
|
|
77
77
|
false
|
78
78
|
end
|
79
79
|
|
80
80
|
# checks whether line contains a capitalized Text, treated as a description
|
81
81
|
def self.with_changelog_description?(line)
|
82
|
-
return true if line =~ /[
|
82
|
+
return true if line =~ /[`[:upper:]].*/
|
83
83
|
|
84
84
|
false
|
85
85
|
end
|
86
86
|
|
87
87
|
# checks whether line contains a MARKDOWN link to an author
|
88
88
|
def self.with_author_link?(line)
|
89
|
-
return true if line =~ %r{\[
|
89
|
+
return true if line =~ %r{\[@[\w\d\-_]+\]\(https?://github\.com/.*[\w\d\-_]+/?\)}
|
90
90
|
|
91
91
|
false
|
92
92
|
end
|
@@ -2,19 +2,19 @@ module Danger
|
|
2
2
|
module Changelog
|
3
3
|
# A CHANGELOG.md line represents the version header.
|
4
4
|
class ChangelogHeaderLine < ChangelogLine
|
5
|
-
OPEN_PARENS = /[
|
6
|
-
CLOSE_PARENS = /[
|
5
|
+
OPEN_PARENS = /[(\[{]?/.freeze
|
6
|
+
CLOSE_PARENS = /[)\]}]?/.freeze
|
7
7
|
|
8
8
|
HASHES = /\#{1,4}/.freeze
|
9
9
|
SEMVER = /(?<semver>(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-]+)*))?)/.freeze
|
10
|
-
|
10
|
+
ISO8601_DATETIME = %r{(?<datetime>([0-9]{4})[-/]?(1[0-2]|0?[1-9])[-/]+(3[01]|0?[1-9]|[12][0-9])(T[0-9]{2}:[0-9]{2}:[0-9]{2})?Z?)}.freeze
|
11
11
|
|
12
12
|
def valid?
|
13
13
|
stripped_line = line.strip
|
14
14
|
|
15
|
-
m = stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}[\w\s
|
15
|
+
m = stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}[\w\s:]*#{CLOSE_PARENS}$/) # title
|
16
16
|
m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}$/) # semver only
|
17
|
-
m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}[\s
|
17
|
+
m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}[\s-]+#{OPEN_PARENS}(#{ISO8601_DATETIME}|\w*)#{CLOSE_PARENS}$/) # semver and ISO 8601 date & time or next version description
|
18
18
|
|
19
19
|
!m.nil? && balanced?(stripped_line)
|
20
20
|
end
|
@@ -6,8 +6,7 @@ module Danger
|
|
6
6
|
PAIRED = /\(#{NON_DELIMITERS}\)|\{#{NON_DELIMITERS}\}|\[#{NON_DELIMITERS}\]/.freeze
|
7
7
|
DELIMITER = /[(){}\[\]]/.freeze
|
8
8
|
|
9
|
-
attr_accessor :line
|
10
|
-
attr_accessor :validation_result
|
9
|
+
attr_accessor :line, :validation_result
|
11
10
|
|
12
11
|
def initialize(line)
|
13
12
|
self.line = line
|
data/lib/changelog/config.rb
CHANGED
@@ -4,9 +4,9 @@ module Danger
|
|
4
4
|
class IntrideaFormat < Base
|
5
5
|
def bad_line_message(filename)
|
6
6
|
"One of the lines below found in #{filename} doesn't match the " \
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
'[expected format](https://github.com/dblock/danger-changelog/blob/master/README.md#whats-a-correctly-formatted-changelog-file). ' \
|
8
|
+
'Please make it look like the other lines, pay attention to version ' \
|
9
|
+
'numbers, periods, spaces and date formats.'
|
10
10
|
end
|
11
11
|
|
12
12
|
def parse(filename)
|
@@ -17,7 +17,10 @@ module Danger
|
|
17
17
|
|
18
18
|
changelog_line = ChangelogLineParser.parse(line)
|
19
19
|
|
20
|
-
if changelog_line.nil?
|
20
|
+
if changelog_line.nil?
|
21
|
+
notify_of_bad_line line, 'cannot be parsed'
|
22
|
+
next
|
23
|
+
elsif changelog_line.invalid?
|
21
24
|
detail = changelog_line.validation_result.to_s if changelog_line.validation_result&.invalid?
|
22
25
|
notify_of_bad_line line, detail
|
23
26
|
next
|
@@ -4,14 +4,14 @@ module Danger
|
|
4
4
|
class KeepAChangelog < Base
|
5
5
|
def bad_line_message(filename)
|
6
6
|
"One of the lines below found in #{filename} doesn't match the " \
|
7
|
-
|
7
|
+
'[expected format](https://keepachangelog.com).'
|
8
8
|
end
|
9
9
|
|
10
10
|
def parse(filename)
|
11
11
|
blocks = parse_into_blocks(File.open(filename).each_line)
|
12
12
|
|
13
13
|
if contains_header_block?(blocks.first)
|
14
|
-
blocks = blocks[1
|
14
|
+
blocks = blocks[1..]
|
15
15
|
else
|
16
16
|
notify_of_global_failure(
|
17
17
|
'The changelog is missing the version header for the Keep A ' \
|
@@ -61,9 +61,9 @@ module Danger
|
|
61
61
|
return false unless block
|
62
62
|
return false unless block.first == '# Changelog'
|
63
63
|
|
64
|
-
regex = %r{All notable changes to this project will be documented in this file. The format is based on \[Keep a Changelog\]\(https://keepachangelog.com/en/\d\.\d\.\d/\), and this project adheres to \[Semantic Versioning\]\(https
|
64
|
+
regex = %r{All notable changes to this project will be documented in this file. The format is based on \[Keep a Changelog\]\(https://keepachangelog.com/en/\d\.\d\.\d/\), and this project adheres to \[Semantic Versioning\]\(https://semver.org/spec/v2.0.0.html\).}
|
65
65
|
|
66
|
-
block_content = block[1
|
66
|
+
block_content = block[1..].join(' ')
|
67
67
|
|
68
68
|
regex.match?(block_content)
|
69
69
|
end
|
@@ -73,7 +73,7 @@ module Danger
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def markdown_list_item_or_continuation?(line)
|
76
|
-
/^(?:[
|
76
|
+
/^(?:[*-]\s| )/.match?(line)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/lib/changelog/plugin.rb
CHANGED
@@ -28,7 +28,7 @@ module Danger
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Run all checks.
|
31
|
-
# @param
|
31
|
+
# @param parser [Symbol] the parser to check with
|
32
32
|
# @return [Boolean] true when the check passes
|
33
33
|
def check(parser = Danger::Changelog::Config.format)
|
34
34
|
warn '[DEPRECATION] `check` is deprecated. Set format with `.format` and use `check!` instead.'
|
data/spec/changelog_spec.rb
CHANGED
@@ -24,8 +24,7 @@ describe Danger::Changelog do
|
|
24
24
|
|
25
25
|
context 'without CHANGELOG changes' do
|
26
26
|
before do
|
27
|
-
allow(changelog.git).to
|
28
|
-
allow(changelog.git).to receive(:added_files).and_return(['some-file.txt'])
|
27
|
+
allow(changelog.git).to receive_messages(modified_files: ['some-file.txt'], added_files: ['some-file.txt'])
|
29
28
|
end
|
30
29
|
|
31
30
|
it 'complains when no CHANGELOG can be found' do
|
@@ -38,8 +37,7 @@ describe Danger::Changelog do
|
|
38
37
|
|
39
38
|
context 'with CHANGELOG changes' do
|
40
39
|
before do
|
41
|
-
allow(changelog.git).to
|
42
|
-
allow(changelog.git).to receive(:added_files).and_return([])
|
40
|
+
allow(changelog.git).to receive_messages(modified_files: [changelog.filename], added_files: [])
|
43
41
|
end
|
44
42
|
|
45
43
|
it 'has no complaints' do
|
@@ -59,8 +57,7 @@ describe Danger::Changelog do
|
|
59
57
|
context 'without CHANGELOG changes' do
|
60
58
|
context 'when something was modified' do
|
61
59
|
before do
|
62
|
-
allow(changelog.git).to
|
63
|
-
allow(changelog.git).to receive(:added_files).and_return(['another-file.txt'])
|
60
|
+
allow(changelog.git).to receive_messages(modified_files: ['some-file.txt'], added_files: ['another-file.txt'])
|
64
61
|
end
|
65
62
|
|
66
63
|
it 'complains when no CHANGELOG can be found' do
|
@@ -73,9 +70,9 @@ describe Danger::Changelog do
|
|
73
70
|
|
74
71
|
context 'with a README.md' do
|
75
72
|
before do
|
76
|
-
allow(changelog.git).to
|
77
|
-
allow(changelog.git).to receive(:added_files).and_return([])
|
73
|
+
allow(changelog.git).to receive_messages(modified_files: ['README.md'], added_files: [])
|
78
74
|
end
|
75
|
+
|
79
76
|
it 'has no complaints' do
|
80
77
|
expect(subject).to be true
|
81
78
|
expect(status_report[:errors]).to eq []
|
@@ -88,8 +85,7 @@ describe Danger::Changelog do
|
|
88
85
|
context 'name' do
|
89
86
|
before do
|
90
87
|
changelog.ignore_files = ['WHATEVER.md']
|
91
|
-
allow(changelog.git).to
|
92
|
-
allow(changelog.git).to receive(:added_files).and_return([])
|
88
|
+
allow(changelog.git).to receive_messages(modified_files: ['WHATEVER.md'], added_files: [])
|
93
89
|
end
|
94
90
|
|
95
91
|
it 'has no complaints' do
|
@@ -99,11 +95,11 @@ describe Danger::Changelog do
|
|
99
95
|
expect(status_report[:markdowns]).to eq []
|
100
96
|
end
|
101
97
|
end
|
98
|
+
|
102
99
|
context 'mixed' do
|
103
100
|
before do
|
104
101
|
changelog.ignore_files = ['WHATEVER.md', /\.txt$/]
|
105
|
-
allow(changelog.git).to
|
106
|
-
allow(changelog.git).to receive(:added_files).and_return(['one.txt', 'two.txt'])
|
102
|
+
allow(changelog.git).to receive_messages(modified_files: ['WHATEVER.md'], added_files: ['one.txt', 'two.txt'])
|
107
103
|
end
|
108
104
|
|
109
105
|
it 'has no complaints' do
|
@@ -118,8 +114,7 @@ describe Danger::Changelog do
|
|
118
114
|
|
119
115
|
context 'with a new CHANGELOG' do
|
120
116
|
before do
|
121
|
-
allow(changelog.git).to
|
122
|
-
allow(changelog.git).to receive(:added_files).and_return([changelog.filename])
|
117
|
+
allow(changelog.git).to receive_messages(modified_files: [], added_files: [changelog.filename])
|
123
118
|
end
|
124
119
|
|
125
120
|
it 'has no complaints' do
|
@@ -132,8 +127,7 @@ describe Danger::Changelog do
|
|
132
127
|
|
133
128
|
context 'with CHANGELOG changes' do
|
134
129
|
before do
|
135
|
-
allow(changelog.git).to
|
136
|
-
allow(changelog.git).to receive(:added_files).and_return([])
|
130
|
+
allow(changelog.git).to receive_messages(modified_files: [changelog.filename], added_files: [])
|
137
131
|
end
|
138
132
|
|
139
133
|
it 'has no complaints' do
|
data/spec/config_spec.rb
CHANGED
@@ -10,6 +10,7 @@ describe Danger::Changelog::Config do
|
|
10
10
|
expect(changelog.placeholder_line).to eq "* Your contribution here.\n"
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
13
14
|
context 'when without markdown star' do
|
14
15
|
before do
|
15
16
|
Danger::Changelog.config.placeholder_line = "Nothing yet.\n"
|
@@ -40,49 +41,61 @@ describe Danger::Changelog::Config do
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
44
|
+
|
43
45
|
describe 'format' do
|
44
46
|
it 'default' do
|
45
47
|
expect(Danger::Changelog.config.format).to eq :intridea
|
46
48
|
end
|
49
|
+
|
47
50
|
it 'with an invalid format' do
|
48
51
|
expect { Danger::Changelog.config.format = :foobar }.to raise_error ArgumentError, 'Invalid format: foobar'
|
49
52
|
end
|
53
|
+
|
50
54
|
it 'with a string' do
|
51
|
-
expect { Danger::Changelog.config.format = 'intridea' }.
|
55
|
+
expect { Danger::Changelog.config.format = 'intridea' }.not_to raise_error
|
52
56
|
end
|
57
|
+
|
53
58
|
it 'with a symbol' do
|
54
|
-
expect { Danger::Changelog.config.format = :intridea }.
|
59
|
+
expect { Danger::Changelog.config.format = :intridea }.not_to raise_error
|
55
60
|
end
|
61
|
+
|
56
62
|
Danger::Changelog::Parsers::FORMATS.each_pair do |format, parser|
|
57
63
|
context format do
|
58
64
|
before do
|
59
65
|
Danger::Changelog.config.format = format
|
60
66
|
end
|
67
|
+
|
61
68
|
it 'sets format' do
|
62
69
|
expect(Danger::Changelog.config.format).to eq format
|
63
70
|
end
|
71
|
+
|
64
72
|
it 'creates parser' do
|
65
73
|
expect(Danger::Changelog.config.parser).to be_a parser
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
69
77
|
end
|
78
|
+
|
70
79
|
describe 'ignore_files' do
|
71
80
|
it 'default' do
|
72
81
|
expect(Danger::Changelog.config.ignore_files).to eq(['README.md'])
|
73
82
|
end
|
83
|
+
|
74
84
|
context 'with a file name' do
|
75
85
|
before do
|
76
86
|
Danger::Changelog.config.ignore_files = 'WHATEVER.md'
|
77
87
|
end
|
88
|
+
|
78
89
|
it 'transforms it into an array' do
|
79
90
|
expect(Danger::Changelog.config.ignore_files).to eq(['WHATEVER.md'])
|
80
91
|
end
|
81
92
|
end
|
93
|
+
|
82
94
|
context 'with multiple names' do
|
83
95
|
before do
|
84
96
|
Danger::Changelog.config.ignore_files = ['WHATEVER.md', /\*.md$/]
|
85
97
|
end
|
98
|
+
|
86
99
|
it 'transforms it into an array' do
|
87
100
|
expect(Danger::Changelog.config.ignore_files).to eq(['WHATEVER.md', /\*.md$/])
|
88
101
|
end
|
@@ -92,6 +92,7 @@ describe Danger::Changelog::ChangelogEntryLine do
|
|
92
92
|
|
93
93
|
context 'no transformation required' do
|
94
94
|
let(:pr_title) { 'Test' }
|
95
|
+
|
95
96
|
it 'uses title as is' do
|
96
97
|
expect(described_class.example(github)).to eq '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).'
|
97
98
|
end
|
@@ -99,6 +100,7 @@ describe Danger::Changelog::ChangelogEntryLine do
|
|
99
100
|
|
100
101
|
context 'with lowercase title' do
|
101
102
|
let(:pr_title) { 'test' }
|
103
|
+
|
102
104
|
it 'capitalizes it' do
|
103
105
|
expect(described_class.example(github)).to eq '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).'
|
104
106
|
end
|
@@ -106,6 +108,7 @@ describe Danger::Changelog::ChangelogEntryLine do
|
|
106
108
|
|
107
109
|
context 'with a trailing period' do
|
108
110
|
let(:pr_title) { 'Test.' }
|
111
|
+
|
109
112
|
it 'removes it' do
|
110
113
|
expect(described_class.example(github)).to eq '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).'
|
111
114
|
end
|
@@ -2,50 +2,63 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Danger::Changelog::ChangelogFile do
|
4
4
|
subject do
|
5
|
-
|
5
|
+
described_class.new(filename).tap(&:parse)
|
6
6
|
end
|
7
7
|
|
8
8
|
describe 'with the default format checker' do
|
9
9
|
context 'minimal example' do
|
10
10
|
let(:filename) { File.expand_path('fixtures/minimal.md', __dir__) }
|
11
|
+
|
11
12
|
it 'exists?' do
|
12
13
|
expect(subject.exists?).to be true
|
13
14
|
end
|
15
|
+
|
14
16
|
it 'bad_lines?' do
|
15
17
|
expect(subject.bad_lines).to eq []
|
16
18
|
expect(subject.bad_lines?).to be false
|
17
19
|
end
|
20
|
+
|
18
21
|
it 'is valid' do
|
19
22
|
expect(subject.bad_lines?).to be false
|
20
23
|
end
|
24
|
+
|
21
25
|
it 'has your contribution here' do
|
22
26
|
expect(subject.global_failures?).to be false
|
23
27
|
end
|
24
28
|
end
|
29
|
+
|
25
30
|
context 'missing your contribution here' do
|
26
31
|
let(:filename) { File.expand_path('fixtures/missing_your_contribution_here.md', __dir__) }
|
32
|
+
|
27
33
|
it 'is valid' do
|
28
34
|
expect(subject.bad_lines?).to be false
|
29
35
|
end
|
36
|
+
|
30
37
|
it 'is missing your contribution here' do
|
31
38
|
expect(subject.global_failures?).to be true
|
32
39
|
end
|
33
40
|
end
|
41
|
+
|
34
42
|
context 'does not exist' do
|
35
43
|
let(:filename) { 'whatever.md' }
|
44
|
+
|
36
45
|
it 'exists?' do
|
37
46
|
expect(subject.exists?).to be false
|
38
47
|
end
|
48
|
+
|
39
49
|
it 'bad_lines?' do
|
40
50
|
expect(subject.bad_lines).to be_empty
|
41
51
|
expect(subject.bad_lines?).to be false
|
42
52
|
end
|
43
53
|
end
|
54
|
+
|
44
55
|
context 'with bad lines' do
|
45
56
|
let(:filename) { File.expand_path('fixtures/lines.md', __dir__) }
|
57
|
+
|
46
58
|
it 'is invalid' do
|
47
59
|
expect(subject.bad_lines?).to be true
|
48
60
|
end
|
61
|
+
|
49
62
|
it 'reports all bad lines' do
|
50
63
|
expect(subject.bad_lines).to eq [
|
51
64
|
["Missing star - [@dblock](https://github.com/dblock).\n", 'does not start with a star, does not include a pull request link'],
|
@@ -57,26 +70,33 @@ describe Danger::Changelog::ChangelogFile do
|
|
57
70
|
["* [#1](https://github.com/dblock/danger-changelog/pull/1): Unbalanced ] - [@dblock](https://github.com/dblock).\n", 'too many parenthesis']
|
58
71
|
]
|
59
72
|
end
|
73
|
+
|
60
74
|
it 'has your contribution here' do
|
61
75
|
expect(subject.global_failures?).to be false
|
62
76
|
end
|
63
77
|
end
|
78
|
+
|
64
79
|
context 'with a line that has an extra trailing space' do
|
65
80
|
let(:filename) { File.expand_path('fixtures/extra_trailing_space.md', __dir__) }
|
81
|
+
|
66
82
|
it 'is invalid' do
|
67
83
|
expect(subject.bad_lines?).to be true
|
68
84
|
end
|
85
|
+
|
69
86
|
it 'reports all bad lines' do
|
70
87
|
expect(subject.bad_lines).to eq [
|
71
88
|
["* [#1](https://github.com/dblock/danger-changelog/pull/1): Extra trailing space - [@dblock](https://github.com/dblock). \n", 'has an extra trailing space, is missing a period at the end of the line']
|
72
89
|
]
|
73
90
|
end
|
74
91
|
end
|
92
|
+
|
75
93
|
context 'with bad dates' do
|
76
94
|
let(:filename) { File.expand_path('fixtures/dates.md', __dir__) }
|
95
|
+
|
77
96
|
it 'is invalid' do
|
78
97
|
expect(subject.bad_lines?).to be true
|
79
98
|
end
|
99
|
+
|
80
100
|
it 'reports all bad dates' do
|
81
101
|
expect(subject.bad_lines).to eq [
|
82
102
|
["### 1.2.3 (1/2/2018)\n"],
|
@@ -86,11 +106,14 @@ describe Danger::Changelog::ChangelogFile do
|
|
86
106
|
]
|
87
107
|
end
|
88
108
|
end
|
109
|
+
|
89
110
|
context 'with bad semver' do
|
90
111
|
let(:filename) { File.expand_path('fixtures/semver.md', __dir__) }
|
112
|
+
|
91
113
|
it 'is invalid' do
|
92
114
|
expect(subject.bad_lines?).to be true
|
93
115
|
end
|
116
|
+
|
94
117
|
it 'reports all bad dates' do
|
95
118
|
expect(subject.bad_lines).to eq [
|
96
119
|
["### 0 (2018/1/1)\n"],
|
@@ -99,11 +122,14 @@ describe Danger::Changelog::ChangelogFile do
|
|
99
122
|
]
|
100
123
|
end
|
101
124
|
end
|
125
|
+
|
102
126
|
context 'with imbalanced parenthesis' do
|
103
127
|
let(:filename) { File.expand_path('fixtures/imbalanced.md', __dir__) }
|
128
|
+
|
104
129
|
it 'is invalid' do
|
105
130
|
expect(subject.bad_lines?).to be true
|
106
131
|
end
|
132
|
+
|
107
133
|
it 'reports all bad lines' do
|
108
134
|
expect(subject.bad_lines).to eq [
|
109
135
|
["### 0.0.0)\n"],
|
@@ -5,6 +5,7 @@ describe Danger::Changelog::ChangelogLineParser do
|
|
5
5
|
context 'changelog entry line' do
|
6
6
|
context 'when valid' do
|
7
7
|
let(:line) { '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).' }
|
8
|
+
|
8
9
|
it 'returns ChangelogEntryLine' do
|
9
10
|
expect(described_class.parse(line)).to be_a(Danger::Changelog::ChangelogEntryLine)
|
10
11
|
end
|
@@ -26,6 +27,7 @@ describe Danger::Changelog::ChangelogLineParser do
|
|
26
27
|
|
27
28
|
context 'changelog your contribution here line' do
|
28
29
|
let(:line) { "* Your contribution here.\n" }
|
30
|
+
|
29
31
|
it 'returns ChangelogPlaceholderLine' do
|
30
32
|
expect(described_class.parse(line)).to be_a(Danger::Changelog::ChangelogPlaceholderLine)
|
31
33
|
end
|
@@ -34,6 +36,7 @@ describe Danger::Changelog::ChangelogLineParser do
|
|
34
36
|
context 'changelog header line' do
|
35
37
|
context 'when one hash' do
|
36
38
|
let(:line) { '# Version 1.1.1' }
|
39
|
+
|
37
40
|
it 'returns ChangelogHeaderLine' do
|
38
41
|
expect(described_class.parse(line)).to be_a(Danger::Changelog::ChangelogHeaderLine)
|
39
42
|
end
|
@@ -41,6 +44,7 @@ describe Danger::Changelog::ChangelogLineParser do
|
|
41
44
|
|
42
45
|
context 'when two hashes' do
|
43
46
|
let(:line) { '## Version 1.1.1' }
|
47
|
+
|
44
48
|
it 'returns ChangelogHeaderLine' do
|
45
49
|
expect(described_class.parse(line)).to be_a(Danger::Changelog::ChangelogHeaderLine)
|
46
50
|
end
|
@@ -48,6 +52,7 @@ describe Danger::Changelog::ChangelogLineParser do
|
|
48
52
|
|
49
53
|
context 'when three hashes' do
|
50
54
|
let(:line) { '### Version 1.1.1' }
|
55
|
+
|
51
56
|
it 'returns ChangelogHeaderLine' do
|
52
57
|
expect(described_class.parse(line)).to be_a(Danger::Changelog::ChangelogHeaderLine)
|
53
58
|
end
|
@@ -27,6 +27,7 @@ describe Danger::Changelog do
|
|
27
27
|
|
28
28
|
context 'without a CHANGELOG file' do
|
29
29
|
let(:filename) { 'does-not-exist' }
|
30
|
+
|
30
31
|
it 'complains' do
|
31
32
|
expect(subject).to be false
|
32
33
|
expect(status_report[:errors]).to eq ['The does-not-exist file does not exist.']
|
@@ -37,8 +38,7 @@ describe Danger::Changelog do
|
|
37
38
|
let(:filename) { File.expand_path('fixtures/minimal.md', __dir__) }
|
38
39
|
|
39
40
|
before do
|
40
|
-
allow(changelog.git).to
|
41
|
-
allow(changelog.git).to receive(:added_files).and_return([])
|
41
|
+
allow(changelog.git).to receive_messages(modified_files: [filename], added_files: [])
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'has no complaints' do
|
@@ -54,6 +54,7 @@ describe Danger::Changelog do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
let(:filename) { File.expand_path('fixtures/customized.md', __dir__) }
|
57
|
+
|
57
58
|
it 'is ok' do
|
58
59
|
expect(subject).to be true
|
59
60
|
expect(status_report[:errors]).to eq []
|
@@ -103,6 +104,7 @@ describe Danger::Changelog do
|
|
103
104
|
|
104
105
|
context 'minimal example' do
|
105
106
|
let(:filename) { File.expand_path('fixtures/minimal.md', __dir__) }
|
107
|
+
|
106
108
|
it 'is ok' do
|
107
109
|
expect(subject).to be true
|
108
110
|
expect(status_report[:errors]).to eq []
|
@@ -128,6 +130,7 @@ describe Danger::Changelog do
|
|
128
130
|
|
129
131
|
context 'with bad lines' do
|
130
132
|
let(:filename) { File.expand_path('fixtures/lines.md', __dir__) }
|
133
|
+
|
131
134
|
it 'complains' do
|
132
135
|
expect(subject).to be false
|
133
136
|
expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the [expected format](https://github.com/dblock/danger-changelog/blob/master/README.md#whats-a-correctly-formatted-changelog-file). Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats."]
|
@@ -143,6 +146,21 @@ describe Danger::Changelog do
|
|
143
146
|
]
|
144
147
|
end
|
145
148
|
end
|
149
|
+
|
150
|
+
context 'with a contribution line starting with a -' do
|
151
|
+
let(:filename) { File.expand_path('fixtures/validation_result.md', __dir__) }
|
152
|
+
|
153
|
+
it 'cannot be parsed' do
|
154
|
+
expect(subject).to be false
|
155
|
+
expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the [expected format](https://github.com/dblock/danger-changelog/blob/master/README.md#whats-a-correctly-formatted-changelog-file). Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats."]
|
156
|
+
expect(status_report[:warnings]).to eq []
|
157
|
+
expect(status_report[:markdowns].map(&:message)).to eq [
|
158
|
+
"```markdown\n- [#67](https://github.com/dblock/danger-changelog/pull/67): Various build updates - [@bob](https://github.com/bob).\ndoes not start with a star\n```\n",
|
159
|
+
"```markdown\n- [#68](https://github.com/dblock/danger-changelog/pull/68): Properly render `example` - [@janet](https://github.com/janet).\ndoes not start with a star\n```\n",
|
160
|
+
"```markdown\n- Your contribution here.\ncannot be parsed\n```\n"
|
161
|
+
]
|
162
|
+
end
|
163
|
+
end
|
146
164
|
end
|
147
165
|
end
|
148
166
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
### Next
|
2
|
+
#### Fixes
|
3
|
+
- [#67](https://github.com/dblock/danger-changelog/pull/67): Various build updates - [@bob](https://github.com/bob).
|
4
|
+
- [#68](https://github.com/dblock/danger-changelog/pull/68): Properly render `example` - [@janet](https://github.com/janet).
|
5
|
+
- Your contribution here.
|
6
|
+
* Your contribution here.
|
@@ -26,12 +26,12 @@ describe Danger::Changelog do
|
|
26
26
|
|
27
27
|
context 'with CHANGELOG changes' do
|
28
28
|
before do
|
29
|
-
allow(changelog.git).to
|
30
|
-
allow(changelog.git).to receive(:added_files).and_return([])
|
29
|
+
allow(changelog.git).to receive_messages(modified_files: [filename], added_files: [])
|
31
30
|
end
|
32
31
|
|
33
32
|
context 'valid file' do
|
34
33
|
let(:filename) { File.expand_path('fixtures/complete.md', __dir__) }
|
34
|
+
|
35
35
|
it 'has no complaints' do
|
36
36
|
expect(subject).to be true
|
37
37
|
expect(status_report[:errors]).to eq []
|
@@ -42,6 +42,7 @@ describe Danger::Changelog do
|
|
42
42
|
|
43
43
|
context 'with lines containing links' do
|
44
44
|
let(:filename) { File.expand_path('fixtures/lines_with_links.md', __dir__) }
|
45
|
+
|
45
46
|
it 'is valid' do
|
46
47
|
expect(subject).to be true
|
47
48
|
expect(status_report[:errors]).to eq []
|
@@ -52,6 +53,7 @@ describe Danger::Changelog do
|
|
52
53
|
|
53
54
|
context 'missing a version header' do
|
54
55
|
let(:filename) { File.expand_path('fixtures/missing_a_version_header.md', __dir__) }
|
56
|
+
|
55
57
|
it 'complains' do
|
56
58
|
expect(subject).to be false
|
57
59
|
expect(status_report[:errors]).to eq [
|
@@ -67,6 +69,7 @@ describe Danger::Changelog do
|
|
67
69
|
|
68
70
|
context 'invalid line' do
|
69
71
|
let(:filename) { File.expand_path('fixtures/invalid_line.md', __dir__) }
|
72
|
+
|
70
73
|
it 'complains' do
|
71
74
|
expect(subject).to be false
|
72
75
|
expect(status_report[:errors]).to eq [
|
data/spec/plugin_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
ROOT = Pathname.new(File.expand_path('..', __dir__))
|
3
|
-
$LOAD_PATH.unshift(
|
4
|
-
$LOAD_PATH.unshift(
|
3
|
+
$LOAD_PATH.unshift("#{ROOT}lib".to_s)
|
4
|
+
$LOAD_PATH.unshift("#{ROOT}spec".to_s)
|
5
5
|
|
6
6
|
require 'bundler/setup'
|
7
7
|
require 'pry'
|
@@ -42,6 +42,6 @@ end
|
|
42
42
|
|
43
43
|
require 'active_support'
|
44
44
|
|
45
|
-
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
|
45
|
+
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].sort.each do |file|
|
46
46
|
require file
|
47
47
|
end
|
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.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dblock
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -31,11 +31,13 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".github/workflows/danger.yml"
|
35
|
+
- ".github/workflows/lint.yml"
|
36
|
+
- ".github/workflows/test.yml"
|
34
37
|
- ".gitignore"
|
35
38
|
- ".rspec"
|
36
39
|
- ".rubocop.yml"
|
37
40
|
- ".rubocop_todo.yml"
|
38
|
-
- ".travis.yml"
|
39
41
|
- CHANGELOG.md
|
40
42
|
- CONTRIBUTING.md
|
41
43
|
- Dangerfile
|
@@ -82,6 +84,7 @@ files:
|
|
82
84
|
- spec/intridea/fixtures/minimal.md
|
83
85
|
- spec/intridea/fixtures/missing_your_contribution_here.md
|
84
86
|
- spec/intridea/fixtures/semver.md
|
87
|
+
- spec/intridea/fixtures/validation_result.md
|
85
88
|
- spec/keep_a_changelog/changelog_spec.rb
|
86
89
|
- spec/keep_a_changelog/fixtures/complete.md
|
87
90
|
- spec/keep_a_changelog/fixtures/invalid_line.md
|
@@ -93,8 +96,9 @@ files:
|
|
93
96
|
homepage: https://github.com/dblock/danger-changelog
|
94
97
|
licenses:
|
95
98
|
- MIT
|
96
|
-
metadata:
|
97
|
-
|
99
|
+
metadata:
|
100
|
+
rubygems_mfa_required: 'true'
|
101
|
+
post_install_message:
|
98
102
|
rdoc_options: []
|
99
103
|
require_paths:
|
100
104
|
- lib
|
@@ -109,32 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
113
|
- !ruby/object:Gem::Version
|
110
114
|
version: '0'
|
111
115
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
116
|
+
rubygems_version: 3.3.7
|
117
|
+
signing_key:
|
114
118
|
specification_version: 4
|
115
119
|
summary: A danger.systems plugin that is OCD about your CHANGELOG.
|
116
|
-
test_files:
|
117
|
-
- spec/changelog_spec.rb
|
118
|
-
- spec/config_spec.rb
|
119
|
-
- spec/intridea/changelog_entry_line_spec.rb
|
120
|
-
- spec/intridea/changelog_file_spec.rb
|
121
|
-
- spec/intridea/changelog_header_line_spec.rb
|
122
|
-
- spec/intridea/changelog_line_parser_spec.rb
|
123
|
-
- spec/intridea/changelog_placeholder_line_spec.rb
|
124
|
-
- spec/intridea/changelog_spec.rb
|
125
|
-
- spec/intridea/fixtures/customized.md
|
126
|
-
- spec/intridea/fixtures/dates.md
|
127
|
-
- spec/intridea/fixtures/extra_trailing_space.md
|
128
|
-
- spec/intridea/fixtures/imbalanced.md
|
129
|
-
- spec/intridea/fixtures/lines.md
|
130
|
-
- spec/intridea/fixtures/minimal.md
|
131
|
-
- spec/intridea/fixtures/missing_your_contribution_here.md
|
132
|
-
- spec/intridea/fixtures/semver.md
|
133
|
-
- spec/keep_a_changelog/changelog_spec.rb
|
134
|
-
- spec/keep_a_changelog/fixtures/complete.md
|
135
|
-
- spec/keep_a_changelog/fixtures/invalid_line.md
|
136
|
-
- spec/keep_a_changelog/fixtures/lines_with_links.md
|
137
|
-
- spec/keep_a_changelog/fixtures/missing_a_version_header.md
|
138
|
-
- spec/plugin_spec.rb
|
139
|
-
- spec/spec_helper.rb
|
140
|
-
- spec/support/shared/changelog.rb
|
120
|
+
test_files: []
|