diff --git a/README.md b/README.md index 6d4d11c..6588aa2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # PHPCloc :rocket: Cloc & duplicate code checker written in PHP @@ -10,15 +11,31 @@ $ composer global require appzcoder/phpcloc ``` ## Usage -Cloc +### Cloc ``` $ phpcloc cloc . ``` +cloc -Duplicate code checker +### Duplicate code checker ``` $ phpcloc duplicate . --ext=php ``` +duplicate + +#### Available Commands +``` +$ phpcloc cloc directory --ext=php,js --exclude=vendor,node_modules +``` + +``` +$ phpcloc duplicate directory --ext=php --exclude=vendor +``` + +## Todo +- Line number show on duplicate code checker command +- Improve algorithm complexity +- Testing ## Author diff --git a/src/Analyzers/DuplicateAnalyzer.php b/src/Analyzers/DuplicateAnalyzer.php index 5bcc420..67e22dd 100644 --- a/src/Analyzers/DuplicateAnalyzer.php +++ b/src/Analyzers/DuplicateAnalyzer.php @@ -100,12 +100,12 @@ protected function processLines(SplFileObject $file) $isMultilines = false; } - $lineProperties['code'] = $trimLine; + $lineProperties['code'] = $currentLine; $lines[] = $lineProperties; } $code = array_filter($lines, function ($line) { - if (isset($line['blank']) || isset($line['comment']) || in_array($line['code'], ['{', '}'])) { + if (isset($line['blank']) || isset($line['comment'])) { return false; }