Added support for comments and metrics in PHP code.

Even though it is supported, PHP is not part of the default file extensions
used during analysis. To include PHP files in the statistical analysis,
the extension needs to be supplied to gitinspector using the -f flag.
This commit is contained in:
Adam Waldenberg 2013-06-06 03:01:07 +02:00
parent 69af5a797b
commit 0e3ce9b339
2 changed files with 7 additions and 7 deletions

View File

@ -17,14 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
__comment_begining__ = {"java": "/*", "c": "/*", "cpp": "/*", "h": "/*", "hpp": "/*", "html": "<!--", "py": "\"\"\"",
"glsl": "/*", "rb": "=begin", "js": "/*", "sql": "/*", "xml": "<!--"}
__comment_begining__ = {"java": "/*", "c": "/*", "cpp": "/*", "h": "/*", "hpp": "/*", "html": "<!--", "php": "/*",
"py": "\"\"\"", "glsl": "/*", "rb": "=begin", "js": "/*", "sql": "/*", "xml": "<!--"}
__comment_end__ = {"java": "*/", "c": "*/", "cpp": "*/", "h": "*/", "hpp": "*/", "html": "-->", "py": "\"\"\"",
"glsl": "*/", "rb": "=end", "js": "*/", "sql": "*/", "xml": "-->"}
__comment_end__ = {"java": "*/", "c": "*/", "cpp": "*/", "h": "*/", "hpp": "*/", "html": "-->", "php": "/*",
"py": "\"\"\"", "glsl": "*/", "rb": "=end", "js": "*/", "sql": "*/", "xml": "-->"}
__comment__ = {"java": "//", "c": "//", "cpp": "//", "h": "//", "hpp": "//", "pl": "#", "py": "#", "glsl": "//",
"rb": "#", "js": "//", "sql": "--"}
__comment__ = {"java": "//", "c": "//", "cpp": "//", "h": "//", "hpp": "//", "pl": "#", "php": "//", "py": "#",
"glsl": "//", "rb": "#", "js": "//", "sql": "--"}
def is_comment(extension, string):
if __comment_begining__.get(extension, None) != None and string.strip().startswith(__comment_begining__[extension]):

View File

@ -27,7 +27,7 @@ import interval
import missing
import subprocess
__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "h": 300, "hpp": 300, "py": 500, "glsl": 1000,
__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "h": 300, "hpp": 300, "php": 500, "py": 500, "glsl": 1000,
"rb": 500, "js": 500, "sql": 1000, "xml": 1000}
class MetricsLogic: