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

Breaking changes and refactor (and maybe style) type. #536

Open
kennylajara opened this issue Aug 20, 2023 · 5 comments
Open

Breaking changes and refactor (and maybe style) type. #536

kennylajara opened this issue Aug 20, 2023 · 5 comments

Comments

@kennylajara
Copy link

By definitions, a refactor can not introduce changes, so, I think it is worth mentioning that we should never create a commit message:

refactor!: This is weird

Also, what do you think about style? Can a style change introduce a breaking change?

@Thiernosy82
Copy link

By definitions, a refactor can not introduce changes, so, I think it is worth mentioning that we should never create a commit message:


refactor!: This is weird

Also, what do you think about style? Can a style change introduce a breaking change?

@kennylajara
Copy link
Author

kennylajara commented Aug 22, 2023

Hi @Thiernosy82,
Did you forget to add your comment? Or is this some kind of retweet?

@mentalisttraceur
Copy link

mentalisttraceur commented Aug 22, 2023

I disagree.

"A refactor can not introduce changes" is an assertion that one human-level dictionary definition is the only correct one.

Yes, one definition of "refactor" is a code change with no change to behavior. This is a good definition. I would even argue that in some situations it is the Objectively Rightest definition to use. But that is not the only (good) definition in use today.

If Conventional Commits goes out of its way to forbid combining "this is a refactor" and "this broke some bit of promised API", there should be a strong argument that there is a big benefit to preventing saying it (or forcing it to be said in a way that's just harder to parse/notice).

A few arguments the other way:

  • Principled: it's similar to how composable APIs are good and unnecessary coupling/complecting in code is bad: it's good to keep specs for ways to say things separate from prescriptions about what should or shouldn't be said/done.

  • Principled+Practical: Many people prefer a more flexible meaning of "refactor", and for good reason. Some breaking changes are more refactor-like than fix-like or feature-like. Some breaking changes are only/mainly to enable a valuable refactor.

  • Practical: humans make refactors that break API all the time. Under time pressure and competing priorities, if we notice a refactor breaks API, sometimes the better/necessary decision is to just announce the breakage and move on, not refactor the refactor or philosophize about what other word to use.

@mentalisttraceur
Copy link

mentalisttraceur commented Aug 22, 2023

P.S. Note that Conventional Commits v1.0.0 does not even define a refactor change type - so technically, you could define your own additional convention which extends Conventional Commits by defining a refactor type and disallowing composing it with breaking changes, or a convention for tooling to follow (like "if the environment variable COMMITS_REQUIRE_PURE_REFACTOR is set to a truthy value, reject/warn upon encountering refactor-typed commits with breaking changes).

@mentalisttraceur
Copy link

Well-served by #537 - if I was writing Conventional Commits tooling/libraries, I'd love to have a central place to find good ideas and well-designed proposals for extensions such as "if the environment variable [...] is set, reject/warn upon encountering refactor-typed commits with breaking changes".

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

No branches or pull requests

3 participants