Question

I've made a custom standard because my coding style is far from anything anyone would call normal. In fact, I reject about 90% of what many people consider good standards as whitespace spam. That being said, I do think that if I'm going to use a slightly odd coding style I should at least be consistently odd. To that end, I've copied all of the Generic standard sniffs into my custom standard and I'm now modifying\removing those to suit my needs.

The issue I'm having ATM is that I'm trying to find\modify a sniff that will actually limit line length in the manner we are all used to when measuring line length. The current sniff I'm using (which is from the Generic standard so I'm assuming that is the most commonly used) does not reset the count when a newline is encountered.

An example of what is happening (for the purpose of this I'm using very small limits):

$var='789012345678'.
  '2345678';

Currently, if I have a limit of 20 characters this snippet will produce an error because it doesn't reset the count until it reaches a semi-colon (;). I need this to pass unless >20 characters are all on a single actual line (IOW: it needs to reset when it encounters a new line instead of a semicolon).

Note: I do not want to disable the line length sniff altogether.

UPDATE: Someone just posted an answer to this question which led me directly to the solution. I was going to accept that answer but it has been deleted now. I'll give them some time to rewrite the previous answer if they want before I post the solution myself. HINT: it had to do with using the Generic standard. It could've also been improved had they mentioned that it is the PEAR standard which doesn't use newlines; others seem to work normally.

Was it helpful?

Solution

If anyone else has this problem it is because the Generic standard is not meant to be used as a standard. While this isn't exactly what was doing it was effectively the same because I had copied all of the sniffs from it to begin with. Some of the sniffs it includes directly conflict with each other. It is definitely a shortcoming of the library that it produced such erroneous results due to this but it wouldn't have been a problem had I used them correctly (by importing the sniffs I wanted individually into my custom standard definition file).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top