Skip to content

Commit

Permalink
Support co-contributor signature for changelog build
Browse files Browse the repository at this point in the history
Follow 7b54f43.

This PR supports co-contributor signature for changelog build and prevents
the following build error when using `rake changelog:merge` for
co-contributor signature.

```console
Failures:

  1) RuboCop Project Changelog has link definitions for all implicit links
     Failure/Error:
       expect(changelog.include?("[#{name}]: http"))
         .to be(true), "missing a link for #{name}. " \
                       'Please add this link to the bottom of the file.'

       missing a link for @jdufresne. Please add this link to the bottom
       of the file.
     # ./spec/project_spec.rb:277:in `block (4 levels) in
       <top (required)>'
     # ./spec/project_spec.rb:276:in `each'
     # ./spec/project_spec.rb:276:in `block (3 levels) in
       <top (required)>'
     # tasks/spec_runner.rake:32:in `block in run_specs'
     # tasks/spec_runner.rake:44:in `with_encoding'
     # tasks/spec_runner.rake:28:in `run_specs'
     # tasks/spec_runner.rake:116:in `block in <top (required)>'

Finished in 4 minutes 51.7 seconds (files took 4.62 seconds to load)
15455 examples, 1 failure, 14 pending
```

https://github.com/rubocop-hq/rubocop/runs/1782491421
  • Loading branch information
koic committed Feb 1, 2021
1 parent b614ba8 commit fbae4aa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tasks/changelog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Changelog
REF_URL = 'https://github.com/rubocop-hq/rubocop'
MAX_LENGTH = 40
CONTRIBUTOR = '[@%<user>s]: https://github.com/%<user>s'
SIGNATURE = Regexp.new(format(Regexp.escape("([@%<user>s][])\n"), user: '([\w-]+)'))
SIGNATURE = Regexp.new(format(Regexp.escape('[@%<user>s][]'), user: '([\w-]+)'))
EOF = "\n"

# New entry
Expand Down Expand Up @@ -143,8 +143,11 @@ def new_contributor_lines
end

def contributors
@entries.values.join("\n")
.scan(SIGNATURE).flatten
contributors = @entries.values.flat_map do |entry|
entry.match(/\. \((?<contributors>.+)\)\n/)[:contributors].split(',')
end

contributors.join.scan(SIGNATURE).flatten
end

private
Expand Down

0 comments on commit fbae4aa

Please sign in to comment.