-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Style Guide etc inc f to g #1522
Code Style Guide etc inc f to g #1522
Conversation
( ($flent != "") && ( is_array($filtertext)) && (match_filter_field($flent, $filtertext)) ) ) { | ||
if (!$filterinterface || ($filterinterface == $flent['interface'])) { | ||
if ((($flent != "") && (!is_array($filtertext)) && (match_filter_line ($flent, $filtertext))) || | ||
(($flent != "") && ( is_array($filtertext)) && (match_filter_field($flent, $filtertext)))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, when I did a global "convert leading spaces to tabs" in notepad++ it converts every 4 spaces to a tab. Then it displays (at least for PHP for me) a tab as 4 spaces. So in places like this there is no difference in the appearance in the editor. |
@phil-davis In notepad++, activate View > Show Symbol > Show Whitespace and Tab, it renders tabs as a red arrow and spaces as a red dot. |
Since pfSense uses K&R style, the best is to set editor to show tabs in 8-spaces size |
There are tools like https://github.com/squizlabs/PHP_CodeSniffer that could be useful too, but looks like there is not any standard like K&R there |
In gwlb.inc at line 676 and 779 I added an extra set of brackets. In the "if" clause as a whole there were a mix of && and || used that were relying on the PHP standard that && has precedence over || In actual fact the original code should have been working fine, the extra brackets make sure that the intention is clear.
I checked this for multi-line if statements and fixed it up. Also found a couple more single-line "if" that I had missed. It should be good to go now. |
I use Ultraedit also and prefer it over Notepad++ What about changing "<>" to "!=" to keep everything consistent? |
No description provided.