mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Code clean up. [skip ci]
This commit is contained in:
@@ -1,11 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
command line:
|
||||||
|
|
||||||
|
phpmd app html ./_development/phpmd/phpmd.xml > ./public/result.html
|
||||||
|
|
||||||
|
-->
|
||||||
<ruleset name="pcsg-generated-ruleset"
|
<ruleset name="pcsg-generated-ruleset"
|
||||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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: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">
|
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||||
<description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/
|
<description>Bla bla</description>
|
||||||
</description>
|
|
||||||
|
<!-- Import the entire controversial code rule set, except one -->
|
||||||
|
<rule ref="rulesets/controversial.xml">
|
||||||
|
<exclude name="CamelCasePropertyName" />
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- clean code -->
|
||||||
|
<!-- <rule ref="rulesets/cleancode.xml" /> -->
|
||||||
|
<rule ref="rulesets/codesize.xml" />
|
||||||
|
<rule ref="rulesets/design.xml" />
|
||||||
|
<rule ref="rulesets/naming.xml" />
|
||||||
|
<rule ref="rulesets/unusedcode.xml" />
|
||||||
|
|
||||||
|
<!-- clean code static calling rule can be a little more lax: -->
|
||||||
|
<rule ref="rulesets/cleancode.xml">
|
||||||
|
<exclude name="StaticAccess" />
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- report level 5 for cyclomatic complexity -->
|
||||||
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
|
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="reportLevel" value="5"/>
|
<property name="reportLevel" value="5"/>
|
||||||
@@ -26,11 +52,4 @@
|
|||||||
<property name="minimum" value="5"/>
|
<property name="minimum" value="5"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<!-- Import rule set and exclude rules -->
|
|
||||||
<rule ref="rulesets/controversial.xml">
|
|
||||||
<exclude name="CamelCasePropertyName" />
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
|
|
||||||
</ruleset>
|
</ruleset>
|
@@ -61,7 +61,6 @@ class Kernel extends ConsoleKernel
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameters)
|
|
||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
|
@@ -10,6 +10,7 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Export;
|
namespace FireflyIII\Export;
|
||||||
|
|
||||||
|
use FireflyIII\Export\Entry\Entry;
|
||||||
use FireflyIII\Models\ExportJob;
|
use FireflyIII\Models\ExportJob;
|
||||||
use Log;
|
use Log;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
@@ -8,7 +8,7 @@ declare(strict_types = 1);
|
|||||||
* of the MIT license. See the LICENSE file for details.
|
* of the MIT license. See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FireflyIII\Export;
|
namespace FireflyIII\Export\Entry;
|
||||||
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
@@ -30,7 +30,7 @@ use FireflyIII\Models\TransactionJournal;
|
|||||||
*
|
*
|
||||||
* Class Entry
|
* Class Entry
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Export
|
* @package FireflyIII\Export\Entry
|
||||||
*/
|
*/
|
||||||
class Entry
|
class Entry
|
||||||
{
|
{
|
@@ -10,7 +10,7 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Export\Exporter;
|
namespace FireflyIII\Export\Exporter;
|
||||||
|
|
||||||
use FireflyIII\Export\Entry;
|
use FireflyIII\Export\Entry\Entry;
|
||||||
use FireflyIII\Models\ExportJob;
|
use FireflyIII\Models\ExportJob;
|
||||||
use League\Csv\Writer;
|
use League\Csv\Writer;
|
||||||
use SplFileObject;
|
use SplFileObject;
|
||||||
|
@@ -13,6 +13,7 @@ namespace FireflyIII\Export;
|
|||||||
use Auth;
|
use Auth;
|
||||||
use Config;
|
use Config;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Export\Entry\Entry;
|
||||||
use FireflyIII\Models\ExportJob;
|
use FireflyIII\Models\ExportJob;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Journal\JournalCollector;
|
use FireflyIII\Repositories\Journal\JournalCollector;
|
||||||
|
@@ -178,7 +178,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
|||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
*
|
||||||
*
|
*
|
||||||
* @return BalanceLine
|
* @return BalanceLine
|
||||||
*/
|
*/
|
||||||
|
@@ -232,7 +232,6 @@ class BudgetController extends Controller
|
|||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
* @param Collection $budgets
|
* @param Collection $budgets
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList) // need all parameters
|
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -49,8 +49,6 @@ class CategoryController extends Controller
|
|||||||
* @param SCRI $repository
|
* @param SCRI $repository
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function all(SCRI $repository, Category $category)
|
public function all(SCRI $repository, Category $category)
|
||||||
@@ -115,10 +113,6 @@ class CategoryController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList) // cant avoid it.
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
|
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // it's long but ok.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function earnedInPeriod(CRI $repository, string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
public function earnedInPeriod(CRI $repository, string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
@@ -307,8 +301,6 @@ class CategoryController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList) // need all parameters
|
|
||||||
* @SuppressWarnings(PHPMD.ExcessuveMethodLength) // need the length
|
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -88,7 +88,6 @@ class ReportController extends Controller
|
|||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList) // cant avoid it.
|
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -337,7 +337,6 @@ class CsvController extends Controller
|
|||||||
*
|
*
|
||||||
* STEP SIX
|
* STEP SIX
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) it's 6, but it's allright.
|
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
@@ -383,9 +382,6 @@ class CsvController extends Controller
|
|||||||
*
|
*
|
||||||
* STEP TWO
|
* STEP TWO
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // need the length.
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // its exactly 5, its ok
|
|
||||||
*
|
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
@@ -566,8 +566,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // need the complexity.
|
|
||||||
*
|
|
||||||
* @return Account
|
* @return Account
|
||||||
*/
|
*/
|
||||||
public function update(Account $account, array $data): Account
|
public function update(Account $account, array $data): Account
|
||||||
|
@@ -310,8 +310,6 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // it's a query.
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array
|
public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array
|
||||||
|
@@ -388,7 +388,6 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
|
||||||
*/
|
*/
|
||||||
protected function storeAccounts(TransactionType $type, array $data): array
|
protected function storeAccounts(TransactionType $type, array $data): array
|
||||||
{
|
{
|
||||||
|
@@ -36,8 +36,6 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
|
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function connect(TransactionJournal $journal, Tag $tag): bool
|
public function connect(TransactionJournal $journal, Tag $tag): bool
|
||||||
@@ -139,8 +137,6 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function connectAdvancePayment(TransactionJournal $journal, Tag $tag): bool
|
protected function connectAdvancePayment(TransactionJournal $journal, Tag $tag): bool
|
||||||
@@ -222,7 +218,6 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's complex but nothing can be done.
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@@ -237,7 +237,6 @@ class TestData
|
|||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
||||||
*/
|
*/
|
||||||
public static function createCar(User $user, Carbon $date): TransactionJournal
|
public static function createCar(User $user, Carbon $date): TransactionJournal
|
||||||
{
|
{
|
||||||
@@ -283,7 +282,6 @@ class TestData
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
||||||
*/
|
*/
|
||||||
public static function createDrinksAndOthers(User $user, Carbon $date): bool
|
public static function createDrinksAndOthers(User $user, Carbon $date): bool
|
||||||
{
|
{
|
||||||
@@ -350,7 +348,6 @@ class TestData
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
||||||
*/
|
*/
|
||||||
public static function createGroceries(User $user, Carbon $date): bool
|
public static function createGroceries(User $user, Carbon $date): bool
|
||||||
{
|
{
|
||||||
@@ -453,7 +450,6 @@ class TestData
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
||||||
*/
|
*/
|
||||||
public static function createPiggybanks(User $user): bool
|
public static function createPiggybanks(User $user): bool
|
||||||
{
|
{
|
||||||
|
@@ -38,7 +38,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param array $messages
|
* @param array $messages
|
||||||
* @param array $customAttributes
|
* @param array $customAttributes
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList) // inherited from Laravel.
|
|
||||||
*/
|
*/
|
||||||
public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])
|
public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = [])
|
||||||
{
|
{
|
||||||
@@ -50,7 +49,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param $value
|
* @param $value
|
||||||
* @param $parameters
|
* @param $parameters
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -92,7 +90,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param $attribute
|
* @param $attribute
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -214,7 +211,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param $value
|
* @param $value
|
||||||
* @param $parameters
|
* @param $parameters
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -279,7 +275,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param $value
|
* @param $value
|
||||||
* @param $parameters
|
* @param $parameters
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -310,7 +305,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param $value
|
* @param $value
|
||||||
* @param $parameters
|
* @param $parameters
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -342,9 +336,6 @@ class FireflyValidator extends Validator
|
|||||||
* @param $value
|
* @param $value
|
||||||
* @param $parameters
|
* @param $parameters
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) // cant remove it
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // its as simple as I can get it.
|
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validateUniquePiggyBankForUser($attribute, $value, $parameters): bool
|
public function validateUniquePiggyBankForUser($attribute, $value, $parameters): bool
|
||||||
|
Reference in New Issue
Block a user