Closed Posnet closed 5 years ago
Ah, very interesting. I suspect it has to do with the combination of nested comments and multiple comment syntaxes. This actually might force me to reconsider a lot of things. Good catch.
I ran into this issue as well. Here's a short file that reproduces the problem:
<?php
function fn1_xpath($a, $cls){
return $a->query("//*[contains(@class, '$cls')]");
}
# Removes <script></script> tag.
#
#
#
function f2($b){ return $b; }
$ loc sample.php
--------------------------------------------------------------------------------
Language Files Lines Blank Comment Code
--------------------------------------------------------------------------------
PHP 1 10 1 10 4294967295
--------------------------------------------------------------------------------
Total 1 10 1 10 4294967295
--------------------------------------------------------------------------------
$ loc --version
count 0.4.1
Should be fixed as it now handles nested and multiline comments in a sane way, though the count for your short reproduction file is still wrong because loc doesn't understand strings yet.
When running loc as
loc . --files
on the phpSimpleSAML project I get the following outputThere seems to be something going wrong with 4294967179
This is on: MacOS El Capitan loc version 0.3.4 rustc 1.12.1 (d4f39402a 2016-10-19)