You need to sign in to do that
Don't have an account?
Soundhariyaa M
How to get the number of lines of comments used in Apex code?
Hi All,
Is there any tools like static code analyzers or any other means to get the number of lines of comments used in our code in Salesforce
Please suggest me any solution!
Is there any tools like static code analyzers or any other means to get the number of lines of comments used in our code in Salesforce
Please suggest me any solution!
>> https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_comments.htm
As mentioned in the above link the comments are not interpreted by the parser so we won't be able to fetch the number of lines of comments.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
You can count the lines of apex but, I think there is no direct way to count the comment line in the code.
But there is the way you can count the lines but it might become tricky.
You can query the body of the apex class using SOQL query.
For Example: In this list, you will be having the whole apex class in the body including comments. Then you can use the String methods to specifically count the comments i.e using split and slicing functions, etc.
If this helped you in finding your solution please mark it as the best answer.
Thanks and Regards
Suraj Tripathi
I'm guessing Trailhead is a pretty good place to start? Any other resources/classes you'd recommend? I could potentially get a course fee paid for by work so long as it isn't too crazy expensive.
Kabosucoin official website (https://kabosucoin.net/)