seattlerb / debride

Analyze code for potentially uncalled / dead methods, now with auto-removal.
https://www.zenspider.com/projects/debride.html
720 stars 19 forks source link

debride_rails_whitelist does not generate a whitelist from routes #54

Closed malakai97 closed 2 months ago

malakai97 commented 2 months ago

In rails 6, "rake routes" is replaced with "rails routes". I do not know if the output has changed.

Steps:

rails routes > routes.txt
touch nologs.txt
debride_rails_whitelist routes.txt nologs.txt

Expected: Get a list of whitelisted methods generated from routes.txt (to stdout)

Actual: the list is empty

zenspider commented 2 months ago

the list is empty because you gave it no input to process:

10382 $ debride_rails_whitelist 
error: no files given
usage:
  rake routes > routes.txt
  debride_rails_whitelist routes.txt logfiles... | sort -u > whitelist.txt
10360 $ rails routes > routes.txt
10364 $ debride_rails_whitelist routes.txt log/* 2>/dev/null | sort -u
create
index
join_us
new
past
projects
show
malakai97 commented 2 months ago

I guess I don't see the point of passing the routes at all if it only grabs data from the logs.

zenspider commented 2 months ago

you're welcome to read the code