Skip to content

Commit

Permalink
* ignore _ide_helper*.php and disable some rules @ phpmd.xml
Browse files Browse the repository at this point in the history
* fix returning `HasOne` instead of `Builder` in runtine since 37dbe24 @ `App\Http\Controllers\PostQuery->query()`
@ be

$ git ls-files -z | xargs -0 dos2unix
  • Loading branch information
n0099 committed Sep 15, 2024
1 parent efe7d9a commit 2766c30
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
5 changes: 1 addition & 4 deletions be/app/Http/Controllers/PostsQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public function query(\Illuminate\Http\Request $request): array
->concat(LatestReplier::query()->whereIn('id', $latestRepliersId)
->whereNull('uid')->selectPublicFields()
->addSelect(['name', 'displayName'])->get());
$whereCurrentFid = /**
* @psalm-return \Illuminate\Database\Eloquent\Builder<TRelatedModel>
*/
static fn(HasOne $q): \Illuminate\Database\Eloquent\Builder => $q->where('fid', $result['fid']);
$whereCurrentFid = static fn(HasOne $q): HasOne => $q->where('fid', $result['fid']);
$users = User::query()->whereIn(
'uid',
collect($result)
Expand Down
22 changes: 19 additions & 3 deletions be/phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@
xsi:noNamespaceSchemaLocation="http://phpmd.org/xml/ruleset_xml_schema_1.0.0.xsd">
<!-- https://github.com/phpmd/phpmd/issues/506 -->
<exclude-pattern>vendor</exclude-pattern>
<exclude-pattern>_ide_helper*.php</exclude-pattern>
<!-- https://github.com/phpmd/phpmd/tree/2.15.0/src/main/resources/rulesets -->
<rule ref="rulesets/cleancode.xml" />
<!-- https://gist.github.com/slayerfat/2b3cc4faf94d2863b505 -->
<rule ref="rulesets/cleancode.xml">
<exclude name="StaticAccess" />
<exclude name="BooleanArgumentFlag" />
<exclude name="MissingImport" />
</rule>
<rule ref="rulesets/cleancode.xml/MissingImport">
<properties>
<property name="ignore-global" value="true" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml" />
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable" />
<exclude name="ShortVariable" />
</rule>
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter" />
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion c#/crawler/src/Db/BaseUser.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace tbm.Crawler.Db;
namespace tbm.Crawler.Db;

public abstract class BaseUser : TimestampedEntity
{
Expand Down
2 changes: 1 addition & 1 deletion c#/crawler/src/Db/LatestReplier.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ReSharper disable PropertyCanBeMadeInitOnly.Global
// ReSharper disable PropertyCanBeMadeInitOnly.Global
namespace tbm.Crawler.Db;

public class LatestReplier : BaseUser
Expand Down
2 changes: 1 addition & 1 deletion c#/crawler/src/Db/Revision/LatestReplierRevision.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ReSharper disable PropertyCanBeMadeInitOnly.Global
// ReSharper disable PropertyCanBeMadeInitOnly.Global
namespace tbm.Crawler.Db.Revision;

public class LatestReplierRevision
Expand Down

0 comments on commit 2766c30

Please sign in to comment.