mercury_banking 0.5.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env_test +1 -0
- data/.gitignore +24 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +90 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +140 -0
- data/LICENSE +21 -0
- data/LINTING_REPORT.md +118 -0
- data/README.md +244 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/mercury +17 -0
- data/bin/setup +8 -0
- data/lib/mercury_banking/api.rb +184 -0
- data/lib/mercury_banking/cli/accounts.rb +61 -0
- data/lib/mercury_banking/cli/base.rb +68 -0
- data/lib/mercury_banking/cli/financials.rb +302 -0
- data/lib/mercury_banking/cli/reconciliation.rb +406 -0
- data/lib/mercury_banking/cli/reports.rb +265 -0
- data/lib/mercury_banking/cli/transactions.rb +222 -0
- data/lib/mercury_banking/cli.rb +209 -0
- data/lib/mercury_banking/formatters/export_formatter.rb +306 -0
- data/lib/mercury_banking/formatters/table_formatter.rb +133 -0
- data/lib/mercury_banking/multi.rb +135 -0
- data/lib/mercury_banking/recipient.rb +29 -0
- data/lib/mercury_banking/reconciliation.rb +139 -0
- data/lib/mercury_banking/reports/balance_sheet.rb +586 -0
- data/lib/mercury_banking/reports/reconciliation.rb +307 -0
- data/lib/mercury_banking/utils/command_utils.rb +18 -0
- data/lib/mercury_banking/version.rb +3 -0
- data/lib/mercury_banking.rb +19 -0
- data/mercury_banking.gemspec +37 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 30960a19dc6f93e69961414fa8eaa97d39821b5143c1c68f745d95f73f71fe38
|
4
|
+
data.tar.gz: 67b8f43f1035cd73bb266a82c306844781973c0cb51dcd2a2c8b9ef02c764c71
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 947d1a012d252ad361cd629216cf4376a7580b947975f0f776b1f58bce82eb7f7fb6eaa0c737a194e3eff552b6e0a864c0aa2d8a5d6a2dd0e9ea16ffe09613b5
|
7
|
+
data.tar.gz: 40e68e11df82741dfa756e43a8d58dc335a03b9582489dec803a40785cda0abc1a4b03ff440bc5a3bb49db35c7f66d0e8c8f19b5546ee0bb86adcc4073ab7563
|
data/.env_test
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
API_KEY=YOUR_API_KEY
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
# rspec failure tracking
|
11
|
+
.rspec_status
|
12
|
+
|
13
|
+
# mac settings
|
14
|
+
.DS_Store
|
15
|
+
|
16
|
+
# #transfer log files
|
17
|
+
log
|
18
|
+
.env
|
19
|
+
log.csv
|
20
|
+
.mercury-api-keys
|
21
|
+
.mercury-configtags
|
22
|
+
*.gem
|
23
|
+
tags
|
24
|
+
*.ledger
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
# Disable the rule that changes $? to $CHILD_STATUS
|
6
|
+
Style/GlobalVars:
|
7
|
+
Enabled: true
|
8
|
+
Exclude:
|
9
|
+
- '**/*.rb' # Exclude all Ruby files
|
10
|
+
|
11
|
+
# Or alternatively, you can specifically allow $? while keeping other global var checks
|
12
|
+
Style/SpecialGlobalVars:
|
13
|
+
Enabled: false # This disables the rule that changes $? to $CHILD_STATUS
|
14
|
+
|
15
|
+
# Allow slightly longer methods since we've already done significant refactoring
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 25 # Default is 10, we're increasing it to 25
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.5.34] - 2025-03-10
|
4
|
+
### Fixed
|
5
|
+
- Added missing `thor` gem dependency to fix LoadError when running CLI commands
|
6
|
+
|
7
|
+
## [0.5.33] - 2025-03-10
|
8
|
+
### Added
|
9
|
+
- Added `--verbose` option to `transactions_download` command to control output verbosity
|
10
|
+
- Updated all export methods to conditionally display debug information based on the verbose flag
|
11
|
+
- Default behavior is now less verbose, showing only essential output
|
12
|
+
|
13
|
+
## [0.5.32] - 2025-03-09
|
14
|
+
### Changed
|
15
|
+
- Updated transaction filenames to use full account numbers (e.g., `2022-12-Mercury-ACCOUNT.ledger`) instead of sanitized account names
|
16
|
+
|
17
|
+
## [0.5.31] - 2025-03-09
|
18
|
+
### Fixed
|
19
|
+
- Fixed "wrong number of arguments" error in transactions_download command
|
20
|
+
- Updated transactions methods to correctly handle start_date and end_date parameters
|
21
|
+
- Added tests to ensure get_transactions method only accepts account_id and start_date parameters
|
22
|
+
|
23
|
+
## [0.5.30] - 2025-03-09
|
24
|
+
### Changed
|
25
|
+
- Removed duplicate export methods in the transactions module
|
26
|
+
- Refactored transactions module to use the ExportFormatter module for all export functionality
|
27
|
+
- Improved code organization and reduced duplication
|
28
|
+
- Fixed warnings about helper methods being exposed as commands by wrapping them in a no_commands block
|
29
|
+
|
30
|
+
## [0.5.29] - 2025-03-09
|
31
|
+
### Fixed
|
32
|
+
- Enhanced transaction description sanitization to properly handle newlines and semicolons
|
33
|
+
- Improved ledger file format compatibility by escaping special characters according to ledger format rules
|
34
|
+
- Updated all export formats (ledger, beancount, hledger, CSV) to properly handle problematic characters in descriptions
|
35
|
+
- Simplified sanitization code to focus only on characters that cause issues with the ledger format
|
36
|
+
|
37
|
+
## [0.5.28] - 2024-03-08
|
38
|
+
### Fixed
|
39
|
+
- Fixed error in `financials balancesheet` command caused by invalid date/time format in ledger files
|
40
|
+
- Added validation and sanitization for transaction descriptions to prevent ledger parsing errors
|
41
|
+
- Improved error handling when processing transactions with problematic data
|
42
|
+
|
43
|
+
## [0.5.27] - 2024-03-08
|
44
|
+
### Fixed
|
45
|
+
- Fixed ledger file balance issues by explicitly including amounts for both sides of transactions
|
46
|
+
- Ensured proper negative amounts for Income entries in ledger files
|
47
|
+
- Improved ledger file compatibility with strict ledger validation
|
48
|
+
|
49
|
+
## [0.5.26] - 2024-03-08
|
50
|
+
### Added
|
51
|
+
- Added full timestamps as metadata to ledger transactions for better chronological ordering
|
52
|
+
- Improved transaction sorting to ensure transactions are exported in strict chronological order
|
53
|
+
- Fixed reconciliation issues when multiple transactions occur on the same day
|
54
|
+
|
55
|
+
## [0.5.25] - 2024-03-08
|
56
|
+
### Fixed
|
57
|
+
- Fixed error with `command_exists?` method not being defined when running balance sheet commands
|
58
|
+
- Added utility method to check for external command availability
|
59
|
+
|
60
|
+
## [0.5.24] - 2024-03-08
|
61
|
+
### Added
|
62
|
+
- Added ledger format support to the `transactions_download` command
|
63
|
+
- Included transaction IDs in ledger files for better traceability and future reference
|
64
|
+
|
65
|
+
## [0.5.23] - 2024-03-08
|
66
|
+
### Removed
|
67
|
+
- Removed all reconciliation-related features (`reconcile`, `reconcile_all`, `reconciliation_status`, `unreconcile`, and `export_reconciled` commands)
|
68
|
+
- Simplified the CLI by focusing on core financial reporting functionality
|
69
|
+
|
70
|
+
## [0.5.22] - 2024-03-08
|
71
|
+
### Fixed
|
72
|
+
- Fixed missing require statements in the financials.rb file
|
73
|
+
|
74
|
+
## [0.5.21] - 2024-03-08
|
75
|
+
### Fixed
|
76
|
+
- Fixed the `financials balancesheet` command by including necessary modules in the FinancialsCommand class
|
77
|
+
- Moved the balance_sheet method inside a no_commands block to prevent it from being exposed as a command
|
78
|
+
|
79
|
+
## [0.5.20] - 2024-03-08
|
80
|
+
### Changed
|
81
|
+
- Relocated the `balance_sheet` method from the Reports module to the Financials module for better code organization
|
82
|
+
- Improved architecture by placing the method in the module where it's actually used
|
83
|
+
|
84
|
+
## [0.5.19] - 2024-03-08
|
85
|
+
### Fixed
|
86
|
+
- Fixed warning about the balance_sheet method by moving it inside a no_commands block
|
87
|
+
|
88
|
+
## [0.5.18] - 2024-03-08
|
89
|
+
### Removed
|
90
|
+
- Removed redundant `mercury balance_sheet` command as this functionality is already available through `
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at ishidayusuke01@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
ruby '3.3.5'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in mercury_banking.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'dotenv'
|
9
|
+
gem 'activesupport'
|
10
|
+
gem 'terminal-table'
|
11
|
+
gem 'pry'
|
12
|
+
gem 'webmock'
|
13
|
+
gem 'thor'
|
14
|
+
gem 'symmetric-encryption'
|
15
|
+
gem 'lockbox'
|
16
|
+
gem 'rake', '~> 13.0'
|
17
|
+
gem 'rspec', '~> 3.0'
|
18
|
+
gem 'rubocop', require: false
|
19
|
+
gem 'rubocop-performance', require: false
|
20
|
+
gem 'rubocop-rspec', require: false
|
21
|
+
gem 'rubocop-rake', require: false
|
22
|
+
gem 'dead_end', require: false # Helps find syntax errors
|
23
|
+
gem 'debride', require: false # Finds unused code
|
24
|
+
gem 'csv'
|
25
|
+
gem 'base64'
|
26
|
+
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mercury_banking (0.5.34)
|
5
|
+
activesupport (~> 7.0.0)
|
6
|
+
symmetric-encryption (~> 4.6.0)
|
7
|
+
terminal-table (~> 1.8.0)
|
8
|
+
thor (~> 1.2.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activesupport (7.0.8.7)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
addressable (2.8.7)
|
19
|
+
public_suffix (>= 2.0.2, < 7.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
base64 (0.2.0)
|
22
|
+
bigdecimal (3.1.9)
|
23
|
+
coderay (1.1.3)
|
24
|
+
coercible (1.0.0)
|
25
|
+
descendants_tracker (~> 0.0.1)
|
26
|
+
concurrent-ruby (1.3.5)
|
27
|
+
crack (1.0.0)
|
28
|
+
bigdecimal
|
29
|
+
rexml
|
30
|
+
csv (3.3.2)
|
31
|
+
dead_end (4.0.0)
|
32
|
+
debride (1.12.0)
|
33
|
+
path_expander (~> 1.0)
|
34
|
+
ruby_parser (~> 3.20)
|
35
|
+
sexp_processor (~> 4.17)
|
36
|
+
descendants_tracker (0.0.4)
|
37
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
38
|
+
diff-lcs (1.6.0)
|
39
|
+
dotenv (3.1.7)
|
40
|
+
hashdiff (1.1.2)
|
41
|
+
i18n (1.14.7)
|
42
|
+
concurrent-ruby (~> 1.0)
|
43
|
+
json (2.10.1)
|
44
|
+
lockbox (2.0.1)
|
45
|
+
method_source (1.1.0)
|
46
|
+
minitest (5.25.4)
|
47
|
+
parallel (1.26.3)
|
48
|
+
parser (3.3.7.1)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
racc
|
51
|
+
path_expander (1.1.3)
|
52
|
+
pry (0.15.2)
|
53
|
+
coderay (~> 1.1)
|
54
|
+
method_source (~> 1.0)
|
55
|
+
public_suffix (6.0.1)
|
56
|
+
racc (1.8.1)
|
57
|
+
rainbow (3.1.1)
|
58
|
+
rake (13.2.1)
|
59
|
+
regexp_parser (2.10.0)
|
60
|
+
rexml (3.4.1)
|
61
|
+
rspec (3.13.0)
|
62
|
+
rspec-core (~> 3.13.0)
|
63
|
+
rspec-expectations (~> 3.13.0)
|
64
|
+
rspec-mocks (~> 3.13.0)
|
65
|
+
rspec-core (3.13.3)
|
66
|
+
rspec-support (~> 3.13.0)
|
67
|
+
rspec-expectations (3.13.3)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.13.0)
|
70
|
+
rspec-mocks (3.13.2)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.13.0)
|
73
|
+
rspec-support (3.13.2)
|
74
|
+
rubocop (1.42.0)
|
75
|
+
json (~> 2.3)
|
76
|
+
parallel (~> 1.10)
|
77
|
+
parser (>= 3.1.2.1)
|
78
|
+
rainbow (>= 2.2.2, < 4.0)
|
79
|
+
regexp_parser (>= 1.8, < 3.0)
|
80
|
+
rexml (>= 3.2.5, < 4.0)
|
81
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
82
|
+
ruby-progressbar (~> 1.7)
|
83
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
84
|
+
rubocop-ast (1.38.1)
|
85
|
+
parser (>= 3.3.1.0)
|
86
|
+
rubocop-performance (1.19.1)
|
87
|
+
rubocop (>= 1.7.0, < 2.0)
|
88
|
+
rubocop-ast (>= 0.4.0)
|
89
|
+
rubocop-rake (0.6.0)
|
90
|
+
rubocop (~> 1.0)
|
91
|
+
rubocop-rspec (3.0.0)
|
92
|
+
rubocop (~> 1.40)
|
93
|
+
ruby-progressbar (1.13.0)
|
94
|
+
ruby_parser (3.21.1)
|
95
|
+
racc (~> 1.5)
|
96
|
+
sexp_processor (~> 4.16)
|
97
|
+
sexp_processor (4.17.3)
|
98
|
+
symmetric-encryption (4.6.0)
|
99
|
+
coercible (~> 1.0)
|
100
|
+
terminal-table (1.8.0)
|
101
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
102
|
+
thor (1.2.2)
|
103
|
+
thread_safe (0.3.6)
|
104
|
+
tzinfo (2.0.6)
|
105
|
+
concurrent-ruby (~> 1.0)
|
106
|
+
unicode-display_width (1.8.0)
|
107
|
+
webmock (3.25.0)
|
108
|
+
addressable (>= 2.8.0)
|
109
|
+
crack (>= 0.3.2)
|
110
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
ruby
|
114
|
+
|
115
|
+
DEPENDENCIES
|
116
|
+
activesupport
|
117
|
+
base64
|
118
|
+
csv
|
119
|
+
dead_end
|
120
|
+
debride
|
121
|
+
dotenv
|
122
|
+
lockbox
|
123
|
+
mercury_banking!
|
124
|
+
pry
|
125
|
+
rake (~> 13.0)
|
126
|
+
rspec (~> 3.0)
|
127
|
+
rubocop
|
128
|
+
rubocop-performance
|
129
|
+
rubocop-rake
|
130
|
+
rubocop-rspec
|
131
|
+
symmetric-encryption
|
132
|
+
terminal-table
|
133
|
+
thor
|
134
|
+
webmock
|
135
|
+
|
136
|
+
RUBY VERSION
|
137
|
+
ruby 3.3.5p100
|
138
|
+
|
139
|
+
BUNDLED WITH
|
140
|
+
2.6.5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 XenonIO
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LINTING_REPORT.md
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
# Mercury Banking CLI Linting Report
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
This report summarizes the findings from running RuboCop and debride on the Mercury Banking CLI codebase. It identifies potential bugs, code quality issues, and unused code that could be removed.
|
5
|
+
|
6
|
+
## RuboCop Findings
|
7
|
+
After disabling style-related cops to focus on more important issues, RuboCop identified 673 offenses. The main issues include:
|
8
|
+
|
9
|
+
1. **Code Quality Issues**:
|
10
|
+
- Methods with high ABC complexity (Assignment, Branch, Condition)
|
11
|
+
- Methods with high cyclomatic complexity
|
12
|
+
- Methods that are too long
|
13
|
+
- Modules that are too long
|
14
|
+
|
15
|
+
2. **Potential Bugs**:
|
16
|
+
- Useless variable assignments
|
17
|
+
- Redundant conditions
|
18
|
+
- Rescuing without specifying error classes
|
19
|
+
- Non-local exits from iterators
|
20
|
+
- Ambiguous operator precedence
|
21
|
+
|
22
|
+
3. **Performance Issues**:
|
23
|
+
- Inefficient string operations
|
24
|
+
- Inefficient array operations
|
25
|
+
- Non-atomic file operations
|
26
|
+
|
27
|
+
## Dead Code Analysis
|
28
|
+
The debride tool identified 1,252 lines of potentially unused code. The main areas include:
|
29
|
+
|
30
|
+
### Unused Methods
|
31
|
+
|
32
|
+
1. **API Methods**:
|
33
|
+
- `add_recipient`
|
34
|
+
- `get_recipient`
|
35
|
+
- `update_recipient`
|
36
|
+
|
37
|
+
2. **CLI Commands**:
|
38
|
+
- `log_transfer`
|
39
|
+
- `balancesheet`
|
40
|
+
- `incomestatement`
|
41
|
+
- `banner`
|
42
|
+
- `exit_on_failure?`
|
43
|
+
- `help`
|
44
|
+
- `set_key`
|
45
|
+
- `transactions`
|
46
|
+
- `version`
|
47
|
+
|
48
|
+
3. **Reconciliation Methods**:
|
49
|
+
- All methods in `MercuryBanking::CLI::Reconciliation`
|
50
|
+
- `export_reconciled`
|
51
|
+
- `reconcile`
|
52
|
+
- `reconcile_all`
|
53
|
+
- `reconciliation_status`
|
54
|
+
- `unreconcile`
|
55
|
+
|
56
|
+
4. **Report Methods**:
|
57
|
+
- `statement`
|
58
|
+
- `transactions`
|
59
|
+
- `transactions_download`
|
60
|
+
|
61
|
+
5. **Formatter Methods**:
|
62
|
+
- `display_recipients_table`
|
63
|
+
- `display_transaction_details`
|
64
|
+
- `display_transactions_table`
|
65
|
+
|
66
|
+
6. **Multi Methods**:
|
67
|
+
- `balances`
|
68
|
+
|
69
|
+
7. **Recipient Methods**:
|
70
|
+
- `name`
|
71
|
+
- `name=`
|
72
|
+
|
73
|
+
8. **Balance Sheet Methods**:
|
74
|
+
- `export_transactions_to_beancount`
|
75
|
+
- `export_transactions_to_ledger`
|
76
|
+
|
77
|
+
9. **Reconciliation Report Methods**:
|
78
|
+
- `generate_reconciliation_report`
|
79
|
+
|
80
|
+
## Recommendations
|
81
|
+
|
82
|
+
### High Priority Issues
|
83
|
+
|
84
|
+
1. **Fix Potential Bugs**:
|
85
|
+
- Address useless variable assignments that might indicate logic errors
|
86
|
+
- Fix rescuing without specifying error classes
|
87
|
+
- Fix ambiguous operator precedence issues
|
88
|
+
- Address non-atomic file operations
|
89
|
+
|
90
|
+
2. **Remove Unused Reconciliation Module**:
|
91
|
+
The entire `MercuryBanking::CLI::Reconciliation` module appears to be unused and could be removed.
|
92
|
+
|
93
|
+
3. **Refactor Complex Methods**:
|
94
|
+
Several methods have high complexity scores and should be refactored:
|
95
|
+
- `MercuryBanking::CLI::Financials::FinancialsCommand#balance_sheet` (ABC: 150.6)
|
96
|
+
- `MercuryBanking::CLI::Reconciliation#reconcile_all` (ABC: 142.3)
|
97
|
+
- `MercuryBanking::Reports::Reconciliation#generate_reconciliation_report` (ABC: 129.3)
|
98
|
+
- `MercuryBanking::CLI::Reports#statement` (ABC: 100.8)
|
99
|
+
|
100
|
+
### Further Investigation
|
101
|
+
1. **API Methods**:
|
102
|
+
Verify if the recipient-related API methods are used in any part of the application or tests.
|
103
|
+
|
104
|
+
2. **Formatter Methods**:
|
105
|
+
Check if the table formatter methods are used in any part of the application.
|
106
|
+
|
107
|
+
3. **Balance Sheet Methods**:
|
108
|
+
Verify if the export methods are used in any part of the application.
|
109
|
+
|
110
|
+
### Code Cleanup Strategy
|
111
|
+
1. Start by addressing potential bugs that could cause runtime issues.
|
112
|
+
2. Remove the clearly unused modules and methods.
|
113
|
+
3. Refactor complex methods to improve maintainability.
|
114
|
+
4. Run the test suite after each change to ensure functionality is preserved.
|
115
|
+
5. Update documentation to reflect the changes made.
|
116
|
+
|
117
|
+
## Conclusion
|
118
|
+
The codebase has a significant amount of potentially unused code that could be removed to improve maintainability. Additionally, there are several complex methods that would benefit from refactoring. By addressing these issues, the Mercury Banking CLI codebase will become more maintainable, with reduced complexity and improved code quality.
|