Skip to content

Commit

Permalink
Merge pull request #260 from xmidt-org/update-style
Browse files Browse the repository at this point in the history
  • Loading branch information
denopink committed Apr 24, 2023
2 parents 73876d7 + b7389f2 commit 577ed92
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ jobs:
with:
copyright-skip: true
release-type: program
style-skip: true
secrets: inherit
12 changes: 6 additions & 6 deletions WRPAccessControl.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/xmidt-org/wrp-go/v3"
)

//partnerAuthority errors
// partnerAuthority errors
var (
ErrTokenMissing = &xhttp.Error{Code: http.StatusInternalServerError, Text: "No JWT Token was found in context"}
ErrTokenTypeMismatch = &xhttp.Error{Code: http.StatusInternalServerError, Text: "Token must be a JWT"}
Expand All @@ -21,7 +21,7 @@ var (
ErrPIDMismatch = &xhttp.Error{Code: http.StatusForbidden, Text: "Unauthorized partners credentials in WRP message"}
)

//WRPCheckConfig drives the WRP Access control configuration when enabled
// WRPCheckConfig drives the WRP Access control configuration when enabled
type WRPCheckConfig struct {
Type string
}
Expand Down Expand Up @@ -55,8 +55,8 @@ func (p *wrpPartnersAccess) withSuccess(labelValues ...string) metrics.Counter {
return p.receivedWRPMessageCount.With(append(labelValues, OutcomeLabel, Accepted)...)
}

//authorizeWRP runs the partners access policy against the WRP and returns an error if the check fails.
//When the policy is not strictly enforced,
// authorizeWRP runs the partners access policy against the WRP and returns an error if the check fails.
// When the policy is not strictly enforced,
// Additionally, when the policy is not a boolean is returned for failure cases where the policy autocorrects the WRP contents
func (p *wrpPartnersAccess) authorizeWRP(ctx context.Context, message *wrp.Message) (bool, error) {
var (
Expand Down Expand Up @@ -142,7 +142,7 @@ func (p *wrpPartnersAccess) authorizeWRP(ctx context.Context, message *wrp.Messa
return true, nil
}

//returns true if list contains str
// returns true if list contains str
func contains(list []string, str string) bool {
for _, e := range list {
if e == str {
Expand All @@ -152,7 +152,7 @@ func contains(list []string, str string) bool {
return false
}

//returns true if a is a subset of b
// returns true if a is a subset of b
func isSubset(a, b []string) bool {
m := make(map[string]bool)

Expand Down
4 changes: 2 additions & 2 deletions WRPHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func (o *nonWRPResponseWriter) WRPFormat() wrp.Format {
return wrp.Msgpack
}

//nonWRPResponseWriterFactory helps configure the WRP handler to fulfill scytale's use case of only consuming
//WRP requests but not produce WRP responses
// nonWRPResponseWriterFactory helps configure the WRP handler to fulfill scytale's use case of only consuming
// WRP requests but not produce WRP responses
func nonWRPResponseWriterFactory(w http.ResponseWriter, _ *wrphttp.Request) (wrphttp.ResponseWriter, error) {
return &nonWRPResponseWriter{
ResponseWriter: w,
Expand Down
2 changes: 1 addition & 1 deletion metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
// Metrics returns the metrics relevant to this package
func Metrics() []xmetrics.Metric {
return []xmetrics.Metric{
xmetrics.Metric{
{
Name: ReceivedWRPMessageCount,
Type: xmetrics.CounterType,
Help: "Number of WRP Messages successfully decoded and ready for fanout.",
Expand Down
2 changes: 1 addition & 1 deletion scytale_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/xmidt-org/clortho"
)

//JWTValidator provides a convenient way to define jwt validator through config files
// JWTValidator provides a convenient way to define jwt validator through config files
type JWTValidator struct {
// Config is used to create the clortho Resolver & Refresher for JWT verification keys
Config clortho.Config
Expand Down

0 comments on commit 577ed92

Please sign in to comment.