Skip to content

Commit 2961560

Browse files
committed
Support CHANGELOG with release headers in the linter
1 parent 5c2a112 commit 2961560

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

tools/rail_inspector/lib/rail_inspector/changelog.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def initialize(file)
115115

116116
def parse
117117
until @buffer.eos?
118+
if peek_release_header?
119+
pop_entry
120+
next parse_release_header
121+
end
122+
118123
if peek_footer?
119124
pop_entry
120125
next parse_footer
@@ -136,6 +141,18 @@ def parse_line
136141

137142
FOOTER_TEXT = "Please check"
138143

144+
RELEASE_HEADER = "## Rails"
145+
146+
def peek_release_header?
147+
@buffer.peek(RELEASE_HEADER.length) == RELEASE_HEADER
148+
end
149+
150+
def parse_release_header
151+
@buffer.scan(
152+
/#{RELEASE_HEADER} .*##\n\n/o
153+
)
154+
end
155+
139156
def parse_footer
140157
@buffer.scan(
141158
/#{FOOTER_TEXT} \[\d-\d-stable\]\(.*\) for previous changes\.\n/o
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Rails 7.1.0.beta1 (September 13, 2023) ##
2+
3+
* Fix `simple_format` with blank `wrapper_tag` option returns plain html tag
4+
5+
By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
6+
the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.
7+
8+
Before:
9+
10+
```ruby
11+
simple_format("Hello World", {}, { wrapper_tag: nil })
12+
# <>Hello World</>
13+
```
14+
15+
After:
16+
17+
```ruby
18+
simple_format("Hello World", {}, { wrapper_tag: nil })
19+
# <p>Hello World</p>
20+
```
21+
22+
*Akhil G Krishnan*, *Junichi Ito*
23+
24+
* Don't double-encode nested `field_id` and `field_name` index values
25+
26+
Pass `index: @options` as a default keyword argument to `field_id` and
27+
`field_name` view helper methods.
28+
29+
*Sean Doyle*
30+
31+
* Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`
32+
33+
```ruby
34+
# will exclude header, even if setting is enabled:
35+
javascript_include_tag("http://example.com/all.js", preload_links_header: false)
36+
37+
# will include header, even if setting is disabled:
38+
stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
39+
```
40+
41+
*Alex Ghiculescu*

tools/rail_inspector/test/rail_inspector/changelog_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ def test_header_ending_with_star_not_treated_as_author
4848
assert_equal 0, offenses.length
4949
end
5050

51+
def test_release_header_is_not_treated_as_offense
52+
@changelog = changelog_fixture("action_view.md")
53+
54+
assert_equal 0, offenses.length
55+
end
56+
5157
def test_validate_authors
5258
assert_offense(<<~CHANGELOG)
5359
* Fix issue in CHANGELOG linting

0 commit comments

Comments
 (0)