The Cognitive Complexity rule added by @gwilymatgearset in PMD 6.22 (#2297) has text sample code that is no valid Apex.
Please check and fix ALL instances but here are a few issues:
Here's the example code, that needs to be fixed:
https://github.com/pmd/pmd/blob/31bf08af547b6f2028d878114bbceeeacb113349/pmd-apex/src/main/resources/category/apex/design.xml#L112-L143
@adangel @gwilymatgearset will work on this. The original contributor. I couldnt assign it to him. Can you?
I've invited him now as a outside collaborator. @gwilymatgearset can you accept the invite? Then I can assign the issue to you... thanks
@rsoesemann I'm slightly confused by 2 of your comments :)
Uses double quotes instead of single quotes for Strings
That makes it invalid apex doesn't it?

Uses Lowercase Type names string instead of String
I went for upper case rather than lower case here because that's what salesforce do in all of their documentation (and what they do in trailhead)
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_variables.htm
@gwilymatgearset Sorry for the confusion. Your examples just dont compile because of the missing returns but other Apex examples in the same XML are faulty. I mixed this up. If you have time to fix them in one go this would be awesome.
Can do :).