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

Search for dead code (commented out, not used) #136

Closed
pfrischmuth opened this issue Nov 18, 2016 · 11 comments
Closed

Search for dead code (commented out, not used) #136

pfrischmuth opened this issue Nov 18, 2016 · 11 comments
Assignees

Comments

@pfrischmuth
Copy link
Contributor

pfrischmuth commented Nov 18, 2016

@shinobu
Copy link
Contributor

shinobu commented Nov 18, 2016

this tool https://github.com/sebastianbergmann/phpcpd might proof usefull for refactoring files as well

@shinobu
Copy link
Contributor

shinobu commented Nov 21, 2016

I've tried using the phpdcd and it throws a bunch of errors, but still gives output (with most likely many false positives). I'm going to check those entries and sort out as many false positives as I can, and afterwards you should recheck the updated list. Any complaints about this @pfrischmuth @white-gecko ? Here is the log for reference: phpcdc.txt

I've searched for more ways to find dead code, this feature seems to be pretty rare. One other thing i found was https://phpmd.org/ sadly it doesn't search for unused functions right now, but we can find unused variables which is already a useful feature

https://github.com/exakat/php-static-analysis-tools lists a lot of more or less useful tools - maybe one of the analysers actually can list dead code as well. I might look into them prior to going through the logfile from phpdcd

@k00ni
Copy link
Member

k00ni commented Nov 22, 2016

Hi @shinobu, you should exclude the vendor folder in the search, because it only contains foreign software.

@shinobu
Copy link
Contributor

shinobu commented Nov 22, 2016

@k00ni iirc I ran it in `library/Erfurt' so the vendor folder was ignored

@k00ni
Copy link
Member

k00ni commented Nov 22, 2016

@shinobu: according to your phpcdc.txt file you have lines like:

Notice: Undefined index:  in /home/shino/git/Erfurt/vendor/sebastian/phpdcd/src/Analyser.php on line 274

According to that line, it checked the vendor folder too (vendor/sebastian).

@shinobu
Copy link
Contributor

shinobu commented Nov 22, 2016

The undefined index is in the vendor path because vendor/sebastion/phpdcd is the program i execute to check the Erfurt Code (as mentioned above) @k00ni

@k00ni
Copy link
Member

k00ni commented Nov 22, 2016

You are right, thanks for the info, my bad.

@shinobu
Copy link
Contributor

shinobu commented Nov 24, 2016

This is the Log of the phpmd (as mentioned above mostly unused variables)
phpmd.txt

@shinobu
Copy link
Contributor

shinobu commented Nov 24, 2016

Another thing, as phpdcd versions 1.0.0 1.0.1 1.0.2/stable Composer Package all have errors, it would be great if you could check if they run on your setups without errors @pfrischmuth @white-gecko (that shouldn't take longer than 5 minutes)

@shinobu
Copy link
Contributor

shinobu commented Dec 2, 2016

priorize deleting outcommented code snippets, beware to not delete comments

afterwards go through the phpdcd results

@white-gecko
Copy link
Member

Commend out code should be done in #140 .
The phpdcd is complicated to handle and we don't know, if the result brings much.
The next step should be phpcpd and phpmd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants