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

mozilla / relman-auto-nag / #5172

24 Jul 2024 04:47PM CUT coverage: 21.68% (-0.09%) from 21.766%
#5172

push

coveralls-python

jgraham
Add rule to set webcompat:platform-bug keyword on KB entry blockers

Core platform bugs which have known site breakage are those that:

* Have the webcompat:platform-bug keyword set OR
* Block a bug in the Web Compatibility :: Knowledge Base component

Because that's not easy to express as a single bugzilla query, add a
rule to ensure that any bug defined by its relationship also has the
keyword set, so that other users can simply use a keyword query to
find all these bugs.

585 of 3503 branches covered (16.7%)

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

1933 of 8916 relevant lines covered (21.68%)

0.22 hits per line

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

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

NEW
5
from libmozdata.bugzilla import Bugzilla
×
6

NEW
7
from bugbot.bzcleaner import BzCleaner
×
8

9

NEW
10
class WebcompatPlatformWithoutKeyword(BzCleaner):
×
NEW
11
    normal_changes_max = 200
×
12

NEW
13
    def description(self):
×
NEW
14
        return "Core bugs blocking webcompat knowledge base entries without webcompat:platform-bug"
×
15

NEW
16
    def filter_no_nag_keyword(self):
×
NEW
17
        return False
×
18

NEW
19
    def has_default_products(self):
×
NEW
20
        return False
×
21

NEW
22
    def handle_bug(self, bug, data):
×
NEW
23
        data[bug["id"]] = {"depends_on": set(bug.get("depends_on", []))}
×
NEW
24
        return bug
×
25

NEW
26
    def get_core_bugs(self, bugs):
×
NEW
27
        core_bugs = set()
×
NEW
28
        for bug_data in bugs.values():
×
NEW
29
            core_bugs |= bug_data.get("depends_on", set())
×
30

NEW
31
        def bug_handler(bug, data):
×
NEW
32
            if "webcompat:platform-bug" not in bug["keywords"]:
×
NEW
33
                data[bug["id"]] = bug
×
34

NEW
35
        core_bug_data = {}
×
36

NEW
37
        Bugzilla(
×
38
            bugids=list(core_bugs),
39
            include_fields=["id", "summary", "keywords"],
40
            bughandler=bug_handler,
41
            bugdata=core_bug_data,
42
        ).get_data().wait()
43

NEW
44
        return core_bug_data
×
45

NEW
46
    def get_autofix_change(self):
×
NEW
47
        return {
×
48
            "keywords": {"add": ["webcompat:platform-bug"]},
49
        }
50

NEW
51
    def get_bz_params(self, date):
×
NEW
52
        fields = [
×
53
            "id",
54
            "depends_on",
55
        ]
NEW
56
        params = {
×
57
            "include_fields": fields,
58
            "product": "Web Compatibility",
59
            "component": "Knowledge Base",
60
        }
61

NEW
62
        return params
×
63

NEW
64
    def get_bugs(self, *args, **kwargs):
×
NEW
65
        bugs = super().get_bugs(*args, **kwargs)
×
NEW
66
        bugs = self.get_core_bugs(bugs)
×
NEW
67
        return bugs
×
68

69

NEW
70
if __name__ == "__main__":
×
NEW
71
    WebcompatPlatformWithoutKeyword().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