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

mozilla / relman-auto-nag / #5278

18 Oct 2024 06:17PM CUT coverage: 21.668% (+0.1%) from 21.552%
#5278

push

coveralls-python

web-flow
Update bugbot/rules/webcompat_platform_without_keyword.py

426 of 2872 branches covered (14.83%)

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

5
from google.cloud import bigquery
×
6
from google.oauth2 import service_account
×
7

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

11

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

15
    def description(self):
×
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):
×
30
        fields = ["id", "summary", "keywords"]
×
31
        return {"include_fields": fields, "id": self.get_core_bug_ids()}
×
32

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

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

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

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

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

58

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