def create_finding()

in dusty/reporters/azure_devops/connector.py [0:0]


    def create_finding(self, title, description=None, priority=None,
                       assignee=None, issue_hash=None, custom_fields=None, tags=None):
        if not custom_fields:
            custom_fields = dict()
        if tags:
            if '/fields/System.Tags' not in custom_fields:
                custom_fields['/fields/System.Tags'] = ""
            elif not custom_fields['/fields/System.Tags'].endswith(";"):
                custom_fields['/fields/System.Tags'] += ';'
            custom_fields['/fields/System.Tags'] += ";".join(tags)
        body = []
        fields_mapping = {
            "/fields/System.Title": title,
            "/fields/Microsoft.VSTS.Common.Priority": c.PRIORITY_MAPPING[priority],
            "/fields/System.Description": description,
            "/fields/System.AssignedTo": assignee,
            "/fields/System.AreaPath": self.team,
            "/fields/System.IterationPath": self.team
        }
        for key, value in {**fields_mapping, **custom_fields}.items():
            if value:
                _piece = {"op": "add", "path": key, "from": None, "value": value}
                body.append(_piece)
        if not self.search_for_issue(issue_hash):
            return post(self.url, auth=self.auth, json=body,
                        headers={'content-type': 'application/json-patch+json'}).json()
        else:
            return {}