Function matchFormat
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
func matchFormat(format *PresentationDefinitionClaimFormatDesignations, credential vc.VerifiableCredential) bool {
if format == nil || len(*format) == 0 {
return true
}
- 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 matchFilter
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func matchFilter(filter Filter, value interface{}) (bool, error) {
// first we check if it's an enum, so we can recursively call matchFilter for each value
if filter.Enum != nil {
for _, enum := range filter.Enum {
f := Filter{
- 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 matchFilter
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func matchFilter(filter Filter, value interface{}) (bool, error) {
// first we check if it's an enum, so we can recursively call matchFilter for each value
if filter.Enum != nil {
for _, enum := range filter.Enum {
f := Filter{
Method PresentationDefinition.matchSubmissionRequirements
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (presentationDefinition PresentationDefinition) matchSubmissionRequirements(vcs []vc.VerifiableCredential) ([]InputDescriptorMappingObject, []vc.VerifiableCredential, error) {
// first we use the constraint matching algorithm to get the matching credentials
candidates, err := presentationDefinition.matchConstraints(vcs)
if err != nil {
return nil, nil, err
Method PresentationDefinition.matchSubmissionRequirements
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (presentationDefinition PresentationDefinition) matchSubmissionRequirements(vcs []vc.VerifiableCredential) ([]InputDescriptorMappingObject, []vc.VerifiableCredential, error) {
// first we use the constraint matching algorithm to get the matching credentials
candidates, err := presentationDefinition.matchConstraints(vcs)
if err != nil {
return nil, nil, err
- 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"