Showing 9 of 39 total issues
Function NewPair
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NewPair(kid string, key interface{}) (Pair, error) {
switch k := key.(type) {
case *rsa.PrivateKey:
verifyPEM, err := MarshalPKIXPublicKeyToPEM(&k.PublicKey)
if err != nil {
Function NewPair
has 15 return statements (exceeds 4 allowed). Open
Open
func NewPair(kid string, key interface{}) (Pair, error) {
switch k := key.(type) {
case *rsa.PrivateKey:
verifyPEM, err := MarshalPKIXPublicKeyToPEM(&k.PublicKey)
if err != nil {
Function NewRequestBuilders
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NewRequestBuilders(o Options) (RequestBuilders, error) {
var rb RequestBuilders
for name, value := range o.Claims {
if len(value.Header) > 0 || len(value.Parameter) > 0 {
if len(value.Variable) > 0 {
Function main
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func main() {
app := fx.New(
xlog.Logger(),
config.CommandLine{Name: applicationName}.Provide(setupFlagSet),
provideMetrics(),
Function NewTlsConfig
has 6 return statements (exceeds 4 allowed). Open
Open
func NewTlsConfig(t *Tls, extra ...PeerVerifier) (*tls.Config, error) {
if t == nil {
return nil, nil
}
Function CheckServerRequirements
has 6 return statements (exceeds 4 allowed). Open
Open
func CheckServerRequirements(k KeyRoutesIn, i IssuerRoutesIn, c ClaimsRoutesIn) error {
if k.Router != nil && i.Router != nil {
// all good ... no need to check anything else
return nil
}
Method Unmarshal.Provide
has 5 return statements (exceeds 4 allowed). Open
Open
func (u Unmarshal) Provide(in ServerIn) (*mux.Router, error) {
if !in.Unmarshaller.IsSet(u.Key) {
if !u.Optional {
return nil, ServerNotConfiguredError{Key: u.Key}
}
Function NewClaimBuilders
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func NewClaimBuilders(n random.Noncer, client xhttpclient.Interface, o Options) (ClaimBuilders, error) {
var (
// at a minimum, the claims from the request will be copied
builders = ClaimBuilders{requestClaimBuilder{}}
staticClaimBuilder = make(staticClaimBuilder)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function NewPair
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func NewPair(kid string, key interface{}) (Pair, error) {
switch k := key.(type) {
case *rsa.PrivateKey:
verifyPEM, err := MarshalPKIXPublicKeyToPEM(&k.PublicKey)
if err != nil {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"