Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: undefined method line_labels_for #753

Merged
merged 1 commit into from Apr 11, 2020
Merged

Bugfix: undefined method line_labels_for #753

merged 1 commit into from Apr 11, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jan 21, 2020

If you specify option issue-line-labels in your .github_changelog_generator it will throw:

/usr/local/bundle/gems/github_changelog_generator-1.15.0/lib/github_changelog_generator/generator/section.rb:52:in `get_string_for_issue': undefined method `line_labels_for' for #<GitHubChangelogGenerator::Section:0x000055b07a12d628> (NoMethodError)

This is fix for it.

@ghost
Copy link
Author

ghost commented Feb 3, 2020

@ferrarimarco ping

@ferrarimarco
Copy link
Contributor

Thanks for this PR! Can you please add a test case for this as well?

@ghost
Copy link
Author

ghost commented Feb 26, 2020

ping, any update on this?

@ghost
Copy link
Author

ghost commented Mar 23, 2020

@ferrarimarco ping

@ferrarimarco
Copy link
Contributor

@olleolleolle can you have a look at this as well? Thanks!

@@ -7,7 +7,7 @@ module GitHubChangelogGenerator
#
# @see GitHubChangelogGenerator::Entry
class Section
attr_accessor :name, :prefix, :issues, :labels, :body_only
attr_accessor :name, :options, :prefix, :issues, :labels, :body_only
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not using the setter, can :options become a attr_reader?

@@ -49,7 +49,7 @@ def get_string_for_issue(issue)
encapsulated_title = encapsulate_string issue["title"]

title_with_number = "#{encapsulated_title} [\\##{issue['number']}](#{issue['html_url']})"
title_with_number = "#{title_with_number}#{line_labels_for(issue)}" if @options[:issue_line_labels].present?
title_with_number = "#{title_with_number}#{Entry.new(options).line_labels_for(issue)}" if @options[:issue_line_labels].present?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps later, one can build an @entry to be used to repeatedly make the line_labels_for call on?

Copy link
Collaborator

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the bug, gets the behavior we want.

In order not to repeat the Entry.new(options) and to not create an Section#options= setter that we don't need, we'll need to return to this code.

@dusan-dragon Thanks for adding this. 🎉

@olleolleolle
Copy link
Collaborator

@ferrarimarco So, one way to deal with the code notes that I mentioned in my ✅ passing review is that we make them, when this has landed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants