phpcheckstyle icon indicating copy to clipboard operation
phpcheckstyle copied to clipboard

Read string as well as a file

Open jbrooksuk opened this issue 11 years ago • 4 comments

Currently PHPCheckstyle is only able to check the style guides against files and not a string itself.

Rather than messing with processFiles, I'm thinking of adding just process as a method itself. This gives the end-developer much more flexibility.

jbrooksuk avatar Aug 19 '14 13:08 jbrooksuk

I like the idea, to be able to process any given string would be cool.

We will need to cleanup a few things I think. The "processFiles" method set up some variables and flags (current file name, ...). We can check if we have consistent defaut values for these flags, and when possible eliminate or move all these variables.

tchule avatar Aug 22 '14 07:08 tchule

When I was looking at doing this, I realised that processFiles does too much in one method:

  • Setup error handlers
  • Grab the sources
  • Begin counting lines
  • Process each file
  • Clean up

We could split out some methods so that they can be re-used by a process method.

jbrooksuk avatar Aug 22 '14 07:08 jbrooksuk

Agree, there is some cleanup to do.

tchule avatar Aug 22 '14 09:08 tchule

I started looking at this, but quickly realised that there are a lot of changes required.

  • Tokenizer@tokenize takes a file name for example.
  • PHPCheckstyle@processFiles calls _processFile which assume it's a file.

This requires a big rewrite of the core methods.

jbrooksuk avatar Sep 02 '14 16:09 jbrooksuk