danger-changelog 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger.yml +23 -0
  3. data/.github/workflows/lint.yml +16 -0
  4. data/.github/workflows/test.yml +20 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +10 -0
  7. data/.rubocop_todo.yml +1 -39
  8. data/CHANGELOG.md +11 -0
  9. data/CONTRIBUTING.md +1 -1
  10. data/Dangerfile +1 -0
  11. data/Gemfile +14 -0
  12. data/LICENSE.txt +1 -1
  13. data/README.md +20 -3
  14. data/RELEASING.md +1 -1
  15. data/danger-changelog.gemspec +0 -11
  16. data/lib/changelog/changelog_file.rb +5 -3
  17. data/lib/changelog/changelog_line/changelog_entry_line.rb +31 -1
  18. data/lib/changelog/changelog_line/changelog_header_line.rb +2 -2
  19. data/lib/changelog/changelog_line/changelog_line.rb +2 -0
  20. data/lib/changelog/changelog_line/changelog_line_parser.rb +2 -2
  21. data/lib/changelog/config.rb +4 -2
  22. data/lib/changelog/gem_version.rb +1 -1
  23. data/lib/changelog/parsers/base.rb +2 -2
  24. data/lib/changelog/parsers/intridea_format.rb +2 -1
  25. data/lib/changelog/parsers/keep_a_changelog.rb +2 -2
  26. data/lib/changelog/parsers/validation_result.rb +31 -0
  27. data/lib/changelog/parsers.rb +1 -0
  28. data/lib/changelog/plugin.rb +10 -9
  29. data/spec/changelog_spec.rb +88 -254
  30. data/spec/config_spec.rb +11 -3
  31. data/spec/{changelog_entry_line_spec.rb → intridea/changelog_entry_line_spec.rb} +1 -1
  32. data/spec/intridea/changelog_file_spec.rb +120 -0
  33. data/spec/{changelog_header_line_spec.rb → intridea/changelog_header_line_spec.rb} +1 -1
  34. data/spec/{changelog_line_parser_spec.rb → intridea/changelog_line_parser_spec.rb} +1 -1
  35. data/spec/{changelog_placeholder_line_spec.rb → intridea/changelog_placeholder_line_spec.rb} +5 -3
  36. data/spec/intridea/changelog_spec.rb +150 -0
  37. data/spec/{fixtures/changelogs → intridea/fixtures}/dates.md +3 -0
  38. data/spec/intridea/fixtures/extra_trailing_space.md +3 -0
  39. data/spec/keep_a_changelog/changelog_spec.rb +84 -0
  40. data/spec/keep_a_changelog/fixtures/invalid_line.md +23 -0
  41. data/spec/keep_a_changelog/fixtures/lines_with_links.md +14 -0
  42. data/spec/keep_a_changelog/fixtures/missing_a_version_header.md +20 -0
  43. data/spec/plugin_spec.rb +10 -0
  44. metadata +50 -173
  45. data/.travis.yml +0 -14
  46. data/spec/changelog_file_spec.rb +0 -110
  47. /data/spec/{fixtures/changelogs → intridea/fixtures}/customized.md +0 -0
  48. /data/spec/{fixtures/changelogs → intridea/fixtures}/imbalanced.md +0 -0
  49. /data/spec/{fixtures/changelogs → intridea/fixtures}/lines.md +0 -0
  50. /data/spec/{fixtures/changelogs → intridea/fixtures}/minimal.md +0 -0
  51. /data/spec/{fixtures/changelogs → intridea/fixtures}/missing_your_contribution_here.md +0 -0
  52. /data/spec/{fixtures/changelogs → intridea/fixtures}/semver.md +0 -0
  53. /data/spec/{fixtures/changelogs/keep_a_changelog.md → keep_a_changelog/fixtures/complete.md} +0 -0
@@ -1,110 +0,0 @@
1
- require File.expand_path('spec_helper', __dir__)
2
-
3
- describe Danger::Changelog::ChangelogFile do
4
- let(:filename) { 'CHANGELOG.md' }
5
- subject do
6
- Danger::Changelog::ChangelogFile.new(filename).tap(&:parse)
7
- end
8
-
9
- describe 'with the default format checker' do
10
- context 'minimal example' do
11
- let(:filename) { File.expand_path('fixtures/changelogs/minimal.md', __dir__) }
12
- it 'exists?' do
13
- expect(subject.exists?).to be true
14
- end
15
- it 'bad_lines?' do
16
- expect(subject.bad_lines).to eq []
17
- expect(subject.bad_lines?).to be false
18
- end
19
- it 'is valid' do
20
- expect(subject.bad_lines?).to be false
21
- end
22
- it 'has your contribution here' do
23
- expect(subject.global_failures?).to be false
24
- end
25
- end
26
- context 'missing your contribution here' do
27
- let(:filename) { File.expand_path('fixtures/changelogs/missing_your_contribution_here.md', __dir__) }
28
- it 'is valid' do
29
- expect(subject.bad_lines?).to be false
30
- end
31
- it 'is missing your contribution here' do
32
- expect(subject.global_failures?).to be true
33
- end
34
- end
35
- context 'does not exist' do
36
- let(:filename) { 'whatever.md' }
37
- it 'exists?' do
38
- expect(subject.exists?).to be false
39
- end
40
- it 'bad_lines?' do
41
- expect(subject.bad_lines).to be_empty
42
- expect(subject.bad_lines?).to be false
43
- end
44
- end
45
- context 'with bad lines' do
46
- let(:filename) { File.expand_path('fixtures/changelogs/lines.md', __dir__) }
47
- it 'is invalid' do
48
- expect(subject.bad_lines?).to be true
49
- end
50
- it 'reports all bad lines' do
51
- expect(subject.bad_lines).to eq [
52
- "Missing star - [@dblock](https://github.com/dblock).\n",
53
- "* [#1](https://github.com/dblock/danger-changelog/pull/1) - Not a colon - [@dblock](https://github.com/dblock).\n",
54
- "* [#1](https://github.com/dblock/danger-changelog/pull/1): No final period - [@dblock](https://github.com/dblock)\n",
55
- "# [#1](https://github.com/dblock/danger-changelog/pull/1): Hash instead of star - [@dblock](https://github.com/dblock).\n",
56
- "* [#1](https://github.com/dblock/danger-changelog/pull/1): Extra period. - [@dblock](https://github.com/dblock).\n",
57
- "* [#1](https://github.com/dblock/danger-changelog/pull/1): Unbalanced ( - [@dblock](https://github.com/dblock).\n",
58
- "* [#1](https://github.com/dblock/danger-changelog/pull/1): Unbalanced ] - [@dblock](https://github.com/dblock).\n"
59
- ]
60
- end
61
- it 'has your contribution here' do
62
- expect(subject.global_failures?).to be false
63
- end
64
- end
65
- context 'with bad dates' do
66
- let(:filename) { File.expand_path('fixtures/changelogs/dates.md', __dir__) }
67
- it 'is invalid' do
68
- expect(subject.bad_lines?).to be true
69
- end
70
- it 'reports all bad dates' do
71
- expect(subject.bad_lines).to eq [
72
- "### 1.2.3 (1/2/2018)\n",
73
- "### 1.2.3 (2018/13/1)\n",
74
- "### 1.2.3 (2018/13)\n",
75
- "### 1.2.3 (2018/1/1/3)\n"
76
- ]
77
- end
78
- end
79
- context 'with bad semver' do
80
- let(:filename) { File.expand_path('fixtures/changelogs/semver.md', __dir__) }
81
- it 'is invalid' do
82
- expect(subject.bad_lines?).to be true
83
- end
84
- it 'reports all bad dates' do
85
- expect(subject.bad_lines).to eq [
86
- "### 0 (2018/1/1)\n",
87
- "### 0. (2018/1/1)\n",
88
- "### 0.1. (2018/1/1)\n"
89
- ]
90
- end
91
- end
92
- context 'with imbalanced parenthesis' do
93
- let(:filename) { File.expand_path('fixtures/changelogs/imbalanced.md', __dir__) }
94
- it 'is invalid' do
95
- expect(subject.bad_lines?).to be true
96
- end
97
- it 'reports all bad lines' do
98
- expect(subject.bad_lines).to eq [
99
- "### 0.0.0)\n",
100
- "### (0.0.1\n",
101
- "### 1.2.3 (2018/1/1\n",
102
- "### 0.1.0 2018/1/1)\n",
103
- "### 0 ((2018/1/1)\n",
104
- "### 0. [2018/1/1)\n",
105
- "### 0.1. (2018/1/1)]\n"
106
- ]
107
- end
108
- end
109
- end
110
- end