Skip to content

Commit

Permalink
New developer command to test all third-party extensions
Browse files Browse the repository at this point in the history
* `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
  • Loading branch information
Alkarex committed Apr 7, 2024
1 parent 9f21984 commit cc6bf0d
Show file tree
Hide file tree
Showing 45 changed files with 192 additions and 100 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
*.min.js
node_modules/
symbolic/
third-party/
tmp/
vendor/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
bin/
node_modules/
symbolic/
third-party/
tmp/
vendor/
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git/
node_modules/
symbolic/
third-party/
tmp/
vendor/
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git/
node_modules/
symbolic/
third-party/
tmp/
vendor/
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git/
node_modules/
symbolic/
third-party/
tmp/
vendor/
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extend-exclude = [
"bin/",
"node_modules/",
"symbolic/",
"third-party/",
"tmp/",
"vendor/",
"xExtension-ReadingTime/README.md"
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ To install an extension, download [the extension archive](https://github.com/Fre
Then, upload the specific extension(s) you want on your server.
Extensions must be in the `./extensions` directory of your FreshRSS installation.

## Commands for developers

```sh
# Test this repository and its extensions
make test-all

# Test compatibility between `../FreshRSS/` core and all known extensions from `./repositories.json`
./generate.php
composer run-script phpstan-third-party
```

## Third-party extensions

There are some FreshRSS extensions out there, developed by community members:
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,22 @@
"ext-pdo_pgsql": "*"
},
"require-dev": {
"php": ">=8.0",
"php": ">=7.4",
"ext-phar": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-strict-rules": "^1.5",
"squizlabs/php_codesniffer": "^3.7"
"squizlabs/php_codesniffer": "^3.9"
},
"scripts": {
"php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
"phtml-lint": "find . -type d -name 'vendor' -prune -o -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
"phpcs": "phpcs . -s",
"phpcbf": "phpcbf . -p -s",
"phpstan": "phpstan analyse --memory-limit 512M .",
"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 -)",
"phpstan-next": "phpstan analyse --memory-limit 512M -c phpstan-next.neon .",
"phpstan-third-party": "phpstan analyse --memory-limit 512M -c phpstan-third-party.neon .",
"test": [
"@php-lint",
"@phtml-lint",
Expand Down
81 changes: 52 additions & 29 deletions composer.lock

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

11 changes: 11 additions & 0 deletions extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,17 @@
"method": "git",
"directory": "xExtension-Invidious"
},
{
"name": "Invidious Video Feed",
"author": "Paul Tunbridge (forked from Korbak and Kevin Papst)",
"description": "Embed YouTube feeds inside article content, but with Invidious.",
"version": "1.1",
"entrypoint": "Invidious",
"type": "user",
"url": "https://github.com/tunbridgep/freshrss-invidious",
"method": "git",
"directory": "xExtension-Invidious"
},
{
"name": "Kagi Summarizer",
"author": "Rudis Muiznieks",
Expand Down
3 changes: 2 additions & 1 deletion generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
// ------------------- //
const VERSION = 0.1;
const TYPE_GIT = 'git';
$tempFolder = './tmp';
$tempFolder = './third-party/';

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

Expand Down
10 changes: 10 additions & 0 deletions phpstan-next.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
includes:
- phpstan.neon

parameters:
level: 9
excludePaths:
analyse:
- xExtension-ImageProxy/configure.phtml
- xExtension-ImageProxy/extension.php
- xExtension-TTRSS_API/ttrss.php
24 changes: 24 additions & 0 deletions phpstan-third-party.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
parameters:
level: 0
treatPhpDocTypesAsCertain: false
fileExtensions:
- php
- phtml
paths:
- ../FreshRSS
- third-party/
excludePaths:
analyse:
- ../FreshRSS
- third-party/*/vendor/*
analyseAndScan:
- .git/
- node_modules/
- symbolic/
- third-party/*/tests/*
- tmp/
- vendor/
- xExtension-*
dynamicConstantNames:
- TYPE_GIT
reportMaybesInPropertyPhpDocTypes: false
4 changes: 3 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
# TODO: Increase rule-level https://phpstan.org/user-guide/rule-levels
level: 1
phpVersion: 80399 # TODO: Remove line when moving composer.json to PHP 8+
treatPhpDocTypesAsCertain: false
fileExtensions:
- php
Expand All @@ -16,10 +17,11 @@ parameters:
- .git/
- node_modules/
- symbolic/
- third-party/
- tmp/
- xExtension-TTRSS_API/
dynamicConstantNames:
- TYPE_GIT
checkMissingOverrideMethodAttribute: true
reportMaybesInPropertyPhpDocTypes: false
strictRules:
allRules: false
Expand Down
2 changes: 1 addition & 1 deletion repositories.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"url": "https://github.com/babico/xExtension-TwitchChannel2RssFeed",
"type": "git"
}, {
"url": "thttps://github.com/tunbridgep/freshrss-invidious",
"url": "https://github.com/tunbridgep/freshrss-invidious",
"type": "git"
}, {
"url": "https://github.com/javerous/freshrss-greader-redate",
Expand Down
7 changes: 0 additions & 7 deletions tests/phpstan-next.txt

This file was deleted.

3 changes: 2 additions & 1 deletion xExtension-ColorfulList/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

declare(strict_types=1);

class ColorfulListExtension extends Minz_Extension
final class ColorfulListExtension extends Minz_Extension
{
#[Override]
public function init(): void {
Minz_View::appendScript($this->getFileUrl('script.js', 'js'));
}
Expand Down
2 changes: 1 addition & 1 deletion xExtension-ColorfulList/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Colorful List",
"author": "Claud Xiao",
"description": "Colorful Entry Title based on RSS source",
"version": 0.3,
"version": "0.3.1",
"entrypoint": "ColorfulList",
"type": "user"
}
Loading

0 comments on commit cc6bf0d

Please sign in to comment.