Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for commented code in apex as well in OrgCheck #271

Open
VinceFINET opened this issue May 17, 2023 · 2 comments
Open

Check for commented code in apex as well in OrgCheck #271

VinceFINET opened this issue May 17, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@VinceFINET
Copy link
Collaborator

image

Can you do this?
Check for commented code????

@VinceFINET VinceFINET added the enhancement New feature or request label May 17, 2023
@VinceFINET VinceFINET self-assigned this May 17, 2023
@VinceFINET
Copy link
Collaborator Author

the minimum I could do is to calculate the percentage of code versus comment.
that could be a good start.

@VinceFINET
Copy link
Collaborator Author

SOQL like:

SELECT Id, LengthWithoutComments, body 
FROM ApexClass

Then code like this:

query.forEach(c => { 
    const v = c.LengthWithoutComments !== -1 ? ((c.Body.length-c.LengthWithoutComments)/c.Body.length * 100) : (-1); 
    console.log(c.Id, c.Body.length, c.LengthWithoutComments, v); 
});

That would output something like:

01p3V00000044ywQAA 168 169 -0.5952380952380952
01p3V000001I3zWQAS 503 502 0.19880715705765406
01p3V00000044QzQAI 167 168 -0.5988023952095809
01p3V000000SBZqQAO 219 220 -0.45662100456621
01p3V000000SBZlQAO 468 464 0.8547008547008548
01p3V000000BalqQAC 2036 1779 12.622789783889981
01p3V000000BalrQAC 607 513 15.485996705107082
01p3V000000BaWvQAK 229 194 15.283842794759824
01p3V000000BaX0QAK 104 24 76.92307692307693
01p3V000000BaQnQAK 86 81 5.813953488372093
01p3V000000MErGQAW 817 310 62.0563035495716
...

Needs improvement for sure but that's a start !

I am not answering the question at all.
because i can't parse the comments looking for a specific piece of code....
it can be anything so... might be complex to check if comments are actually old code...

@VinceFINET VinceFINET added this to the Version Boron [B, 5] milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant