Jump to content

Standards Compiler


Recommended Posts

Hi, I have just finished writing a standards compiler and wanted to know what you guys thought.



Its basically a script that runs through every file and directory of a site and checks to see if it is standards complient. (These standards are mine so may not be to anyone elses liking). This project is for my company and team in order to improve code readability.



You can find the source code here https://bitbucket.org/doddsey65/standards-compiler/src as well as some example files to test against



If you want to test it just clone the repo and run class.compiler.php



Note: the formatting of the files, when viewing the errors, is a work in progress.




Link to comment
Share on other sites

- '/meatspin/si' => 'Meatspin link found!!!', - just because the code says 'meatspin' doesn't mean it is a meat spin link

- '/(is_null|isset|empty|intval|strval)/' => 'use type checks instead of type functions', - you are saying don't use things like isset / empty to validate that something was posted ... either you are forcing it so warnings happen or something ...

'/\<\?([^=|^php])/' => 'short php tags should only be used to echo content', - short tags shouldn't be use (IMO) because the setting normally varies on each server and you can spend at least 20 minutes investigating an issue with that

- '/(TRUE|FALSE|NULL)/' => 'booleans should be lower case', - NULL isn't a boolean

- '/(\$[A-Z]+)/' => 'variable names should be lower case', - So someone can't use camel case? $userid instead of $userId?  That is horribly less readable


IMO this is way too rigid to be of any use ...



Link to comment
Share on other sites

Since most IDE's let you make rules for the checks you're doing (and come prepackaged with way more), why wouldn't your company just make a formatting definition file that everyone uses and let the IDE handle this stuff as they code?

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.