Skip to content

Commit

Permalink
Don't add CHANGELOG offenses to "no changes" line
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Sep 27, 2023
1 parent e5386cb commit 087dfd9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/rail_inspector/lib/rail_inspector/changelog.rb
Expand Up @@ -36,6 +36,8 @@ def header
end

def validate_authors
return if no_changes?

authors =
lines.reverse.find { |line| line.match?(/\*[^\d\s]+(\s[^\d\s]+)*\*/) }

Expand Down Expand Up @@ -87,6 +89,10 @@ def validate_trailing_whitespace
end

private
def no_changes?
lines.first == "* No changes."
end

def add_offense(...)
@offenses << Offense.new(...)
end
Expand Down
46 changes: 46 additions & 0 deletions tools/rail_inspector/test/fixtures/action_mailbox.md
@@ -0,0 +1,46 @@
## Rails 7.1.0.rc1 (September 13, 2023) ##

* No changes.


## Rails 7.1.0.beta1 (September 13, 2023) ##

* Fix `simple_format` with blank `wrapper_tag` option returns plain html tag

By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.

Before:

```ruby
simple_format("Hello World", {}, { wrapper_tag: nil })
# <>Hello World</>
```

After:

```ruby
simple_format("Hello World", {}, { wrapper_tag: nil })
# <p>Hello World</p>
```

*Akhil G Krishnan*, *Junichi Ito*

* Don't double-encode nested `field_id` and `field_name` index values

Pass `index: @options` as a default keyword argument to `field_id` and
`field_name` view helper methods.

*Sean Doyle*

* Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`

```ruby
# will exclude header, even if setting is enabled:
javascript_include_tag("http://example.com/all.js", preload_links_header: false)

# will include header, even if setting is disabled:
stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
```

*Alex Ghiculescu*
6 changes: 6 additions & 0 deletions tools/rail_inspector/test/rail_inspector/changelog_test.rb
Expand Up @@ -54,6 +54,12 @@ def test_release_header_is_not_treated_as_offense
assert_equal 0, offenses.length
end

def test_no_changes_not_treated_as_offense
@changelog = changelog_fixture("action_mailbox.md")

assert_equal 0, offenses.length
end

def test_validate_authors
assert_offense(<<~CHANGELOG)
* Fix issue in CHANGELOG linting
Expand Down

0 comments on commit 087dfd9

Please sign in to comment.