Skip to content

Commit

Permalink
support comments with expiration date (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Dec 14, 2023
1 parent ce9a764 commit 7b9fb29
Show file tree
Hide file tree
Showing 16 changed files with 312 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"thecodingmachine/phpstan-safe-rule": "1.2",
"sqlftw/sqlftw": "0.1.13",
"php-parallel-lint/php-parallel-lint": "^1.3",
"justinrainbow/json-schema": "^5.2"
"justinrainbow/json-schema": "^5.2",
"staabm/phpstan-todo-by": "^0.1.0"
},
"autoload": {
"classmap": [
Expand Down
49 changes: 48 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions default-config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

includes:
- vendor/spaze/phpstan-disallowed-calls/extension.neon
- vendor/staabm/phpstan-todo-by/extension.neon
# required for dead-code.neon, code-complexity.neon, native-type-coverage.neon
- vendor/symplify/phpstan-rules/config/services/services.neon

Expand Down
1 change: 1 addition & 0 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2120,4 +2120,5 @@
'staabm\\PHPStanDba\\UnresolvableQueryException' => $vendorDir . '/staabm/phpstan-dba/src/UnresolvableQueryException.php',
'staabm\\PHPStanDba\\UnresolvableQueryMixedTypeException' => $vendorDir . '/staabm/phpstan-dba/src/UnresolvableQueryMixedTypeException.php',
'staabm\\PHPStanDba\\UnresolvableQueryStringTypeException' => $vendorDir . '/staabm/phpstan-dba/src/UnresolvableQueryStringTypeException.php',
'staabm\\PHPStanTodoBy\\TodoByRule' => $vendorDir . '/staabm/phpstan-todo-by/src/TodoByRule.php',
);
1 change: 1 addition & 0 deletions vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$baseDir = dirname($vendorDir);

return array(
'staabm\\PHPStanTodoBy\\' => array($vendorDir . '/staabm/phpstan-todo-by/src'),
'staabm\\PHPStanDba\\' => array($vendorDir . '/staabm/phpstan-dba/src'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'TomasVotruba\\UnusedPublic\\' => array($vendorDir . '/tomasvotruba/unused-public/src'),
Expand Down
6 changes: 6 additions & 0 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class ComposerStaticInit9cf8af24a7a084f114b4553be2a1ff9f
public static $prefixLengthsPsr4 = array (
's' =>
array (
'staabm\\PHPStanTodoBy\\' => 21,
'staabm\\PHPStanDba\\' => 18,
),
'W' =>
Expand Down Expand Up @@ -139,6 +140,10 @@ class ComposerStaticInit9cf8af24a7a084f114b4553be2a1ff9f
);

public static $prefixDirsPsr4 = array (
'staabm\\PHPStanTodoBy\\' =>
array (
0 => __DIR__ . '/..' . '/staabm/phpstan-todo-by/src',
),
'staabm\\PHPStanDba\\' =>
array (
0 => __DIR__ . '/..' . '/staabm/phpstan-dba/src',
Expand Down Expand Up @@ -2317,6 +2322,7 @@ class ComposerStaticInit9cf8af24a7a084f114b4553be2a1ff9f
'staabm\\PHPStanDba\\UnresolvableQueryException' => __DIR__ . '/..' . '/staabm/phpstan-dba/src/UnresolvableQueryException.php',
'staabm\\PHPStanDba\\UnresolvableQueryMixedTypeException' => __DIR__ . '/..' . '/staabm/phpstan-dba/src/UnresolvableQueryMixedTypeException.php',
'staabm\\PHPStanDba\\UnresolvableQueryStringTypeException' => __DIR__ . '/..' . '/staabm/phpstan-dba/src/UnresolvableQueryStringTypeException.php',
'staabm\\PHPStanTodoBy\\TodoByRule' => __DIR__ . '/..' . '/staabm/phpstan-todo-by/src/TodoByRule.php',
);

public static function getInitializer(ClassLoader $loader)
Expand Down
50 changes: 50 additions & 0 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,56 @@
},
"install-path": "../staabm/phpstan-dba"
},
{
"name": "staabm/phpstan-todo-by",
"version": "0.1.1",
"version_normalized": "0.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/staabm/phpstan-todo-by.git",
"reference": "da51d05c15eb7ca4e6864c9720975d5fa18bdfc8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/staabm/phpstan-todo-by/zipball/da51d05c15eb7ca4e6864c9720975d5fa18bdfc8",
"reference": "da51d05c15eb7ca4e6864c9720975d5fa18bdfc8",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9 || ^10.5"
},
"time": "2023-12-14T20:13:02+00:00",
"type": "library",
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"staabm\\PHPStanTodoBy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"support": {
"issues": "https://github.com/staabm/phpstan-todo-by/issues",
"source": "https://github.com/staabm/phpstan-todo-by/tree/0.1.1"
},
"funding": [
{
"url": "https://github.com/staabm",
"type": "github"
}
],
"install-path": "../staabm/phpstan-todo-by"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.28.0",
Expand Down
13 changes: 11 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '14aa34865be69b80c00ff9f33c7680e3625b4623',
'reference' => 'e69d3b1ab4897026ae37bc7f0479d02e67d8c287',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '14aa34865be69b80c00ff9f33c7680e3625b4623',
'reference' => 'e69d3b1ab4897026ae37bc7f0479d02e67d8c287',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -184,6 +184,15 @@
'aliases' => array(),
'dev_requirement' => false,
),
'staabm/phpstan-todo-by' => array(
'pretty_version' => '0.1.1',
'version' => '0.1.1.0',
'reference' => 'da51d05c15eb7ca4e6864c9720975d5fa18bdfc8',
'type' => 'library',
'install_path' => __DIR__ . '/../staabm/phpstan-todo-by',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
Expand Down
9 changes: 9 additions & 0 deletions vendor/staabm/phpstan-todo-by/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
2 changes: 2 additions & 0 deletions vendor/staabm/phpstan-todo-by/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tests export-ignore
phpstan.neon export-ignore
3 changes: 3 additions & 0 deletions vendor/staabm/phpstan-todo-by/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/composer.lock
/test.php
21 changes: 21 additions & 0 deletions vendor/staabm/phpstan-todo-by/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Markus Staab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 49 additions & 0 deletions vendor/staabm/phpstan-todo-by/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# phpstan-todo-by: comments with expiration date

PHPStan extension to check for TODO comments with expiration date.
Inspired by @parker_codes's [parker-codes/todo-by](https://github.com/parker-codes/todo_by).

## Example:

```php
<?php

// TODO: 2023-12-14 This comment turns into a PHPStan error after 14th December 2023
function doFoo() {

}

```

## Supported todo formats

Every comment which matches the [supported pattern](https://github.com/staabm/phpstan-todo-by/blob/main/src/TodoByRule.php#L14) will be checked.
The supported dateformat is `YYYY-MM-DD`.
See [all supported examples](https://github.com/staabm/phpstan-todo-by/blob/main/tests/data/example.php) in the Testsuite.


## Installation

To use this extension, require it in [Composer](https://getcomposer.org/):

```
composer require --dev staabm/phpstan-todo-by
```

If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!

<details>
<summary>Manual installation</summary>

If you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:

```
includes:
- vendor/staabm/phpstan-todo-by/extension.neon
```

</details>

## 💌 Give back some love

[Consider supporting the project](https://github.com/sponsors/staabm), so we can make this tool even better even faster for everyone.
39 changes: 39 additions & 0 deletions vendor/staabm/phpstan-todo-by/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "staabm/phpstan-todo-by",

"require": {
"php": "^7.4 || ^8.0"
},

"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9 || ^10.5"
},

"autoload": {
"psr-4": {
"staabm\\PHPStanTodoBy\\": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"scripts": {
"phpstan": "vendor/bin/phpstan --ansi",
"test": "vendor/bin/phpunit tests/"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
}
}
}
4 changes: 4 additions & 0 deletions vendor/staabm/phpstan-todo-by/extension.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
-
class: staabm\PHPStanTodoBy\TodoByRule
tags: [phpstan.rules.rule]
Loading

0 comments on commit 7b9fb29

Please sign in to comment.