Skip to content

Firefly III: a personal finances manager

Move to level 5

James Cole0022201c4fa0
diff --git a/.ci/phpmd/phpmd.xml b/.ci/phpmd/phpmd.xml
index 38146de2ba..7f94b2dba2 100644
--- a/.ci/phpmd/phpmd.xml
+++ b/.ci/phpmd/phpmd.xml
@@ -19,59 +19,64 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
-<ruleset name="Firefly III ruleset"
+<ruleset name="pcsg-generated-ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
- <description>Firefly III ruleset</description>
+ <description>Firefly III ruleset.</description>
+ <!-- Import the entire controversial code rule set -->
+ <rule ref="rulesets/controversial.xml">
+ <exclude name="CamelCasePropertyName" />
+ </rule>
- <!--
-Commando vanuit firefly directory:
-phpmd database,app,tests html /gdrive-all/development/phpmd/phpmd.xml > public/report.html
- -->
+ <!-- clean code -->
+ <!-- <rule ref="rulesets/codesize.xml" /> -->
+ <rule ref="rulesets/design.xml" />
+ <rule ref="rulesets/unusedcode.xml" />
- <!-- Import the entire controversial code rule set -->
- <rule ref="rulesets/controversial.xml">
- <exclude name="CamelCasePropertyName" />
- </rule>
- <!-- clean code -->
- <rule ref="rulesets/design.xml/" />
- <rule ref="rulesets/naming.xml" />
- <rule ref="rulesets/unusedcode.xml" />
- <rule ref="rulesets/codesize.xml/CyclomaticComplexity">
- <properties>
+
+ <rule ref="rulesets/naming.xml/ShortMethodName">
+ <properties>
+ <!-- TODO we want to be at minimum 3. But we start low, and raise the bar slowly. -->
+ <property name="minimum" value="1"/>
+ </properties>
+ </rule>
+
+ <!-- code size -->
+ <rule ref="rulesets/codesize.xml/CyclomaticComplexity">
+ <properties>
<!-- TODO we want to be at report level 5. But we start high, and drop the bar slowly. -->
- <property name="reportLevel" value="500"/>
- </properties>
- </rule>
- <rule ref="rulesets/codesize.xml/NPathComplexity">
- <properties>
+ <property name="reportLevel" value="500"/>
+ </properties>
+ </rule>
+ <rule ref="rulesets/codesize.xml/NPathComplexity">
+ <properties>
<!-- TODO we want to be at a value of 128. But we start high, and drop the bar slowly. -->
- <property name="minimum" value="99000"/>
- </properties>
- </rule>
- <rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
- <properties>
+ <property name="minimum" value="100000"/>
+ </properties>
+ </rule>
+ <rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
+ <properties>
<!-- TODO we want to be at a value of 40. But we start high, and drop the bar slowly. -->
- <property name="minimum" value="400"/>
- </properties>
- </rule>
- <rule ref="rulesets/codesize.xml/ExcessiveParameterList">
- <properties>
+ <property name="minimum" value="400"/>
+ </properties>
+ </rule>
+ <rule ref="rulesets/codesize.xml/ExcessiveParameterList">
+ <properties>
<!-- TODO we want to be at a value of 4. But we start high, and drop the bar slowly. -->
- <property name="minimum" value="5"/>
- </properties>
- </rule>
+ <property name="minimum" value="5"/>
+ </properties>
+ </rule>
- <!-- include clean code manually -->
- <rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
- <rule ref="rulesets/cleancode.xml/ElseExpression" />
+ <!-- include clean code manually -->
+ <rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
+ <rule ref="rulesets/cleancode.xml/ElseExpression" />
<rule ref="rulesets/cleancode.xml/MissingImport" />
<rule ref="rulesets/cleancode.xml/UndefinedVariable" />
-
- <!-- no this one -->
- <!--<rule ref="rulesets/cleancode.xml/StaticAccess" />-->
+ <rule ref="rulesets/cleancode.xml/IfStatementAssignment" />
+ <rule ref="rulesets/cleancode.xml/DuplicatedArrayKey" />
+ <rule ref="rulesets/cleancode.xml/ErrorControlOperator" />
</ruleset>
diff --git a/.ci/phpstan.neon b/.ci/phpstan.neon
index d2eafa775a..28575d40f0 100644
--- a/.ci/phpstan.neon
+++ b/.ci/phpstan.neon
@@ -56,5 +56,5 @@ parameters:
# The level 8 is the highest level. original was 5
# TODO: slowly up the level and fix the issues found.
- level: 1
+ level: 5
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index f81a025b6e..9472e83238 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -88,8 +88,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Attachment extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
= [
diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php
index a767f5c581..6a1552019c 100644
--- a/app/Models/AvailableBudget.php
+++ b/app/Models/AvailableBudget.php
@@ -71,8 +71,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class AvailableBudget extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
= [
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 0f04c7ba4e..1011a7f553 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -106,8 +106,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Bill extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
= [
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index fee9d2d7aa..94d092cf25 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -87,8 +87,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Budget extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
= [
diff --git a/app/Models/Category.php b/app/Models/Category.php
index c0af609e5a..38744525af 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -76,8 +76,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class Category extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
= [
diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php
index a6998ed82e..132494fd7d 100644
--- a/app/Models/CurrencyExchangeRate.php
+++ b/app/Models/CurrencyExchangeRate.php
@@ -72,8 +72,8 @@ use Carbon\Carbon;
class CurrencyExchangeRate extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php
index 07fb06ea3a..f7da8db766 100644
--- a/app/Models/Recurrence.php
+++ b/app/Models/Recurrence.php
@@ -94,8 +94,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class Recurrence extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index 3e08296524..d7be370bd1 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -84,8 +84,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class Rule extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index c7f5c97d22..10e99e8119 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -75,8 +75,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class RuleGroup extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index fe69702d69..2f4c300e28 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -83,8 +83,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class Tag extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index d508dc7118..10333f8ac3 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -67,8 +67,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class TransactionGroup extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 3c6f5a8bf2..54c8851c06 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -127,8 +127,8 @@ class TransactionJournal extends Model
{
use HasFactory;
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php
index 343cb13bf5..a8e2e6ba9a 100644
--- a/app/Models/Webhook.php
+++ b/app/Models/Webhook.php
@@ -81,8 +81,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
class Webhook extends Model
{
use ReturnsIntegerIdTrait;
- use SoftDeletes;
use ReturnsIntegerUserIdTrait;
+ use SoftDeletes;
protected $casts
= [