From fbae4aa674d485c127b53d97df76425138948f55 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 31 Jan 2021 03:20:14 +0900 Subject: [PATCH] Support co-contributor signature for changelog build Follow https://github.com/rubocop-hq/rubocop/commit/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 ' # ./spec/project_spec.rb:276:in `each' # ./spec/project_spec.rb:276:in `block (3 levels) in ' # 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 ' 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 --- tasks/changelog.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tasks/changelog.rb b/tasks/changelog.rb index 4d5d651f3d1d..94bdce354850 100644 --- a/tasks/changelog.rb +++ b/tasks/changelog.rb @@ -17,7 +17,7 @@ class Changelog REF_URL = 'https://github.com/rubocop-hq/rubocop' MAX_LENGTH = 40 CONTRIBUTOR = '[@%s]: https://github.com/%s' - SIGNATURE = Regexp.new(format(Regexp.escape("([@%s][])\n"), user: '([\w-]+)')) + SIGNATURE = Regexp.new(format(Regexp.escape('[@%s][]'), user: '([\w-]+)')) EOF = "\n" # New entry @@ -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(/\. \((?.+)\)\n/)[:contributors].split(',') + end + + contributors.join.scan(SIGNATURE).flatten end private