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 new output instead skip_output #637

Merged
merged 3 commits into from
Mar 11, 2024

Conversation

prog-supdex
Copy link
Contributor

Closes #592

⚡ Summary

Deprecate the skip_output and add output as a whitelist of output values
I saved the skip_output logic for further removal in the next versions

☑️ Checklist

  • Check locally
  • Add tests
  • Add documentation

Copy link
Member

@mrexox mrexox left a comment

Choose a reason for hiding this comment

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

I've left a few nitpicks about naming. But the code looks good to me!

Comment on lines 79 to 84
newTags := os.Getenv(envOutput)
tags := os.Getenv(envSkipOutput)

var logSettings log.SkipSettings
(&logSettings).ApplySettings(tags, cfg.SkipOutput)
var logSettings log.SettingsInterface

if tags == "" && cfg.SkipOutput == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Let's use another name in place of 'tags'. What about outputSkipTags and outputLogTags ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, newTags was a temporary name, I just forgot about it and didn`t see it :)

Thanks, I fixed it!

Comment on lines 88 to 89
logSettings = log.NewSkipSettings() //nolint:staticcheck //SA1019: for temporary backward compatibility
logSettings.ApplySettings(tags, cfg.SkipOutput)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a log.Warn telling

skip_output is deprecated, please use output option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -60,6 +60,19 @@ const (
spinnerText = " waiting"
)

type SettingsInterface interface {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should name it just Settings

Copy link
Member

Choose a reason for hiding this comment

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

Let's move this interface to the settings.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 65 to 73
SkipSuccess() bool
SkipFailure() bool
SkipSummary() bool
SkipMeta() bool
SkipExecution() bool
SkipExecutionOutput() bool
SkipExecutionInfo() bool
SkipSkips() bool
SkipEmptySummary() bool
Copy link
Member

Choose a reason for hiding this comment

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

Since we move away from negation (output instead of skip_output and Settings instead of SkipSettings) I think it makes sense to change these methods to LogSuccess(), LogFailure(), .... It sounds more natural, doesn't it?

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I agree, but I kept the same methods for compatibility with the SkipSettings and to avoid changing Skip* methods everywhere in the Lefthook code and I did not want to change other places :)

If I change methods in Settings, it means I need to change methods in SkipSettings and change it in other places, but if it is ok if I rename Skip* methods everywhere, no problem I will do it! :)

Copy link
Member

Choose a reason for hiding this comment

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

I think it makes sense to change the naming so it is more intuitive 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

enableAll = ^0 // Set all bits as 1
)

type Settings int16
Copy link
Member

Choose a reason for hiding this comment

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

We can name it as OutputSettings if we rename the SettingsInterface to just Settings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@mrexox mrexox left a comment

Choose a reason for hiding this comment

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

Awesome work! Thank you!

@mrexox mrexox merged commit ce6c29b into evilmartians:master Mar 11, 2024
17 checks passed
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

Successfully merging this pull request may close these issues.

Not just skip_output, specify output explicitly
2 participants