-
Notifications
You must be signed in to change notification settings - Fork 220
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
Conversation
There was a problem hiding this 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!
internal/lefthook/run.go
Outdated
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 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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!
internal/lefthook/run.go
Outdated
logSettings = log.NewSkipSettings() //nolint:staticcheck //SA1019: for temporary backward compatibility | ||
logSettings.ApplySettings(tags, cfg.SkipOutput) |
There was a problem hiding this comment.
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 useoutput
option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
internal/log/log.go
Outdated
@@ -60,6 +60,19 @@ const ( | |||
spinnerText = " waiting" | |||
) | |||
|
|||
type SettingsInterface interface { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
internal/log/log.go
Outdated
SkipSuccess() bool | ||
SkipFailure() bool | ||
SkipSummary() bool | ||
SkipMeta() bool | ||
SkipExecution() bool | ||
SkipExecutionOutput() bool | ||
SkipExecutionInfo() bool | ||
SkipSkips() bool | ||
SkipEmptySummary() bool |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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! :)
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
internal/log/settings.go
Outdated
enableAll = ^0 // Set all bits as 1 | ||
) | ||
|
||
type Settings int16 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this 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!
Closes #592
⚡ Summary
Deprecate the
skip_output
and addoutput
as a whitelist of output valuesI saved the
skip_output
logic for further removal in the next versions☑️ Checklist