Skip to content

add breaking-changes section to changelog #530

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

Merged
merged 6 commits into from
Oct 10, 2017

Conversation

bastelfreak
Copy link
Contributor

Hi,
this PR allows us to create another section in the changelog, for breaking changes. This is not a 100% implementation of #316, but may help people. Tested this successfully on https://github.com/voxpupuli/puppet-dhcp/blob/master/CHANGELOG.md

@@ -129,6 +132,9 @@ def self.setup_parser(options)
opts.on("--enhancement-labels x,y,z", Array, 'Issues with the specified labels will be always added to "Implemented enhancements" section. Default is \'enhancement,Enhancement\'') do |list|
options[:enhancement_labels] = list
end
opts.on("--breacking-labels x,y,z", Array, 'Issues with these lables will be added to a new section, called "Breaking Changes". Default is \'backwards-incompatible\'') do |list|
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typos:

  • breacking-labels => breaking-labels
  • lables => labels

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.

I like this feature.

Q: If a PR is marked as both Breaking and an Enhancement, it would be in both lists, right?

@olleolleolle
Copy link
Collaborator

Looking at the generated CHANGELOG.md, I feel that it'd be cool to place any breaking changes section FIRST.

@olleolleolle
Copy link
Collaborator

So, there's room for careful refactoring - or disabling a RuboCop check to pass this:

lib/github_changelog_generator/generator/generator.rb:105:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for parse_by_sections is too high. [8/7]
    def parse_by_sections(issues, pull_requests)
    ^^^

@bastelfreak
Copy link
Contributor Author

I tried to refactor it, but didn't find a clean solution. If anybody has ideas please let me know. I will try to place the section at the beginning.

@olleolleolle
Copy link
Collaborator

@bastelfreak Failing forward is also a good option!

Add a # rubocop:disable Metrics/CyclomaticComplexity as a comment on the line of the def of the offending method; and the crypt keepers will get to this gnarly bit at some point in the future.

Don't worry about it.

@bastelfreak
Copy link
Contributor Author

@olleolleolle I reordered the output, the breaking stuff should now be the first.

@bastelfreak
Copy link
Contributor Author

Hi @olleolleolle, what needs to be done to get this merged?

@bastelfreak
Copy link
Contributor Author

I made some tests again and I'm not 100% if it still works after I changed the ordering. I will have a look tomorrow.

@hunner
Copy link
Contributor

hunner commented Aug 10, 2017

Q: If a PR is marked as both Breaking and an Enhancement, it would be in both lists, right?

No, backwards-incompatible (or "breaking") changes are always features because you are enhancing the project with behavior that is desirable, so it would not make sense to put them in both sections.

For a standardized workflow around this, see http://keepachangelog.com/ . It's great, because it tries to make a portable standardized changelog format that works anywhere, and has a formal definition for what goes in each section and how to adhere to http://semver.org/ .

@bastelfreak
Copy link
Contributor Author

Hi @olleolleolle @skywinder could you recheck this PR?
I fixed one issue and rebased against latest master.

@bastelfreak
Copy link
Contributor Author

Hi @olleolleolle, can you check this PR as well? Would be awesome!

@olleolleolle
Copy link
Collaborator

olleolleolle commented Sep 30, 2017

  • Style Feedback: Avoid using push, use "the shovel operator" (<<) to append to lists.
  • Design note: Avoid adding more repetition: Find a way to not add a fourth repeat of things which are already too long
    • example: bugs_a, enhancement_a, breaking_a, issues_a = - this calls out for some sort of structure
    • example continued: generate_sub_section repeated once per those things, each with a named option
    • example continued once more: parse_by_sections also has 4 of this thing

@bastelfreak
Copy link
Contributor Author

  • replaced push with shovel operator
  • rebased

# This method sort issues by types
# (bugs, features, or just closed issues) by labels
#
# @param [Array] issues
# @param [Array] pull_requests
# @return [Array] tuple of filtered arrays: (Bugs, Enhancements Issues)
# @return [Array] tuple of filtered arrays: (Bugs, Enhancements, Breaking stuff, Issues)
def parse_by_sections(issues, pull_requests)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm looking at the code and I'm want some verification: is the goal that an issue is always in 1 section, preferably by a label but otherwise in the container "issues". For Pull requests it should be in 1 section but if it's not, it remains in the pull_requests array (that's modified in place). Correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment, the breaking change appears in multiple sections. See https://github.com/voxpupuli/puppet-rabbitmq/blob/33bc9ef7f69155d602f1cdd5abf5a794d1d8a27c/CHANGELOG.md#v700-2017-09-14 for example of where this branch was recently used.
@hunner has suggested this actually might not be the best behaviour. #530 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

ekohl@f5cb492 is my attempt at a cleanup and has tests. I kept current code if multiple labels match but maybe breaking should be at the top.

@bastelfreak
Copy link
Contributor Author

@olleolleolle I added the commit from @ekohl, could you take a look again?

@olleolleolle
Copy link
Collaborator

@bastelfreak Thanks for that.

Could you fix the lint complaints?

@olleolleolle
Copy link
Collaborator

@bastelfreak Thanks for passing lint checks, I can merge this from here.

@olleolleolle olleolleolle merged commit 21ec2db into github-changelog-generator:master Oct 10, 2017
@bastelfreak bastelfreak deleted the breaking branch October 10, 2017 20:24
@nfischer
Copy link

Should this be documented on the README?

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

Successfully merging this pull request may close these issues.

7 participants