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

mozilla / relman-auto-nag / #5253

11 Oct 2024 10:21AM CUT coverage: 21.668% (+0.02%) from 21.646%
#5253

push

coveralls-python

jgraham
Make webcompat platform bugs without keyword use BQ data

This is considered the canonical source for the list of webcompat core bugs,
so using it as the backend for the bug-bot rules avoids needing to duplicate
the logic across multiple systems.

426 of 2874 branches covered (14.82%)

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

1 existing line in 1 file now uncovered.

1941 of 8958 relevant lines covered (21.67%)

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 google.cloud import bigquery
×
NEW
6
from google.oauth2 import service_account
×
7

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

11

12
class WebcompatPlatformWithoutKeyword(BzCleaner):
×
13
    normal_changes_max = 200
×
14

15
    def description(self):
×
NEW
16
        return "Web Compat platform bugs without webcompat:platform-bug keyword"
×
17

18
    def filter_no_nag_keyword(self):
×
19
        return False
×
20

21
    def has_default_products(self):
×
22
        return False
×
23

24
    def get_autofix_change(self):
×
25
        return {
×
26
            "keywords": {"add": ["webcompat:platform-bug"]},
27
        }
28

29
    def get_bz_params(self, date):
×
NEW
30
        fields = ["id", "summary", "keywords"]
×
NEW
31
        return {"include_fields": fields, "id": self.get_core_bug_ids()}
×
32

NEW
33
    def get_core_bug_ids(self):
×
NEW
34
        project = "moz-fx-dev-dschubert-wckb"
×
NEW
35
        dataset = "webcompat_knowledge_base"
×
36

NEW
37
        credentials = service_account.Credentials.from_service_account_info(
×
38
            utils.get_gcp_service_account_info()
39
        ).with_scopes(
40
            [
41
                "https://www.googleapis.com/auth/cloud-platform",
42
                "https://www.googleapis.com/auth/drive",
43
            ]
44
        )
45

NEW
46
        client = bigquery.Client(project=project, credentials=credentials)
×
47

NEW
48
        query = f"""
×
49
        SELECT core_bug FROM `{project}.{dataset}.prioritized_kb_entries` as kb_entries
50
        JOIN `moz-fx-dev-dschubert-wckb.webcompat_knowledge_base.bugzilla_bugs` as bugzilla_bugs ON bugzilla_bugs.number = kb_entries.core_bug
51
        WHERE "webcompat:platform-bug" not in UNNEST(bugzilla_bugs.keywords)
52
        LIMIT {self.normal_changes_max}
53
        """
54

NEW
55
        return list(row["core_bug"] for row in client.query(query).result())
×
56

57

58
if __name__ == "__main__":
×
59
    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