Skip to content

Commit

Permalink
Modify phpcs ruleset to show all excluded psr-12 rules
Browse files Browse the repository at this point in the history
  • Loading branch information
itismadness committed Nov 4, 2020
1 parent a932da7 commit 4717875
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/Manager/Invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function pendingInvites(string $limit): array {
$where = "WHERE i.Email REGEXP ?";
$args = [$this->search];
}

$this->db->prepared_query("
SELECT i.InviterID AS user_id,
um.IP AS ipaddr,
Expand Down
2 changes: 1 addition & 1 deletion app/Schedule/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(int $taskId, string $name, bool $isDebug) {
}

public function begin() {
$this->startTime = microtime(true);
$this->startTime = microtime(true);
$this->db->prepared_query('
INSERT INTO periodic_task_history
(periodic_task_id)
Expand Down
2 changes: 1 addition & 1 deletion app/Top10/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getTopUsedTags($limit) {
$topUsedTags = $this->db->to_array();
$this->cache->cache_value('topusedtag_' . $limit, $topUsedTags, 3600 * 12);
}

return $topUsedTags;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Top10/Torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function getTopTorrents($getParameters, $details = 'all', $limit = 10) {
$cacheKey = 'top10_v2_' . $details . '_' . md5(implode($getParameters,'')) . '_' . $limit;
$topTorrents = $this->cache->get_value($cacheKey);

if ($topTorrents !== false) {
if ($topTorrents !== false) {
return $topTorrents;
}
if (!$this->cache->get_query_lock($cacheKey)) {
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

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

2 changes: 1 addition & 1 deletion db/migrations/20200920154242_user_torrent_remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class UserTorrentRemove extends AbstractMigration {
public function change() {
$this->table('user_torrent_remove', ['id' => false, 'primary_key' => ['torrent_id']])
$this->table('user_torrent_remove', ['id' => false, 'primary_key' => ['torrent_id']])
->addColumn('user_id', 'integer', ['limit' => '10', 'signed' => false])
->addColumn('torrent_id', 'integer', ['limit' => '10'])
->addColumn('removed', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
Expand Down
2 changes: 1 addition & 1 deletion db/seeds/ClientWhitelistSeeder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
use Phinx\Seed\AbstractSeed;

class ClientWhitelistSeeder extends AbstractSeed {
Expand Down
2 changes: 1 addition & 1 deletion db/seeds/EmailBlacklistSeeder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
use Phinx\Seed\AbstractSeed;

class EmailBlacklistSeeder extends AbstractSeed {
Expand Down
2 changes: 1 addition & 1 deletion design/privatefooter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$Y = SITE_LAUNCH_YEAR . "-$Y";
}
?>
<p>Site and design &copy; <?= $Y ?> <?=SITE_NAME?></p>
<p>Site and design &copy; <?= $Y ?> <?=SITE_NAME?> | <a href='https://github.com/OPSnet/Gazelle'>Project Gazelle</a></p>
<?php
if (!empty($LastActive)) { ?>
<p>
Expand Down
8 changes: 7 additions & 1 deletion design/publicfooter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
</div>
<div id="foot">
<span class="links">
<a href="https://github.com/OPSnet/gazelle">Project Gazelle</a>
<?php
$Y = date('Y');
if ($Y != SITE_LAUNCH_YEAR) {
$Y = SITE_LAUNCH_YEAR . "-$Y";
}
?>
Site and design &copy; <?= $Y ?> <?=SITE_NAME?> | <a href='https://github.com/OPSnet/Gazelle'>Project Gazelle</a>
</span>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "yarn build:scss -- --watch",
"lint:css": "stylelint \"sass/**/*.scss\" || exit 0",
"lint:css-checkstyle": "stylelint \"sass/**/*.scss\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js || exit 0",
"lint:php:internal": "find . -path './vendor' -prune -o -path ./node_modules -prune -o -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v \"No syntax errors detected\" )",
"lint:php:internal": "find . -path './vendor' -prune -o -path ./node_modules -prune -o -path './.docker' -prune -o -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v \"No syntax errors detected\" )",
"lint:php:phpcs": "vendor/bin/phpcs -p",
"lint:php": "yarn lint:php:internal && yarn lint:php:phpcs",
"lint:php:fix": "./.bin/phpcbf",
Expand Down
71 changes: 57 additions & 14 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,74 @@
<?xml version="1.0"?>
<ruleset name="Gazelle Standard" namespace="Gazelle\Standard">
<description>The standard for writing code in gazelle</description>
<arg name="extensions" value="php" />
<arg name="colors"/>
<arg value="s"/>
<arg name="extensions" value="php" />

<file>.</file>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/static/*</exclude-pattern>
<exclude-pattern>*/.docker/*</exclude-pattern>
<exclude-pattern>cache/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/static/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>

<!--
<rule ref="PSR2">
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
-->
<rule ref="Generic.PHP.DisallowShortOpenTag">
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
<rule ref="PSR12">
<exclude name="Generic.ControlStructures.InlineControlStructure" />
<exclude name="Generic.Files.LineLength" />
<exclude name="Generic.Formatting.DisallowMultipleStatements" />
<exclude name="Generic.Functions.FunctionCallArgumentSpacing" />
<exclude name="Generic.NamingConventions.UpperCaseConstantName" />
<exclude name="Generic.PHP.LowerCaseConstant" />
<exclude name="Generic.PHP.LowerCaseKeyword" />
<exclude name="Generic.PHP.LowerCaseType" />
<exclude name="Generic.WhiteSpace.ScopeIndent" />

<exclude name="PEAR.Functions.ValidDefaultValue" />
<exclude name="PSR1.Classes.ClassDeclaration" />
<exclude name="PSR1.Files.SideEffects" />
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR2.Classes.ClassDeclaration" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.ElseIfDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" />
<exclude name="PSR2.Files.ClosingTag" />
<exclude name="PSR2.Files.EndFileNewline" />
<exclude name="PSR2.Methods.FunctionCallSignature" />
<exclude name="PSR2.Methods.FunctionClosingBrace" />
<exclude name="PSR2.Methods.MethodDeclaration" />

<exclude name="PSR12.Classes.ClassInstantiation" />
<exclude name="PSR12.Classes.ClosingBrace" />
<exclude name="PSR12.ControlStructures.ControlStructureSpacing" />
<exclude name="PSR12.Files.FileHeader" />
<exclude name="PSR12.Files.ImportStatement" />
<exclude name="PSR12.Operators.OperatorSpacing" />
<exclude name="PSR12.Properties.ConstantVisibility" />
<exclude name="PSR12.Traits.UseDeclaration" />

<exclude name="Squiz.Classes.ValidClassName" />
<exclude name="Squiz.ControlStructures.ControlSignature" />
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration" />
<exclude name="Squiz.Functions.FunctionDeclaration" />
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration" />
<exclude name="Squiz.Scope.MethodScope" />
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing" />
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace" />
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent.TabsUsed" />
<rule ref="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed" />

<rule ref="Generic.Arrays.DisallowLongArraySyntax" />

<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array" value="db_string=>null,db_array=>null,each=>null" />
<property name="forbiddenFunctions" type="array" extend="true">
<element key="db_string" value="null"/>
<element key="db_array" value="null"/>
<element key="each" value="null"/>
<element key="eval" value="null"/>
<element key="extract" value="null"/>
</property>
</properties>
<type>warning</type>
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion sections/recovery/closed.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p>Recovery is currently closed.</p>

<p>Please join <tt>irc.orpheus.network</tt> (port 6669 or +7000 for SSL) for
<p>Please join <tt><?= BOT_SERVER ?></tt> (port 6669 or +7000 for SSL) for
more information (#recovery channel).</p>
2 changes: 1 addition & 1 deletion sections/user/invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
} else {
if (!check_perms('users_view_invites')) {
error(403);
}
}
$UserID = (int)$_GET['userid'];
if ($UserID < 1) {
error(404);
Expand Down
2 changes: 1 addition & 1 deletion sections/user/invitetree.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
} else {
if (!check_perms('users_view_invites')) {
error(403);
}
}
$userId = (int)$_GET['userid'];
}

Expand Down
2 changes: 1 addition & 1 deletion sections/user/take_invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
)
) {
error(403);
}
}

$Email = $_POST['email'];
$Username = $LoggedUser['Username'];
Expand Down

0 comments on commit 4717875

Please sign in to comment.