Hi team,
We've been using the color picker plugin from https://experience-aem.blogspot.com/2017/06/aem-63-touch-ui-rte-rich-text-editor-color-picker-plugin... on our project. However, our pipeline is failing because the JavaScript for this plugin is being flagged for Code Smell in Sonar. It has a Cognitive Complexity of 149, and Sonar flags anything above 15. Does anyone have a modified version of this color picker plugin that we could use? Any help would be greatly appreciated.
Thanks
Veena
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @VeenaVikraman
You need to check which function/class showing the complexity in sonar? Can you try to modify code via yourself and try if that works or not.
You can get help from ChatGpt
It is showing it for the entire file. That is the issue. The complete file needs a refactoring @arunpatidar
There is a comment from author on the same link
for 65 https://experience-aem.blogspot.com/2019/04/aem-65-touch-ui-rte-rich-text-editor-dialog-color-picker...
65 with core components - https://experience-aem.blogspot.com/2020/01/aem-6530-core-components-280-touch-ui-rte-rich-text-edit...
Are JS the same?
If yes, maybe this plugin in Visual Studio can help
https://marketplace.visualstudio.com/items?itemName=TomiTurtiainen.js-complexity-analysis
Hi @VeenaVikraman
I was checking the complexity via JShint, The most complex function has a cyclomatic complexity value of 8 while the median is 1.5.
how does sonar says 149
@arunpatidar Not sure how it is showing. I missed the screenshot. Will get it once we take and run the piepline to refactor this JS.
@VeenaVikraman Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes