josephdpurcell / phpmd-phpnsc-comparison

A comparison of PHPMD and PHPNSC
0 stars 1 forks source link

Unexpected phpnsc output #1

Open josephdpurcell opened 5 years ago

josephdpurcell commented 5 years ago

Here is the output I get:

$  ./vendor/bin/phpmd src text cleancode
/Users/joepurcell/src/github.com/josephdpurcell/phpmd-phpnsc-comparison/src/Controller/Spaceship.php:12 Missing class import via use statement (line '12', column '18').

$  ./vendor/bin/phpnsc run phpnsc_config.json
Scan /Users/joepurcell/src/github.com/josephdpurcell/phpmd-phpnsc-comparison/src
... 3/3

Analyze /Users/joepurcell/src/github.com/josephdpurcell/phpmd-phpnsc-comparison/src
Got 3 files
Collect entities...
Got 2 defined entities
Check namespaces...
... 3/3

Errors found:

/Users/joepurcell/src/github.com/josephdpurcell/phpmd-phpnsc-comparison/src/PhpmdPhpnscComparison/Model/Ether.php (4): Namespace does not match folder structure, got PhpmdPhpnscComparison\Model expected PhpmdPhpnscComparison\PhpmdPhpnscComparison\Model
Time: 61 ms, Memory: 6.00 MB

I would expect more phpnsc errors.

josephdpurcell commented 5 years ago

I've added reports to this repo. You can compare the outputs here:

I would expect errors to be triggered for these lines:

# PHPMD PHPNSC Line in Code Expected Error
1 https://github.com/josephdpurcell/phpmd-phpnsc-comparison/blob/master/src/PhpmdPhpnscComparison/Model/Ether.php#L4 Namespace does not match folder structure
2 https://github.com/josephdpurcell/phpmd-phpnsc-comparison/blob/master/src/PhpmdPhpnscComparison/Model/Ether.php#L7 Class PhpmdPhpnscComparison\Meaning was referenced but not defined
3 https://github.com/josephdpurcell/phpmd-phpnsc-comparison/blob/master/src/Controller/Spaceship.php#L12 Class Spaceship was referenced using FQCN but has no matching use statement
4 https://github.com/josephdpurcell/phpmd-phpnsc-comparison/blob/master/src/Controller/Spaceship.php#L18 Class ControllerHelper was referenced relatively but not defined
5 https://github.com/josephdpurcell/phpmd-phpnsc-comparison/blob/master/src/Model/Spaceship.php#L6 Class Response was declared in a use statement but is not usd

I'm wondering if either (a) I'm misconfiguring phpcs or phpnsc, or (b) these tools do not support these types of checks.