• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #4349

pending completion
#4349

push

coveralls-python

sosa-e
Revert "Minimizing config file"

This reverts commit 614159597.

564 of 3081 branches covered (18.31%)

24 of 24 new or added lines in 24 files covered. (100.0%)

1804 of 7980 relevant lines covered (22.61%)

0.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/auto_nag/scripts/has_str_no_range.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
from libmozdata.bugzilla import Bugzilla
×
6

7
from auto_nag.bzcleaner import BzCleaner
×
8
from auto_nag.people import People
×
9

10

11
class HasSTRNoRange(BzCleaner):
×
12
    def __init__(self):
×
13
        super(HasSTRNoRange, self).__init__()
×
14
        self.people = People.get_instance()
×
15
        self.autofix_reporters = {}
×
16

17
    def description(self):
×
18
        return "Bugs with STR and no regression range"
×
19

20
    def get_autofix_change(self):
×
21
        return self.autofix_reporters
×
22

23
    def get_bugs_with_no_history(self, bugs):
×
24
        # The idea here is to only ask for regression window when only the bot
25
        # or the assignee contributed to the bug
26
        # bot = utils.get_config('common', 'bot_bz_mail')[0]
27

28
        def history_handler(bug, data):
×
29
            bugid = str(bug["id"])
×
30
            no_hist = True
×
31
            if bug["history"]:
×
32
                bug_data = data[bugid]
×
33
                who = {bug_data["creator"]}
×
34
                for h in bug["history"]:
×
35
                    if h["who"] not in who:
×
36
                        no_hist = False
×
37
                        break
×
38
            data[bugid]["no_history"] = no_hist
×
39

40
        bugids = list(bugs.keys())
×
41
        Bugzilla(
×
42
            bugids=bugids, historyhandler=history_handler, historydata=bugs
43
        ).get_data().wait()
44

45
        res = {}
×
46
        for bugid, bug in bugs.items():
×
47
            if bug["no_history"]:
×
48
                res[bugid] = bug
×
49
                if bug["regression"]:
×
50
                    self.autofix_reporters[bugid] = {
×
51
                        "comment": {
52
                            "body": ":{}, could you try to find a regression range using for example [mozregression](https://wiki.mozilla.org/Auto-tools/Projects/Mozregression)?".format(
53
                                bug["nick"]
54
                            )
55
                        }
56
                    }
57
                    if not bug["regwindow"]:
×
58
                        self.autofix_reporters[bugid]["keywords"] = {
×
59
                            "add": ["regressionwindow-wanted"]
60
                        }
61
                else:
62
                    self.autofix_reporters[bugid] = {
×
63
                        "comment": {
64
                            "body": ":{}, if you think that's a regression, could you try to find a regression range using for example [mozregression](https://wiki.mozilla.org/Auto-tools/Projects/Mozregression)?".format(
65
                                bug["nick"]
66
                            )
67
                        }
68
                    }
69
        return res
×
70

71
    def handle_bug(self, bug, data):
×
72
        bugid = str(bug["id"])
×
73
        creator = bug["creator"]
×
74
        nick = bug["creator_detail"]["nick"]
×
75
        reg = "regression" in bug["keywords"]
×
76
        win = "regressionwindow-wanted" in bug["keywords"]
×
77

78
        data[bugid] = {
×
79
            "creator": creator,
80
            "nick": nick,
81
            "regression": reg,
82
            "regwindow": win,
83
        }
84

85
        return bug
×
86

87
    def get_bz_params(self, date):
×
88
        start_date, end_date = self.get_dates(date)
×
89
        fields = ["creator", "keywords"]
×
90
        params = {
×
91
            "include_fields": fields,
92
            "resolution": "---",
93
            "f1": "creation_ts",
94
            "o1": "greaterthan",
95
            "v1": start_date,
96
            "f2": "regressed_by",
97
            "o2": "isempty",
98
            "n3": 1,
99
            "f3": "regressed_by",
100
            "o3": "changedafter",
101
            "v3": start_date,
102
            "f4": "cf_has_str",
103
            "o4": "equals",
104
            "v4": "yes",
105
            "n5": 1,
106
            "f5": "longdesc",
107
            "o5": "casesubstring",
108
            "v5": "could you try to find a regression range using for example [mozregression]",
109
            "n6": 1,
110
            "f6": "reporter",
111
            "o6": "regexp",
112
            "v6": r"^.*@softvision\.(ro|com)$",
113
        }
114

115
        return params
×
116

117
    def get_bugs(self, date="today", bug_ids=[]):
×
118
        bugs = super(HasSTRNoRange, self).get_bugs(date=date, bug_ids=bug_ids)
×
119
        bugs = self.get_bugs_with_no_history(bugs)
×
120

121
        return bugs
×
122

123

124
if __name__ == "__main__":
×
125
    HasSTRNoRange().run()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc