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

mozilla / relman-auto-nag / #5282

22 Oct 2024 02:53PM CUT coverage: 21.552%. Remained the same
#5282

push

coveralls-python

benjaminmah
Added command to find bugs wih sec-approval flag

426 of 2880 branches covered (14.79%)

1941 of 9006 relevant lines covered (21.55%)

0.22 hits per line

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

0.0
/bugbot/rules/pending_sec_no_tracking.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 import utils as lmdutils
×
6
from libmozdata.bugzilla import Bugzilla
×
7

8
from bugbot import utils
×
9
from bugbot.bzcleaner import BzCleaner
×
10

11

12
class SecurityApprovalTracking(BzCleaner):
×
13
    def __init__(self, channel):
×
14
        super().__init__()
×
15
        self.channel = channel
×
16
        if not self.init_versions():
×
17
            return
×
18

19
        self.version = self.versions[channel] if self.versions else None
×
20

21
        self.extra_ni = None
×
22

23
    def description(self):
×
24
        return "Bugs with attachments pending security approval and incomplete tracking flags"
×
25

26
    def handle_bug(self, bug, data):
×
27
        # Assuming these bugs are bugs that do not have a status flag set to either "affected" or "unaffected"
28
        bugid = str(bug["id"])
×
29
        data[bugid] = {
×
30
            "id": bugid,
31
            "summary": bug["summary"],
32
            "assignee": bug["assigned_to"],
33
        }
34
        self.add_auto_ni(
×
35
            bugid,
36
            {"mail": bug["assigned_to"], "nickname": bug["assigned_to_detail"]["nick"]},
37
        )
38

39
        return bug
×
40

41
    def get_bugs(self, date="today", bug_ids=[], chunk_size=None):
×
42
        bugs = super().get_bugs(date, bug_ids, chunk_size)
×
43

44
        Bugzilla(
×
45
            bugs.keys(),
46
            include_fields=self.fields,
47
            bughandler=self.handle_bug,
48
            bugdata=bugs,
49
        ).wait()
50

51
        self.extra_ni = bugs
×
52
        return bugs
×
53

54
    def get_extra_for_needinfo_template(self):
×
55
        return self.extra_ni
×
56

57
    def columns(self):
×
58
        return ["id", "summary", "assignee"]
×
59

60
    def get_bz_params(self, date):
×
61
        date = lmdutils.get_date_ymd(date)
×
62
        self.status = utils.get_flag(self.version, "status", self.channel)
×
63
        self.tracking = utils.get_flag(self.version, "tracking", self.channel)
×
64
        self.fields = [
×
65
            "id",
66
            "assigned_to",
67
            "nickname",
68
            "flags",
69
            self.tracking,
70
            self.status,
71
        ]
72

73
        params = {
×
74
            "include_fields": self.fields,
75
            "resolution": "---",
76
            "f1": self.status,
77
            "o1": "anywords",
78
            "n1": "1",
79
            "v1": ",".join(["unaffected", "affected"]),
80
            "f2": "flagtypes.name",
81
            "o2": "substring",
82
            "v2": "sec-approval?",
83
        }
84

85
        return params
×
86

87

88
if __name__ == "__main__":
×
89
    SecurityApprovalTracking("beta").run()
×
90
    SecurityApprovalTracking("central").run()
×
91
    SecurityApprovalTracking("esr").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