diff --git a/jira_agile_metrics/calculators/cycletime.py b/jira_agile_metrics/calculators/cycletime.py index 94bbcb6..d816a07 100644 --- a/jira_agile_metrics/calculators/cycletime.py +++ b/jira_agile_metrics/calculators/cycletime.py @@ -116,12 +116,12 @@ def write(self): def calculate_cycle_times( query_manager, - cycle, # [{name:"", statuses:[""], type:""}] - attributes, # [{key:value}] - committed_column, # "" in `cycle` - done_column, # "" in `cycle` - queries, # [{jql:"", value:""}] - query_attribute=None, # "" + cycle, # [{name:"", statuses:[""], type:""}] + attributes, # [{key:value}] + committed_column, # "" in `cycle` + done_column, # "" in `cycle` + queries, # [{jql:"", value:""}] + query_attribute=None, # "" now=None, ): diff --git a/jira_agile_metrics/calculators/cycletime_test.py b/jira_agile_metrics/calculators/cycletime_test.py index 2e49056..36df9be 100644 --- a/jira_agile_metrics/calculators/cycletime_test.py +++ b/jira_agile_metrics/calculators/cycletime_test.py @@ -50,7 +50,8 @@ def jira(custom_fields): [("Flagged", None, "Impediment", "customfield_100")], ), Change( - "2018-01-03 01:00:00", [("Flagged", "Impediment", "", "customfield_100")] + "2018-01-03 01:00:00", + [("Flagged", "Impediment", "", "customfield_100")], ), # blocked 1 day in the backlog # (doesn't count towards blocked days) Change( @@ -64,13 +65,16 @@ def jira(custom_fields): ], ), Change( - "2018-01-04 10:01:01", [("Flagged", "", "Impediment", "customfield_100")] + "2018-01-04 10:01:01", + [("Flagged", "", "Impediment", "customfield_100")], ), Change( - "2018-01-05 08:01:01", [("Flagged", "Impediment", "", "customfield_100")] + "2018-01-05 08:01:01", + [("Flagged", "Impediment", "", "customfield_100")], ), # was blocked 1 day Change( - "2018-01-08 10:01:01", [("Flagged", "", "Impediment", "customfield_100")] + "2018-01-08 10:01:01", + [("Flagged", "", "Impediment", "customfield_100")], ), # stays blocked until today ], ), @@ -178,7 +182,14 @@ def jira(custom_fields): ), Change( "2018-01-07 01:01:01", - [("Flagged", None, "Awaiting input", "customfield_100")], + [ + ( + "Flagged", + None, + "Awaiting input", + "customfield_100", + ) + ], ), Change( "2018-01-10 10:01:01", diff --git a/jira_agile_metrics/calculators/progressreport_test.py b/jira_agile_metrics/calculators/progressreport_test.py index df04f9e..49e8be6 100644 --- a/jira_agile_metrics/calculators/progressreport_test.py +++ b/jira_agile_metrics/calculators/progressreport_test.py @@ -280,7 +280,14 @@ def simple_ql(i, jql): changes=[ Change( "2018-01-02 10:01:01", - [("Flagged", None, "Impediment", "customfield_100")], + [ + ( + "Flagged", + None, + "Impediment", + "customfield_100", + ) + ], ), Change( "2018-01-03 01:00:00", @@ -343,7 +350,14 @@ def simple_ql(i, jql): ), Change( "2018-01-04 10:01:01", - [("Flagged", None, "Impediment", "customfield_100")], + [ + ( + "Flagged", + None, + "Impediment", + "customfield_100", + ) + ], ), # should clear two days later when issue resolved Change( "2018-01-05 01:01:01", @@ -409,11 +423,25 @@ def simple_ql(i, jql): ), Change( "2018-01-07 01:01:01", - [("Flagged", None, "Awaiting input", "customfield_100")], + [ + ( + "Flagged", + None, + "Awaiting input", + "customfield_100", + ) + ], ), Change( "2018-01-10 10:01:01", - [("Flagged", "Awaiting input", "", "customfield_100")], + [ + ( + "Flagged", + "Awaiting input", + "", + "customfield_100", + ) + ], ), # blocked 3 days ], ), diff --git a/jira_agile_metrics/conftest.py b/jira_agile_metrics/conftest.py index dc06a6f..beb5bec 100644 --- a/jira_agile_metrics/conftest.py +++ b/jira_agile_metrics/conftest.py @@ -31,6 +31,7 @@ def __init__(self, fields): class FauxChangeItem(object): """An item in a changelog change""" + def __init__(self, field, fromString, toString, fieldId=None): self.field = field self.fieldId = fieldId if fieldId is not None else field diff --git a/jira_agile_metrics/querymanager.py b/jira_agile_metrics/querymanager.py index 61c455d..458b943 100644 --- a/jira_agile_metrics/querymanager.py +++ b/jira_agile_metrics/querymanager.py @@ -8,12 +8,14 @@ logger = logging.getLogger(__name__) + def _field_id_from_changelog_item(history_item): - if hasattr(history_item, 'fieldId'): + if hasattr(history_item, "fieldId"): return history_item.fieldId else: return history_item.field + class IssueSnapshot(object): """A snapshot of the key fields of an issue at a point in its change history""" @@ -188,7 +190,7 @@ def iter_changes(self, issue, fields): field_id = self.field_name_to_id(field) field_ids_to_names[field_id] = field - + initial_value = self.resolve_field_value(issue, field_id) try: initial_value = next( @@ -227,7 +229,9 @@ def iter_changes(self, issue, fields): for item in change.items: if _field_id_from_changelog_item(item) in field_ids_to_names: yield IssueSnapshot( - change=field_ids_to_names[_field_id_from_changelog_item(item)], + change=field_ids_to_names[ + _field_id_from_changelog_item(item) + ], key=issue.key, date=change_date, from_string=item.fromString, diff --git a/pyproject.toml b/pyproject.toml index 920b075..5715654 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.black] -line-length = 179 +line-length = 79 include = '\.pyi?$' exclude = ''' /(