denzyldick / phanalist

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code.
https://denzyldick.github.io/phanalist/
MIT License
127 stars 5 forks source link

Scan multiple directories #74

Closed supun-io closed 5 months ago

supun-io commented 5 months ago

I was playing with the source code and made a few changes to make scanning multiple directories possible #12

Instead of adding a new command line argument, I made src a vec so that using multiple srcs is valid:

phanalist --src=./src --src=./app

It's not a perfect solution though.

(I'm happy to work on improvements if the concept looks good)

Some other ideas I had:

denzyldick commented 5 months ago

Hey @supun-io, Thanks for contributing.

It looks like it is supposed to do what you intend. If there are any improvements, you can always make a new PR.

If you call the analyze.output(&mut results, format.clone(), args.summary_only); after the for. You will get the same output; if not, I think it's then something that will need to change in the analyze module.

But for now, I will be merging it. :D

I'm unsure, but printing to the stdout has some overhead. But I will do my research to find out for sure.

denzyldick commented 5 months ago

To scan files, a new argument is probably needed (--file / --files?)

This will be really useful, for what I'm currently building. I'm making a site for Phanalist where you can test a snippet of code. Just like Phpstan and the rest.

supun-io commented 5 months ago

Hey!

It looks like setting --src to a filename works.

phanalist --src=./target/test.php --src=./target/test2.php

I guess WalkDir accepts filenames as well. So, just keeping --src for now would work.

I'm making a site for Phanalist where you can test a snippet of code.

Exiciting!