Re: dependency check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-07-22 at 09:51 -0400, Alex Nikitin wrote:

> It would still be quicker with shell tools, imho, granted that some command
> line elitistry would be required... Also if you are going to be doing string
> parsing and manipulation, and string parsing here is all that you are doing,
> there would be no better language than perl to do it with, granted i dont
> like perl and prefer python or php or ruby to it, but when you have a lot of
> string manipulation, perl has no rival i have used yet, though i guess if
> awk were combined with sed, there would be some potential...
> 
> --
> The trouble with programmers is that you can never tell what a programmer is
> doing until it’s too late.  ~Seymour Cray
> 
> 
> 
> On Fri, Jul 22, 2011 at 9:33 AM, Nilesh Govindarajan
> <contact@xxxxxxxxxxxx>wrote:
> 
> > On 07/22/2011 06:56 PM, Alex Nikitin wrote:
> > >
> > >
> > > Or you could just grep the directory, not saying you have to do this,
> > > but this was kind of fun to write anyways, if i spent more time on it, i
> > > could perfect it, but i dont have that kind of time, so this will still
> > > give you a few doubles, but it shouldn't give you false-positives as
> > > long as you have all the extensions in that grep regex (and you cant
> > > make it more generic without introducing false-positives)...
> > >
> > > grep -oiPR "[a-zA-Z0-9]+\.(php|js|png|
> > > jpg|css|htm|html)" directory | awk 'function getfiles(input, files, i,
> > > n, file) {result = ""; n=split(input, files, ":"); for(i=0; i<=n; i++) {
> > > if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu
> > >
> > > This should give you all the files that reference files and the files
> > > they reference.
> > >
> > > --
> > > The trouble with programmers is that you can never tell what a
> > > programmer is doing until it’s too late.  ~Seymour Cray
> > >
> >
> > It is possible to use the shell tools, but it is a big trouble to handle
> > spaces and special characters in shell scripting if your filenames have
> > them, quite rare with self created applications, but you can't say, and
> > hence I suggested python/php script method.
> >
> > --
> > Regards,
> > Nilesh Govindarajan
> > @nileshgr on twitter/identica
> >



The only problem you may run into is an include that's part of a logic
branch in your code that never gets called under any circumstance (maybe
the logic changed and you no longer require a certain set of functions
for example)

It's also possible that your bigger problem isn't rogue files that
aren't being used but files with lots of unused functions, unused class
methods, etc. Sometimes the only way to find those is by tracing back
all the way from each function/method in turn.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux