Skip to content

Commit 4d2be09

Browse files
committed
Fix changelog linter to not run indefinitely on invalid changelogs
1 parent 1d11c76 commit 4d2be09

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

tools/rail_inspector/lib/rail_inspector/changelog.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def peek_release_header?
155155

156156
def parse_release_header
157157
@buffer.scan(
158-
/#{RELEASE_HEADER} .*##\n\n/o
158+
/#{RELEASE_HEADER} .*##\s*/o
159159
)
160160
end
161161

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Rails 7.1.0.rc1 (September 13, 2023) ##
2+
3+
* No changes.
4+
5+
6+
## Rails 7.1.0.beta1 (September 13, 2023) ##
7+
========
8+
9+
* Fix `simple_format` with blank `wrapper_tag` option returns plain html tag
10+
11+
By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
12+
the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.
13+
14+
Before:
15+
16+
```ruby
17+
simple_format("Hello World", {}, { wrapper_tag: nil })
18+
# <>Hello World</>
19+
```
20+
21+
After:
22+
23+
```ruby
24+
simple_format("Hello World", {}, { wrapper_tag: nil })
25+
# <p>Hello World</p>
26+
```
27+
28+
*Akhil G Krishnan*, *Junichi Ito*
29+
30+
* Don't double-encode nested `field_id` and `field_name` index values
31+
32+
Pass `index: @options` as a default keyword argument to `field_id` and
33+
`field_name` view helper methods.
34+
35+
*Sean Doyle*
36+
37+
* Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`
38+
39+
```ruby
40+
# will exclude header, even if setting is enabled:
41+
javascript_include_tag("http://example.com/all.js", preload_links_header: false)
42+
43+
# will include header, even if setting is disabled:
44+
stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
45+
```
46+
47+
*Alex Ghiculescu*

tools/rail_inspector/test/rail_inspector/changelog_test.rb

+9
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ def test_no_changes_not_treated_as_offense
6060
assert_equal 0, offenses.length
6161
end
6262

63+
def test_invalid_header_does_not_cause_infinite_loop
64+
Timeout.timeout(1) do
65+
@changelog = changelog_fixture("action_mailbox_invalid.md")
66+
assert_equal 2, offenses.length
67+
end
68+
rescue Timeout::Error
69+
flunk "Parsing action_mailbox_invalid.md took too long"
70+
end
71+
6372
def test_validate_authors
6473
assert_offense(<<~CHANGELOG)
6574
* Fix issue in CHANGELOG linting

0 commit comments

Comments
 (0)