SEIAROTg/autobean

View on GitHub

Showing 46 of 46 total issues

Function generate_goldens has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def generate_goldens(path: str, suite: str, plugin: Plugin) -> None:
    _, testcases = load_test_suite(path, suite)
    if not testcases:
        print(f'No testcases found for {suite}.')
    for testcase in testcases:
Severity: Minor
Found in autobean/utils/plugin_test_utils.py - About 55 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 _check_links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _check_links(
        entries_by_file: dict[str, list[Directive]],
        links: Iterable[Link],
        logger: error_lib.ErrorLogger) -> None:
    all_endpoints = set()
Severity: Minor
Found in autobean/share/link_accounts.py - About 55 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Minor
Found in autobean/share/split_account.py - About 45 mins to fix

    Function process_open_close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_open_close(self, entries: list[Directive]) -> list[Directive]:
            if self._viewpoint != viewpoint_lib.EVERYONE:
                return entries
            results = []
            for entry in entries:
    Severity: Minor
    Found in autobean/share/split_account.py - About 45 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 add_policy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_policy(self, name: str, policy_def: PolicyDefinition) -> None:
            if policy_def.parent and policy_def.parent not in self._named_policies:
                raise error_lib.PluginException(
                    f'Reference to unknown share policy {policy_def.parent!r}')
            if policy_def.enforced and not policy_def.ownership:
    Severity: Minor
    Found in autobean/share/policy_lib.py - About 45 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

    Avoid deeply nested control flow statements.
    Open

                        if found:
                            duplicated = True
                            break
                        found = True
    Severity: Major
    Found in autobean/share/link_accounts.py - About 45 mins to fix

      Function plugin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def plugin(
              name: str,
              *,
              param_type: Any = None,
              custom_scope: Optional[str] = None,
      Severity: Minor
      Found in autobean/utils/plugin_lib.py - About 45 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

      Avoid deeply nested control flow statements.
      Open

                          if not complement_txn:
                              complement_txn = complement_entry
                          else:
                              complement_duplicated = True
                              break
      Severity: Major
      Found in autobean/share/link_accounts.py - About 45 mins to fix

        Function _extract_related_postings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _extract_related_postings(entries: list[Directive], accounts: set[str]) -> Iterable[PostingToCompare]:
            for entry in entries:
                if not isinstance(entry, Transaction):
                    continue
                for posting in entry.postings:
        Severity: Minor
        Found in autobean/xcheck/plugin.py - About 45 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 create_complement_posting has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create_complement_posting(
        Severity: Minor
        Found in autobean/share/split_account.py - About 45 mins to fix

          Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in autobean/share/split_account.py - About 35 mins to fix

            Function handle_link has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def handle_link(self, entry: Custom, path: str, account: plugin_lib.Account, complement_path: str, complement_account: plugin_lib.Account) -> Iterable[Directive]:
            Severity: Minor
            Found in autobean/share/include.py - About 35 mins to fix

              Function _check_balance has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _check_balance(
              Severity: Minor
              Found in autobean/share/split_account.py - About 35 mins to fix

                Function _transform_balance has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _transform_balance(
                Severity: Minor
                Found in autobean/truelayer/importer.py - About 35 mins to fix

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

                      def _get_split_postings(
                              self,
                              *,
                              used_subaccounts: dict[str, set[str]],
                      ) -> Iterator[Posting]:
                  Severity: Minor
                  Found in autobean/share/split_account.py - 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 from_transaction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def from_transaction(
                              cls,
                              transaction: Transaction,
                              policy_db: policy_lib.PolicyDatabase,
                      ) -> '_GroupedPostings':
                  Severity: Minor
                  Found in autobean/share/split_account.py - 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 process_balance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def process_balance(self, balance: Balance, error_logger: error_lib.ErrorLogger) -> list[Balance]:
                          if self._viewpoint == viewpoint_lib.NOBODY:
                              policy_lib.strip_share_meta(balance.meta)
                              return [balance]
                          tolerance = balance_lib.get_balance_tolerance(balance, self._options)
                  Severity: Minor
                  Found in autobean/share/split_account.py - 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 get_split_postings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_split_postings(self, commodity: str, multiplier: decimal.Decimal) -> Iterator[Posting]:
                          for real_account in realization.iter_children(self._real_root):
                              for position in real_account.balance:
                                  if position.units.currency != commodity or not position.units.number:
                                      continue
                  Severity: Minor
                  Found in autobean/stock_split/plugin.py - 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 handle_xcheck has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def handle_xcheck(self, entry: Custom, path: str, start: datetime.date, *accounts_tuple: plugin_lib.Account) -> Iterable[Directive]:
                          path = os.path.join(os.path.dirname(entry.meta['filename']), path)
                          accounts = set[str](accounts_tuple)
                          end = entry.date
                          stmt_entries, stmt_errors, _ = loader.load_file(path)
                  Severity: Minor
                  Found in autobean/xcheck/plugin.py - 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

                  Avoid too many return statements within this function.
                  Open

                      return None
                  Severity: Major
                  Found in autobean/utils/plugin_lib.py - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language