mirror of
https://github.com/snipe/snipe-it.git
synced 2026-08-18 03:06:23 +00:00
Added phpstan ruleset and baseline, added phpmd back
This commit is contained in:
55
.github/workflows/static-analysis.yml
vendored
Normal file
55
.github/workflows/static-analysis.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: Static Analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
analyse:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-version:
|
||||
- "8.5"
|
||||
|
||||
name: PHP ${{ matrix.php-version }}
|
||||
|
||||
steps:
|
||||
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
|
||||
with:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v6
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.php-version }}-composer-
|
||||
|
||||
- name: Install Dependencies
|
||||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||
|
||||
# PHPStan analyses types / dead code / undefined properties, PHPMD covers
|
||||
# the classes PHPStan doesn't (unused parameters, unused locals). Both
|
||||
# honor their baselines so this job only fails on NEW findings, not the
|
||||
# 3400+ pre-existing ones inherited from before analyzer adoption.
|
||||
- name: PHPStan
|
||||
run: composer analyse:phpstan
|
||||
|
||||
- name: PHPMD
|
||||
run: composer analyse:phpmd
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -75,4 +75,5 @@ storage/ldap_client_tls.cert
|
||||
storage/ldap_client_tls.key
|
||||
/storage/framework/testing
|
||||
|
||||
/.phpunit.cache
|
||||
/.phpunit.cache
|
||||
/.claude/
|
||||
@ -85,6 +85,7 @@
|
||||
"mockery/mockery": "^1.4",
|
||||
"nunomaduro/phpinsights": "^2.11",
|
||||
"php-mock/php-mock-phpunit": "^2.10",
|
||||
"phpmd/phpmd": "^2.15",
|
||||
"phpunit/phpunit": "^11.0",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
@ -125,7 +126,15 @@
|
||||
"php artisan key:generate"
|
||||
],
|
||||
"coverage:herd:clover": "herd coverage vendor/bin/phpunit --coverage-clover tests/coverage/clover.xml",
|
||||
"coverage:herd:html": "herd coverage vendor/bin/phpunit --coverage-html tests/coverage/html"
|
||||
"coverage:herd:html": "herd coverage vendor/bin/phpunit --coverage-html tests/coverage/html",
|
||||
"analyse": [
|
||||
"@analyse:phpstan",
|
||||
"@analyse:phpmd"
|
||||
],
|
||||
"analyse:phpstan": "phpstan analyse --memory-limit=2G",
|
||||
"analyse:phpstan:baseline": "phpstan analyse --memory-limit=2G --generate-baseline=phpstan-baseline.neon",
|
||||
"analyse:phpmd": "phpmd app text phpmd-ruleset.xml --baseline-file phpmd.baseline.xml",
|
||||
"analyse:phpmd:baseline": "phpmd app xml phpmd-ruleset.xml --generate-baseline"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
|
||||
311
composer.lock
generated
311
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b07733bef3a84d79cc91c9bad1892299",
|
||||
"content-hash": "3c0126d219147bf831e2c034cee67319",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alek13/slack",
|
||||
@ -13663,6 +13663,69 @@
|
||||
],
|
||||
"time": "2025-10-16T20:10:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pdepend/pdepend",
|
||||
"version": "2.16.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pdepend/pdepend.git",
|
||||
"reference": "f942b208dc2a0868454d01b29f0c75bbcfc6ed58"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pdepend/pdepend/zipball/f942b208dc2a0868454d01b29f0c75bbcfc6ed58",
|
||||
"reference": "f942b208dc2a0868454d01b29f0c75bbcfc6ed58",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.7",
|
||||
"symfony/config": "^2.3.0|^3|^4|^5|^6.0|^7.0",
|
||||
"symfony/dependency-injection": "^2.3.0|^3|^4|^5|^6.0|^7.0",
|
||||
"symfony/filesystem": "^2.3.0|^3|^4|^5|^6.0|^7.0",
|
||||
"symfony/polyfill-mbstring": "^1.19"
|
||||
},
|
||||
"require-dev": {
|
||||
"easy-doc/easy-doc": "0.0.0|^1.2.3",
|
||||
"gregwar/rst": "^1.0",
|
||||
"squizlabs/php_codesniffer": "^2.0.0"
|
||||
},
|
||||
"bin": [
|
||||
"src/bin/pdepend"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PDepend\\": "src/main/php/PDepend"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "Official version of pdepend to be handled with Composer",
|
||||
"keywords": [
|
||||
"PHP Depend",
|
||||
"PHP_Depend",
|
||||
"dev",
|
||||
"pdepend"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/pdepend/pdepend/issues",
|
||||
"source": "https://github.com/pdepend/pdepend/tree/2.16.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/pdepend/pdepend",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-17T18:09:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
"version": "2.0.4",
|
||||
@ -14217,6 +14280,89 @@
|
||||
},
|
||||
"time": "2024-03-27T12:14:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpmd/phpmd",
|
||||
"version": "2.15.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpmd/phpmd.git",
|
||||
"reference": "74a1f56e33afad4128b886e334093e98e1b5e7c0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpmd/phpmd/zipball/74a1f56e33afad4128b886e334093e98e1b5e7c0",
|
||||
"reference": "74a1f56e33afad4128b886e334093e98e1b5e7c0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer/xdebug-handler": "^1.0 || ^2.0 || ^3.0",
|
||||
"ext-xml": "*",
|
||||
"pdepend/pdepend": "^2.16.1",
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"easy-doc/easy-doc": "0.0.0 || ^1.3.2",
|
||||
"ext-json": "*",
|
||||
"ext-simplexml": "*",
|
||||
"gregwar/rst": "^1.0",
|
||||
"mikey179/vfsstream": "^1.6.8",
|
||||
"squizlabs/php_codesniffer": "^2.9.2 || ^3.7.2"
|
||||
},
|
||||
"bin": [
|
||||
"src/bin/phpmd"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PHPMD\\": "src/main/php"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Manuel Pichler",
|
||||
"email": "github@manuel-pichler.de",
|
||||
"homepage": "https://github.com/manuelpichler",
|
||||
"role": "Project Founder"
|
||||
},
|
||||
{
|
||||
"name": "Marc Würth",
|
||||
"email": "ravage@bluewin.ch",
|
||||
"homepage": "https://github.com/ravage84",
|
||||
"role": "Project Maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Other contributors",
|
||||
"homepage": "https://github.com/phpmd/phpmd/graphs/contributors",
|
||||
"role": "Contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.",
|
||||
"homepage": "https://phpmd.org/",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"mess detection",
|
||||
"mess detector",
|
||||
"pdepend",
|
||||
"phpmd",
|
||||
"pmd"
|
||||
],
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/phpmd",
|
||||
"issues": "https://github.com/phpmd/phpmd/issues",
|
||||
"source": "https://github.com/phpmd/phpmd/tree/2.15.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/phpmd/phpmd",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-11T08:22:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "2.1.55",
|
||||
@ -16294,6 +16440,169 @@
|
||||
],
|
||||
"time": "2026-05-05T15:33:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v7.4.15",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/config.git",
|
||||
"reference": "b18e33881ef402ad940f36e85935420624009bf4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/b18e33881ef402ad940f36e85935420624009bf4",
|
||||
"reference": "b18e33881ef402ad940f36e85935420624009bf4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/filesystem": "^7.1|^8.0",
|
||||
"symfony/polyfill-ctype": "~1.8"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/finder": "<6.4",
|
||||
"symfony/service-contracts": "<2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/event-dispatcher": "^6.4|^7.0|^8.0",
|
||||
"symfony/finder": "^6.4|^7.0|^8.0",
|
||||
"symfony/messenger": "^6.4|^7.0|^8.0",
|
||||
"symfony/service-contracts": "^2.5|^3",
|
||||
"symfony/yaml": "^6.4|^7.0|^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Config\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/config/tree/v7.4.15"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-22T12:54:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v7.4.15",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dependency-injection.git",
|
||||
"reference": "b7825671c553af46a98c744e23f37f972aee6427"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b7825671c553af46a98c744e23f37f972aee6427",
|
||||
"reference": "b7825671c553af46a98c744e23f37f972aee6427",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"psr/container": "^1.1|^2.0",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/service-contracts": "^3.6",
|
||||
"symfony/var-exporter": "^6.4.20|^7.2.5|^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"ext-psr": "<1.1|>=2",
|
||||
"symfony/config": "<6.4",
|
||||
"symfony/finder": "<6.4",
|
||||
"symfony/yaml": "<6.4"
|
||||
},
|
||||
"provide": {
|
||||
"psr/container-implementation": "1.1|2.0",
|
||||
"symfony/service-implementation": "1.1|2.0|3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "^6.4|^7.0|^8.0",
|
||||
"symfony/expression-language": "^6.4|^7.0|^8.0",
|
||||
"symfony/yaml": "^6.4|^7.0|^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\DependencyInjection\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/dependency-injection/tree/v7.4.15"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nicolas-grekas",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-22T08:40:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-client",
|
||||
"version": "v7.4.9",
|
||||
|
||||
47
phpmd-ruleset.xml
Normal file
47
phpmd-ruleset.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Snipe-IT PHPMD Ruleset"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
<description>
|
||||
Targeted PHPMD rules for the classes of finding PHPStan doesn't cover.
|
||||
Scoped narrowly on purpose: broad PHPMD rulesets create thousands of
|
||||
style-level warnings on a large Laravel codebase. This one focuses on
|
||||
the concrete gap (unused code) so signal stays useful and CI stays fast.
|
||||
</description>
|
||||
|
||||
<!--
|
||||
UnusedFormalParameter — catches method parameters that get declared but
|
||||
never referenced in the body. This is the specific rule that flagged
|
||||
adjustQuantityRedirect's dead $model argument.
|
||||
-->
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
|
||||
|
||||
<!--
|
||||
UnusedLocalVariable — variables assigned then never read. Almost always
|
||||
a copy-paste artifact or a refactor that left a dead handle behind.
|
||||
-->
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
|
||||
|
||||
<!--
|
||||
UnusedPrivateMethod — private methods with no call sites in the same
|
||||
class. Public methods are excluded because they're part of an API
|
||||
contract that could be called from outside the class.
|
||||
-->
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
|
||||
|
||||
<!--
|
||||
UnusedPrivateField — private properties never read or written. Public
|
||||
properties excluded for the same reason as above.
|
||||
-->
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
|
||||
|
||||
<!--
|
||||
Exclude paths that would generate too much noise for the value they
|
||||
add. Migrations use $table parameters in closures that PHPMD doesn't
|
||||
always track through; tests deliberately declare unused arguments to
|
||||
satisfy PHPUnit provider signatures; vendor is not our code.
|
||||
-->
|
||||
<exclude-pattern>database/migrations/*</exclude-pattern>
|
||||
<exclude-pattern>tests/*</exclude-pattern>
|
||||
</ruleset>
|
||||
115
phpmd.baseline.xml
Normal file
115
phpmd.baseline.xml
Normal file
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0"?>
|
||||
<phpmd-baseline>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Console/Commands/FixMismatchedAssetsAndLogs.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Console/Commands/ImportLocations.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Console/Commands/LdapTroubleshooter.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Console/Commands/ObjectImportCommand.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Console/Commands/RestoreFromBackup.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Console/Commands/SendInventoryAlerts.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Exceptions/Handler.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Exceptions/Handler.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Accessories/AccessoryCheckinController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Controllers/Api/AccessoriesController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Api/AssetsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Api/LabelsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Api/LicenseSeatsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Api/SettingsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Controllers/Api/SettingsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Api/UsersController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Assets/AssetCheckinController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Assets/AssetsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Auth/SamlController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Components/ComponentCheckinController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Controllers/CustomFieldsetsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/DepreciationsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Licenses/LicenseCheckinController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Controllers/Reports/CustomComponentReportController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/ReportsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Controllers/SettingsController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Controllers/SetupController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Controllers/Users/UsersController.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Middleware/CheckForSetup.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Middleware/CheckLocale.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Requests/CustomFieldRequest.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Requests/ItemImportRequest.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Requests/SettingsSamlRequest.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Http/Traits/UniqueUndeletedTrait.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Http/Transformers/DepreciationReportTransformer.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Importer/AccessoryImporter.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Importer/ConsumableImporter.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Importer/ItemImporter.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Livewire/Importer.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Livewire/LdapSettings.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/Accessory.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/Asset.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/CheckoutAcceptance.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/CompanyableChildScope.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/CompanyableScope.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/Component.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/CustomField.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/CustomFieldset.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/Labels/DefaultLabel.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/Labels/Label.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/Labels/Sheet.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/Labels/Sheets/Avery/L7162_A.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/Labels/Sheets/Avery/_5520_B.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/Labels/Tapes/Generic/Continuous_53mm.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/Ldap.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/License.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Models/License.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/LicenseSeat.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/SnipeModel.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/SnipeSCIMConfig.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/Traits/Acceptable.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Models/Traits/Searchable.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateMethod" file="app/Models/User.php" method="revokeAssociatedPassportTokens"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateMethod" file="app/Models/User.php" method="purgeAssociatedPassportTokens"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Notifications/AcceptanceItemAcceptedNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Notifications/AcceptanceItemDeclinedNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckinAssetNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/CheckinComponentNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckinComponentNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/CheckinLicenseSeatNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckinLicenseSeatNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckoutAccessoryNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Notifications/CheckoutAssetNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/CheckoutComponentNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckoutComponentNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/CheckoutConsumableNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckoutConsumableNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/CheckoutLicenseSeatNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/CheckoutLicenseSeatNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/ExpectedCheckinAdminNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/ExpectedCheckinNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/ExpiringAssetsNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/ExpiringLicenseNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/InventoryAlert.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/RequestAssetCancelation.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedPrivateField" file="app/Notifications/RequestAssetNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Notifications/SendUpcomingAuditNotification.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/AccessoryObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/AssetModelObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/AssetObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/ComponentObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/ConsumableObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/LicenseObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/LocationObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/MaintenanceObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Observers/SettingObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedLocalVariable" file="app/Observers/UserObserver.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Policies/AssetPolicy.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Policies/CheckoutablePermissionsPolicy.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Policies/LicensePolicy.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Policies/MaintenancePolicy.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Policies/SnipePermissionsPolicy.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Providers/BreadcrumbsServiceProvider.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Providers/RouteServiceProvider.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Providers/ValidationServiceProvider.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Rules/AssetCannotBeCheckedOutToNondeployableStatus.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Rules/CssColor.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Rules/ExternalUrl.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Rules/UniqueUndeleted.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/Rules/ValidJson.php"/>
|
||||
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="app/View/Label.php"/>
|
||||
</phpmd-baseline>
|
||||
12205
phpstan-baseline.neon
Normal file
12205
phpstan-baseline.neon
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,44 @@
|
||||
includes:
|
||||
- ./vendor/nunomaduro/larastan/extension.neon
|
||||
- ./vendor/larastan/larastan/extension.neon
|
||||
- phpstan-baseline.neon
|
||||
|
||||
parameters:
|
||||
paths:
|
||||
- app
|
||||
- config
|
||||
- database/migrations
|
||||
- resources/lang
|
||||
- resources/views
|
||||
- database
|
||||
- routes
|
||||
|
||||
# Level 4 catches dead code branches, always-false instanceof,
|
||||
# unreachable code after return, and most type-mismatch classes
|
||||
# of bug. Anything higher (5+) starts flagging Laravel-magic paths
|
||||
# that need bigger config investments to satisfy. Raise later if
|
||||
# the noise budget allows. Baseline captures pre-existing findings
|
||||
# so CI stays green on this PR; new findings on future PRs will
|
||||
# still fail the check. Unused-parameter detection is handled by
|
||||
# PHPMD (see phpmd-ruleset.xml) since PHPStan intentionally omits
|
||||
# that check to avoid false positives on interface-conforming
|
||||
# methods.
|
||||
level: 4
|
||||
|
||||
# Snipe-IT supports PHP 8.2 through 8.5. Setting phpVersion to the
|
||||
# MINIMUM supported version makes PHPStan flag any 8.3+ syntax
|
||||
# (typed class constants, json_validate, property hooks, etc.)
|
||||
# that would break on an 8.2 deployment. The analyzer itself runs
|
||||
# under whatever version CI provides; only the target check moves.
|
||||
phpVersion: 80200
|
||||
|
||||
parallel:
|
||||
maximumNumberOfProcesses: 4
|
||||
|
||||
# Larastan already understands Laravel Eloquent shapes at level 4.
|
||||
# Ignore common false positives so signal stays useful.
|
||||
ignoreErrors:
|
||||
# $model->save() returns bool but analyzers sometimes flag it as
|
||||
# unused when the caller doesn't branch on it; Snipe-IT has
|
||||
# deliberate fire-and-forget saves in observers where the
|
||||
# return value adds no information.
|
||||
-
|
||||
message: '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder#'
|
||||
paths:
|
||||
- app/Models/*.php
|
||||
|
||||
Reference in New Issue
Block a user