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

mozilla / relman-auto-nag / #5247

01 Oct 2024 12:36PM CUT coverage: 21.657% (+0.01%) from 21.646%
#5247

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.

585 of 3506 branches covered (16.69%)

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

2 existing lines in 2 files now uncovered.

1940 of 8958 relevant lines covered (21.66%)

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(["https://www.googleapis.com/auth/drive"])
40

NEW
41
        client = bigquery.Client(project=project, credentials=credentials)
×
NEW
42
        query = f"""
×
43
        SELECT core_bug FROM `{project}.{dataset}.prioritized_kb_entries` as kb_entries
44
        JOIN `moz-fx-dev-dschubert-wckb.webcompat_knowledge_base.bugzilla_bugs` as bugzilla_bugs ON bugzilla_bugs.number = kb_entries.core_bug
45
        WHERE "webcompat:platform-bug" not in UNNEST(bugzilla_bugs.keywords)
46
        LIMIT {self.normal_changes_max}
47
        """
48

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

51

52
if __name__ == "__main__":
×
53
    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