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

add noDefaultLabels config flag #1966

Merged
merged 4 commits into from
Apr 29, 2021

Conversation

laughedelic
Copy link
Contributor

@laughedelic laughedelic commented Apr 27, 2021

What Changed

New configuration flag: noDefaultLabels: boolean.

Why

An attempt to fix #1955.

Instead of adding a flag to create-labels command, I added a configuration flag. I couldn't find where create-labels adds defaults to the configured labels, but I think that it happens in the configuration processing code. So I made a change there.

Change Type

Indicate the type of change your pull request is:

  • documentation
  • patch
  • minor
  • major

Comment on lines 41 to 45
const userLabels: ILabelDefinition[] = config.labels.map(normalizeLabel);

if (config.noDefaultLabels) {
return userLabels;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand the normalizeLabel function applied to the config.labels here. Should we skip it too?

In particular, this part looks suspicious:

https://github.com/laughedelic/auto/blob/0e921420d2e4a7bc6da32c2255f7107fb7ce97bf/packages/core/src/config.ts#L26-L30

It seems that if a used label has non-none release type, it will be replaced with a default label with the same release type 🤔 This would be rather strange behaviour.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That gets the colors and descriptions for the default labels. Not exactly sure why is skips the none labels. There might be a test for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the context of this change it should be safe to keep.

What do you think? Would you as a user expect this config option to also disable the descriptions and other metadata?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, as a user, I would expect that if I say "don't use default labels", it uses only the information I provide in the labels field. I'd be surprised if it added descriptions or colors that I didn't ask for and would be forced to override them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it in 338309b.

I'm open to changing the config option name if you think it helps, e.g. addDefaultLabels (true by default) or defaultLabels or normalizeLabels (IMO less obvious for the users).

@laughedelic laughedelic marked this pull request as ready for review April 27, 2021 19:53
@adierkens adierkens added the minor Increment the minor version when merged label Apr 28, 2021
@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@3c51664). Click here to learn what that means.
The diff coverage is 33.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1966   +/-   ##
=======================================
  Coverage        ?   80.24%           
=======================================
  Files           ?       65           
  Lines           ?     5296           
  Branches        ?     1235           
=======================================
  Hits            ?     4250           
  Misses          ?      695           
  Partials        ?      351           
Impacted Files Coverage Δ
packages/core/src/config.ts 89.47% <33.33%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c51664...b9df9a3. Read the comment docs.

@hipstersmoothie hipstersmoothie merged commit 7fabf23 into intuit:main Apr 29, 2021
@laughedelic laughedelic deleted the fix/no-default-labels-config branch April 29, 2021 00:37
@adierkens
Copy link
Collaborator

🚀 PR was released in v10.26.0 🚀

@adierkens adierkens added the released This issue/pull request has been released. label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Label creation adds unwanted default labels
3 participants