ekmungai/eloquent-ifrs

View on GitHub

Showing 29 of 66 total issues

Method sectionBalances has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        array $accountTypes,
        $startDate = null,
        $endDate = null,
        $fullBalance = true,
        Entity $entity = null
Severity: Minor
Found in src/Models/Account.php - About 35 mins to fix

    Function addVat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addVat(Vat $vat): bool
        {
            if (count($this->ledgers) > 0) {
                throw new PostedTransaction("add Vat to");
            }
    Severity: Minor
    Found in src/Models/LineItem.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function openingBalance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function openingBalance(int $year = null, int $currencyId = null): array
        {
            $entity = $this->entity;
    
            $balances = [$entity->currency_id => 0];
    Severity: Minor
    Found in src/Models/Account.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function openingBalances has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function openingBalances(int $year, Entity $entity = null)
        {
            if (is_null($entity)) {
                $entity = Auth::user()->entity;
            }
    Severity: Minor
    Found in src/Models/Account.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getVatAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getVatAttribute(): array
        {
            $vats = ['total' => 0];
            foreach ($this->getLineItems() as $lineItem) {
                foreach ($lineItem->vat as $type => $amount)
    Severity: Minor
    Found in src/Models/Transaction.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getSections has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getSections($startDate = null, $endDate = null, $fullbalance = true): array
        {
            foreach (Account::where('entity_id', '=', $this->entity->id)->get() as $account) {
                $balance = $account->closingBalance($this->endDate)[$this->entity->currency_id];
    
    
    Severity: Minor
    Found in src/Reports/TrialBalance.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function addLineItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addLineItem(LineItem $lineItem): bool
        {
            if (in_array($lineItem->account->account_type, config('ifrs.single_currency')) && $lineItem->account->currency_id != $this->currency_id) {
                throw new InvalidCurrency("Transaction", $lineItem->account);
            }
    Severity: Minor
    Found in src/Models/Transaction.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function up()
        {
    
            Schema::create(
                config('ifrs.table_prefix').'recycled_objects',

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save(array $options = []): bool
        {
            if (!is_null($this->rate)) {
                $this->rate = abs($this->rate);
            }
    Severity: Minor
    Found in src/Models/Vat.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language