Skip to content

Commit 01f3473

Browse files
authored
New developer command to test all third-party extensions (#228)
* New developer command to test all third-party extensions * `composer run-script phpstan-third-party` * Rename the directory for generate.php to `third-party` instead of `tmp` * Take advantage of PHPStan checkMissingOverrideMethodAttribute https://phpstan.org/config-reference#checkmissingoverridemethodattribute * Detected and fixed bug in URL of https://github.com/tunbridgep/freshrss-invidious * Better syntax for registerHook * Fix static * #[\Override] * Static method
1 parent 45a66b0 commit 01f3473

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+197
-111
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
*.min.js
33
node_modules/
44
symbolic/
5+
third-party/
56
tmp/
67
vendor/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
bin/
33
node_modules/
44
symbolic/
5+
third-party/
56
tmp/
67
vendor/

.jshintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.git/
22
node_modules/
33
symbolic/
4+
third-party/
45
tmp/
56
vendor/

.markdownlintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.git/
22
node_modules/
33
symbolic/
4+
third-party/
45
tmp/
56
vendor/

.stylelintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.git/
22
node_modules/
33
symbolic/
4+
third-party/
45
tmp/
56
vendor/

.typos.toml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extend-exclude = [
1717
"bin/",
1818
"node_modules/",
1919
"symbolic/",
20+
"third-party/",
2021
"tmp/",
2122
"vendor/",
2223
"xExtension-ReadingTime/README.md"

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ To install an extension, download [the extension archive](https://github.com/Fre
66
Then, upload the specific extension(s) you want on your server.
77
Extensions must be in the `./extensions` directory of your FreshRSS installation.
88

9+
## Commands for developers
10+
11+
```sh
12+
# Test this repository and its extensions
13+
make test-all
14+
15+
# Test compatibility between `../FreshRSS/` core and all known extensions from `./repositories.json`
16+
./generate.php
17+
composer run-script phpstan-third-party
18+
```
19+
920
## Third-party extensions
1021

1122
There are some FreshRSS extensions out there, developed by community members:

composer.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,22 @@
4545
"ext-pdo_pgsql": "*"
4646
},
4747
"require-dev": {
48-
"php": ">=8.0",
48+
"php": ">=7.4",
4949
"ext-phar": "*",
5050
"ext-tokenizer": "*",
5151
"ext-xmlwriter": "*",
5252
"phpstan/phpstan": "^1.10",
5353
"phpstan/phpstan-strict-rules": "^1.5",
54-
"squizlabs/php_codesniffer": "^3.7"
54+
"squizlabs/php_codesniffer": "^3.9"
5555
},
5656
"scripts": {
5757
"php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
5858
"phtml-lint": "find . -type d -name 'vendor' -prune -o -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
5959
"phpcs": "phpcs . -s",
6060
"phpcbf": "phpcbf . -p -s",
6161
"phpstan": "phpstan analyse --memory-limit 512M .",
62-
"phpstan-next": "phpstan analyse --level 9 --memory-limit 512M $(find . -type d -name 'vendor' -prune -o -name '*.php' -o -name '*.phtml' | grep -Fxvf ./tests/phpstan-next.txt | sort | paste -s -)",
62+
"phpstan-next": "phpstan analyse --memory-limit 512M -c phpstan-next.neon .",
63+
"phpstan-third-party": "phpstan analyse --memory-limit 512M -c phpstan-third-party.neon .",
6364
"test": [
6465
"@php-lint",
6566
"@phtml-lint",

composer.lock

+52-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions.json

+11
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@
221221
"method": "git",
222222
"directory": "xExtension-Invidious"
223223
},
224+
{
225+
"name": "Invidious Video Feed",
226+
"author": "Paul Tunbridge (forked from Korbak and Kevin Papst)",
227+
"description": "Embed YouTube feeds inside article content, but with Invidious.",
228+
"version": "1.1",
229+
"entrypoint": "Invidious",
230+
"type": "user",
231+
"url": "https://github.com/tunbridgep/freshrss-invidious",
232+
"method": "git",
233+
"directory": "xExtension-Invidious"
234+
},
224235
{
225236
"name": "Kagi Summarizer",
226237
"author": "Rudis Muiznieks",

generate.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
// ------------------- //
77
const VERSION = 0.1;
88
const TYPE_GIT = 'git';
9-
$tempFolder = './tmp';
9+
$tempFolder = './third-party/';
1010

1111
$extensions = [];
1212
$gitRepositories = [];
1313
if (file_exists($tempFolder)) {
14+
// TODO: Improve by keeping git copy if possible (e.g. fetch + reset)
1415
exec("rm -rf -- {$tempFolder}");
1516
}
1617

phpstan-next.neon

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
includes:
2+
- phpstan.neon
3+
4+
parameters:
5+
level: 9
6+
excludePaths:
7+
analyse:
8+
- xExtension-ImageProxy/configure.phtml
9+
- xExtension-ImageProxy/extension.php
10+
- xExtension-TTRSS_API/ttrss.php

phpstan-third-party.neon

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
parameters:
2+
level: 0
3+
treatPhpDocTypesAsCertain: false
4+
fileExtensions:
5+
- php
6+
- phtml
7+
paths:
8+
- ../FreshRSS
9+
- third-party/
10+
excludePaths:
11+
analyse:
12+
- ../FreshRSS
13+
- third-party/*/vendor/*
14+
analyseAndScan:
15+
- .git/
16+
- node_modules/
17+
- symbolic/
18+
- third-party/*/tests/*
19+
- tmp/
20+
- vendor/
21+
- xExtension-*
22+
dynamicConstantNames:
23+
- TYPE_GIT
24+
reportMaybesInPropertyPhpDocTypes: false

phpstan.neon

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
# TODO: Increase rule-level https://phpstan.org/user-guide/rule-levels
33
level: 1
4+
phpVersion: 80399 # TODO: Remove line when moving composer.json to PHP 8+
45
treatPhpDocTypesAsCertain: false
56
fileExtensions:
67
- php
@@ -16,10 +17,11 @@ parameters:
1617
- .git/
1718
- node_modules/
1819
- symbolic/
20+
- third-party/
1921
- tmp/
20-
- xExtension-TTRSS_API/
2122
dynamicConstantNames:
2223
- TYPE_GIT
24+
checkMissingOverrideMethodAttribute: true
2325
reportMaybesInPropertyPhpDocTypes: false
2426
strictRules:
2527
allRules: false

repositories.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"url": "https://github.com/babico/xExtension-TwitchChannel2RssFeed",
4545
"type": "git"
4646
}, {
47-
"url": "thttps://github.com/tunbridgep/freshrss-invidious",
47+
"url": "https://github.com/tunbridgep/freshrss-invidious",
4848
"type": "git"
4949
}, {
5050
"url": "https://github.com/javerous/freshrss-greader-redate",

tests/phpstan-next.txt

-7
This file was deleted.

xExtension-ColorfulList/extension.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
declare(strict_types=1);
44

5-
class ColorfulListExtension extends Minz_Extension
5+
final class ColorfulListExtension extends Minz_Extension
66
{
7+
#[\Override]
78
public function init(): void {
89
Minz_View::appendScript($this->getFileUrl('script.js', 'js'));
910
}

xExtension-ColorfulList/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Colorful List",
33
"author": "Claud Xiao",
44
"description": "Colorful Entry Title based on RSS source",
5-
"version": 0.3,
5+
"version": "0.3.1",
66
"entrypoint": "ColorfulList",
77
"type": "user"
88
}

0 commit comments

Comments
 (0)