-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aggregate transactions per command line parameter #253
Conversation
@@ -51,6 +51,28 @@ def config_file(self, value): | |||
"""config file property setter""" | |||
self._config_file = value | |||
|
|||
def __format_statement(self, statement): | |||
""" | |||
Formats a given statement into a dictionary containing the relevant data for Portfolio Performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line too long (107 > 79 characters)
src/p2p_account_statement_parser.py
Outdated
PP_FIELDNAMES[4]: sttmnt.get_note(), | ||
} | ||
self.output_list.append(formatted_account_entry) | ||
formatted_account_entry = self.__format_statement(statement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line too long (80 > 79 characters)
Code Climate has analyzed commit 12b5172 and detected 2 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 98.8% (-0.7% change). View more on Code Climate. |
Added test file for mintos covering several months
""" | ||
with open(self.config_file, "r", encoding="utf-8") as ymlconfig: | ||
yaml = YAML(typ="safe") | ||
config = yaml.load(ymlconfig) | ||
self.config = Config(config) | ||
|
||
def parse_account_statement(self): | ||
def parse_account_statement(self, aggregate="daily"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cyclomatic complexity is too high in method parse_account_statement. (6)
""" | ||
with open(self.config_file, "r", encoding="utf-8") as ymlconfig: | ||
yaml = YAML(typ="safe") | ||
config = yaml.load(ymlconfig) | ||
self.config = Config(config) | ||
|
||
def parse_account_statement(self): | ||
def parse_account_statement(self, aggregate="daily"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed.
src/p2p_account_statement_parser.py
Outdated
self.output_list.append(formatted_account_entry) | ||
formatted_account_entry = self.__format_statement(statement) | ||
if formatted_account_entry: | ||
if aggregate == "daily": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid deeply nested control flow statements.
PP_FIELDNAMES[1] | ||
] | ||
else: | ||
self.aggregation_data[entry_date][entry_type] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 2 locations. Consider refactoring.
""" | ||
with open(self.config_file, "r", encoding="utf-8") as ymlconfig: | ||
yaml = YAML(typ="safe") | ||
config = yaml.load(ymlconfig) | ||
self.config = Config(config) | ||
|
||
def parse_account_statement(self): | ||
def parse_account_statement(self, aggregate="daily"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cyclomatic complexity is too high in method parse_account_statement. (12)
if not category: | ||
return | ||
|
||
formatted_account_entry = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 2 locations. Consider refactoring.
@@ -43,13 +51,15 @@ def platform_factory(operator_name="mintos"): | |||
return None | |||
|
|||
|
|||
def main(infile, p2p_operator_name="mintos"): | |||
def main(infile, p2p_operator_name="mintos", aggregate="daily"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
self.config = Config(config) | ||
|
||
def parse_account_statement(self): | ||
def parse_account_statement(self, aggregate="daily"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.
self.config = Config(config) | ||
|
||
def parse_account_statement(self): | ||
def parse_account_statement(self, aggregate="daily"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cyclomatic complexity is too high in method parse_account_statement. (9)
95c1398
to
3dc51d2
Compare
f136094
to
1a5e0c7
Compare
1a5e0c7
to
12b5172
Compare
This PR should cover the idea proposed in #252 by adding a command line parameter that can be used to aggregate account statements by month.