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

mozilla / relman-auto-nag / #5181

26 Jul 2024 05:51PM UTC coverage: 21.583% (+0.002%) from 21.581%
#5181

push

coveralls-python

benjaminmah
Working second step

585 of 3503 branches covered (16.7%)

0 of 5 new or added lines in 1 file covered. (0.0%)

3 existing lines in 1 file now uncovered.

1933 of 8956 relevant lines covered (21.58%)

0.22 hits per line

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

0.0
/bugbot/rules/workflow/no_severity_nag.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

UNCOV
6
import numpy
×
7
from libmozdata import utils as lmdutils
×
8

9
from bugbot import utils
×
10
from bugbot.bzcleaner import BzCleaner
×
11
from bugbot.escalation import Escalation
×
12
from bugbot.nag_me import Nag
×
13
from bugbot.round_robin import RoundRobin
×
14

15

16
class NoSeverityNag(BzCleaner, Nag):
×
17
    def __init__(self, inactivity_days: int = 4):
×
18
        """Constructor
19

20
        Args:
21
            inactivity_days: number of days that a bug should be inactive before
22
                being considered.
23
        """
24
        super(NoSeverityNag, self).__init__()
×
NEW
25
        self.lookup_second = utils.get_config(self.name(), "weeks-lookup", 4)
×
26
        self.escalation = Escalation(
×
27
            self.people,
28
            data=utils.get_config(self.name(), "escalation"),
29
            skiplist=utils.get_config("workflow", "supervisor_skiplist", []),
30
        )
31
        self.round_robin = RoundRobin.get_instance()
×
32
        self.components_skiplist = utils.get_config("workflow", "components_skiplist")
×
33
        self.activity_date = str(
×
34
            numpy.busday_offset(lmdutils.get_date("today"), -inactivity_days)
35
        )
36

37
    def description(self):
×
38
        return "Bugs without a severity or statuses set"
×
39

40
    def nag_template(self):
×
41
        return self.template()
×
42

43
    def nag_preamble(self):
×
44
        return """<p>
×
45
  <ul>
46
    <li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/policies/triage-bugzilla.html#why-triage">Why triage?</a></li>
47
    <li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/policies/triage-bugzilla.html#what-do-you-triage">What do you triage?</a></li>
48
    <li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/guides/priority.html">Priority definitions</a></li>
49
    <li><a href="https://firefox-source-docs.mozilla.org/bug-mgmt/guides/severity.html">Severity definitions</a></li>
50
  </ul>
51
</p>"""
52

53
    def get_extra_for_template(self):
×
54
        return {"nweeks": self.lookup_second}
×
55

NEW
56
    def get_extra_for_needinfo_template(self):
×
NEW
57
        return self.get_extra_for_template()
×
58

59
    def get_extra_for_nag_template(self):
×
60
        return self.get_extra_for_template()
×
61

62
    def has_product_component(self):
×
63
        return True
×
64

65
    def ignore_meta(self):
×
66
        return True
×
67

68
    def columns(self):
×
69
        return ["product", "component", "id", "summary"]
×
70

71
    def handle_bug(self, bug, data):
×
72
        if (
×
73
            # check if the product::component is in the list
74
            utils.check_product_component(self.components_skiplist, bug)
75
            or utils.get_last_no_bot_comment_date(bug) > self.activity_date
76
        ):
77
            return None
×
78
        return bug
×
79

NEW
80
    def get_mail_to_auto_ni(self, bug):
×
NEW
81
        return None
×
82

83
    def set_people_to_nag(self, bug, buginfo):
×
84
        priority = "default"
×
85
        if not self.filter_bug(priority):
×
86
            return None
×
87

88
        owners = self.round_robin.get(bug, self.date, only_one=False, has_nick=False)
×
89
        real_owner = bug["triage_owner"]
×
90
        self.add_triage_owner(owners, real_owner=real_owner)
×
91
        if not self.add(owners, buginfo, priority=priority):
×
92
            self.add_no_manager(buginfo["id"])
×
93
        return bug
×
94

95
    def get_bz_params(self, date):
×
96
        fields = [
×
97
            "triage_owner",
98
            "flags",
99
            "comments.creator",
100
            "comments.creation_time",
101
        ]
102
        params = {
×
103
            "include_fields": fields,
104
            "keywords": "intermittent-failure",
105
            "keywords_type": "nowords",
106
            "email2": "wptsync@mozilla.bugs",
107
            "emailreporter2": "1",
108
            "emailtype2": "notequals",
109
            "resolution": "---",
110
            "f31": "bug_type",
111
            "o31": "equals",
112
            "v31": "defect",
113
            "f32": "flagtypes.name",
114
            "o32": "notsubstring",
115
            "v32": "needinfo?",
116
            "f33": "bug_severity",
117
            "o33": "anyexact",
118
            "v33": "--, n/a",
119
        }
120
        self.date = lmdutils.get_date_ymd(date)
×
121
        second = f"-{self.lookup_second * 7}d"
×
122

UNCOV
123
        params.update(
×
124
            {
125
                "j2": "OR",
126
                "f2": "OP",
127
                "j3": "AND",
128
                "f3": "OP",
129
                "f4": "product",
130
                "o4": "changedbefore",
131
                "v4": second,
132
                "n5": 1,
133
                "f5": "product",
134
                "o5": "changedafter",
135
                "v5": second,
136
                "n6": 1,
137
                "f6": "component",
138
                "o6": "changedafter",
139
                "v6": second,
140
                "f7": "CP",
141
                "j8": "AND",
142
                "f8": "OP",
143
                "f9": "component",
144
                "o9": "changedbefore",
145
                "v9": second,
146
                "n10": 1,
147
                "f10": "product",
148
                "o10": "changedafter",
149
                "v10": second,
150
                "n11": 1,
151
                "f11": "component",
152
                "o11": "changedafter",
153
                "v11": second,
154
                "f12": "CP",
155
                "j13": "AND",
156
                "f13": "OP",
157
                "f14": "creation_ts",
158
                "o14": "lessthaneq",
159
                "v14": second,
160
                "n15": 1,
161
                "f15": "product",
162
                "o15": "everchanged",
163
                "n16": 1,
164
                "f16": "component",
165
                "o16": "everchanged",
166
                "f17": "CP",
167
                "f18": "CP",
168
                "n20": 1,
169
                "j20": "OR",
170
                "f20": "OP",
171
                "f21": "bug_severity",
172
                "o21": "changedfrom",
173
                "v21": "critical",
174
                "f22": "bug_severity",
175
                "o22": "changedfrom",
176
                "v22": "major",
177
                "f23": "bug_severity",
178
                "o23": "changedfrom",
179
                "v23": "blocker",
180
                "f30": "CP",
181
            }
182
        )
183

UNCOV
184
        return params
×
185

186

187
if __name__ == "__main__":
×
188
    NoSeverityNag().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