• 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/severity_underestimated.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 auto_nag import utils
×
6
from auto_nag.bzcleaner import BzCleaner
×
7

8

9
class UnderestimatedSeverity(BzCleaner):
×
10
    def __init__(self):
×
11
        super(UnderestimatedSeverity, self).__init__()
×
12
        self.nweeks = self.get_config("weeks_lookup")
×
13
        self.ndups = self.get_config("number_dups")
×
14
        self.votes = self.get_config("number_votes")
×
15
        self.cc = self.get_config("number_cc")
×
16
        self.see_also = self.get_config("number_see_also")
×
17

18
        self.extra_ni = {}
×
19

20
    def description(self):
×
21
        return "Bugs with underestimated severity for the last {} weeks".format(
×
22
            self.nweeks
23
        )
24

25
    def has_needinfo(self):
×
26
        return True
×
27

28
    def get_mail_to_auto_ni(self, bug):
×
29
        for field in ["assigned_to", "triage_owner"]:
×
30
            person = bug.get(field, "")
×
31
            if person and not utils.is_no_assignee(person):
×
32
                return {"mail": person, "nickname": bug[f"{field}_detail"]["nick"]}
×
33

34
        return None
×
35

36
    def get_extra_for_needinfo_template(self):
×
37
        return self.extra_ni
×
38

39
    def columns(self):
×
40
        return [
×
41
            "id",
42
            "summary",
43
            "creation",
44
            "last_change",
45
            "severity",
46
            "dups_count",
47
            "votes",
48
            "cc_count",
49
            "see_also_count",
50
        ]
51

52
    def get_extra_for_template(self):
×
53
        return {
×
54
            "dups_threshold": self.ndups,
55
            "votes_threshold": self.votes,
56
            "cc_threshold": self.cc,
57
            "see_also_threshold": self.see_also,
58
        }
59

60
    def handle_bug(self, bug, data):
×
61
        bugid = str(bug["id"])
×
62
        cc_count = len(bug["cc"])
×
63
        dups_count = len(bug["duplicates"])
×
64
        votes_count = bug["votes"]
×
65
        see_also_count = len(bug["see_also"])
×
66

67
        data[bugid] = {
×
68
            "creation": utils.get_human_lag(bug["creation_time"]),
69
            "last_change": utils.get_human_lag(bug["last_change_time"]),
70
            "severity": bug["severity"],
71
            "dups_count": dups_count,
72
            "votes": votes_count,
73
            "cc_count": cc_count,
74
            "see_also_count": see_also_count,
75
        }
76

77
        factors = []
×
78
        if dups_count >= self.ndups:
×
79
            factors.append(f"{dups_count} duplicates")
×
80
        if votes_count >= self.votes:
×
81
            factors.append(f"{votes_count} votes")
×
82
        if cc_count >= self.cc:
×
83
            factors.append(f"{cc_count} CCs")
×
84
        if see_also_count >= self.see_also:
×
85
            factors.append(f"{see_also_count} See Also bugs")
×
86

87
        self.extra_ni[bugid] = {
×
88
            "severity": bug["severity"],
89
            "factors": utils.english_list(factors),
90
        }
91

92
        return bug
×
93

94
    def get_bz_params(self, date):
×
95
        fields = [
×
96
            "assigned_to",
97
            "triage_owner",
98
            "creation_time",
99
            "last_change_time",
100
            "severity",
101
            "votes",
102
            "cc",
103
            "duplicates",
104
            "see_also",
105
        ]
106

107
        params = {
×
108
            "include_fields": fields,
109
            "resolution": "---",
110
            "bug_type": "defect",
111
            "bug_severity": ["S3", "S4"],
112
            "f1": "keywords",
113
            "o1": "nowords",
114
            "v1": ["meta", "intermittent"],
115
            "f2": "days_elapsed",
116
            "o2": "lessthan",
117
            "v2": self.nweeks * 7,
118
            "j3": "OR",
119
            "f3": "OP",
120
            "f4": "dupe_count",
121
            "o4": "greaterthaneq",
122
            "v4": self.ndups,
123
            "f5": "votes",
124
            "o5": "greaterthaneq",
125
            "v5": self.votes,
126
            "f6": "cc_count",
127
            "o6": "greaterthaneq",
128
            "v6": self.cc,
129
            "f7": "see_also_count",
130
            "o7": "greaterthaneq",
131
            "v7": self.see_also,
132
            "f8": "CP",
133
            "n15": 1,
134
            "f15": "longdesc",
135
            "o15": "casesubstring",
136
            "v15": "could you consider increasing the bug severity?",
137
        }
138

139
        return params
×
140

141

142
if __name__ == "__main__":
×
143
    UnderestimatedSeverity().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