doddsey_65 Posted July 22, 2012 Share Posted July 22, 2012 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. Thanks Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted July 24, 2012 Share Posted July 24, 2012 I wouldn't call this a compiler. The word 'compiler' has a very specific definition in computer science. This is a code convention profiler, closer to something like a customized PHP Lint. Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted July 24, 2012 Share Posted July 24, 2012 It would be nice to have some sort of markdown doc explaining WHAT your "standards" are. Quote Link to comment Share on other sites More sharing options...
awjudd Posted July 25, 2012 Share Posted July 25, 2012 - '/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 ... ~awjudd Quote Link to comment Share on other sites More sharing options...
Adam Posted July 25, 2012 Share Posted July 25, 2012 I completely see the need for standards in code. At what point though does it stop being to help productivity and just get plain picky? Quote Link to comment Share on other sites More sharing options...
.josh Posted July 26, 2012 Share Posted July 26, 2012 Hi, I have just finished writing a standards compiler and wanted to know what you guys thought. .... Note: the formatting of the files, when viewing the errors, is a work in progress. Irony ftw. Quote Link to comment Share on other sites More sharing options...
xylex Posted July 26, 2012 Share Posted July 26, 2012 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.