ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: emanuele on February 12, 2014, 06:02:04 pm

Title: Long lines... again! :P
Post by: emanuele on February 12, 2014, 06:02:04 pm
Yes, it's not the first time... lol

https://gist.github.com/emanuele45/8966233
This list contains, for each file in ElkArte, the longest line it has, along with the number of chars.

Long lines are not good in my book: they are badTM: most of them are the result of numerous concatenations and repeated and nested ternary operations, etc.

Well, if some one has nothing to do and wants to try to break up some of them, it's an easy task (mostly) that will bring you around the whole code. :P
Title: Re: Long lines... again! :P
Post by: Spuds on February 13, 2014, 05:38:22 pm
What length did you use for to long?   I'm surprised there are only that many left :P
Title: Re: Long lines... again! :P
Post by: emanuele on February 13, 2014, 06:17:26 pm
There is no cut-off, this is just the longest of each file. :P
Title: Re: Long lines... again! :P
Post by: Joshua Dickerson on February 13, 2014, 11:07:36 pm
The one in DataValidator can be nixed as soon as you bump the version to >= 5.2. Just use Filter.
Title: Re: Long lines... again! :P
Post by: Spuds on February 14, 2014, 10:24:37 am
Where is the fun in that when you can have a completely undecipherable regex like that :P  Excellent point really, and then we can also remove the duplicate one in QueryString !
Title: Re: Long lines... again! :P
Post by: Joshua Dickerson on February 14, 2014, 11:23:17 am
You can also replace all of those validations with Zend Validator or Symfony's or anyone's really. They're more likely to stay on top of bugs.
Title: Re: Long lines... again! :P
Post by: Nao on February 14, 2014, 11:23:37 am
Oh, filter... I never used that one. I know I considered it. And then I wondered if it was better than a regex. I suppose so.
Title: Re: Long lines... again! :P
Post by: Joshua Dickerson on February 14, 2014, 12:10:08 pm
It uses regular expressions but they are compiled in C so they are likely faster.
Title: Re: Long lines... again! :P
Post by: emanuele on March 18, 2014, 12:37:10 pm
Do we want to kill the IPv6 validation for filters?
Title: Re: Long lines... again! :P
Post by: Spuds on March 18, 2014, 08:56:58 pm
Forgot about this ... heck yes we do!