function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Roshan 10Roshan 10 

How to reduce cognitive complexity of Apex code

I have installed Apex PMD extension in my VSCode. I see a warning message about cognitive complexity and would like to know if there are any articles with examples specific to APEX on how to reduce the complexity
VinayVinay (Salesforce Developers) 
Hi Roshan,

There are no specific references to reduce cognitive complexity.

Review below links which can help you.

https://www.sonarsource.com/docs/CognitiveComplexity.pdf
https://ruwandotnet.wordpress.com/2012/03/13/59/
https://softwareengineering.stackexchange.com/questions/101830/what-does-the-cyclomatic-complexity-of-my-code-mean

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar