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

mozilla / relman-auto-nag / #5611

10 Sep 2025 03:02PM UTC coverage: 20.807% (-0.003%) from 20.81%
#5611

push

coveralls-python

web-flow
Bump coverage from 7.9.1 to 7.10.6 (#2706)

Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.9.1 to 7.10.6.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.9.1...7.10.6)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.10.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

426 of 3022 branches covered (14.1%)

1943 of 9338 relevant lines covered (20.81%)

0.21 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 datetime import datetime
×
6
from typing import Any, Optional
×
7

8
from dateutil import parser
×
9

10
from bugbot import gcp
×
11
from bugbot.bzcleaner import BzCleaner
×
12

13

14
class WebcompatPlatformWithoutKeyword(BzCleaner):
×
15
    normal_changes_max = 200
×
16

17
    def __init__(self):
×
18
        super().__init__()
×
19
        self.last_bugzilla_import_time: Optional[datetime] = None
×
20

21
    def description(self) -> str:
×
22
        return "Web Compat platform bugs without webcompat:platform-bug keyword"
×
23

24
    def filter_no_nag_keyword(self) -> bool:
×
25
        return False
×
26

27
    def has_default_products(self) -> bool:
×
28
        return False
×
29

30
    def get_autofix_change(self):
×
31
        return {
×
32
            "keywords": {"add": ["webcompat:platform-bug"]},
33
        }
34

35
    def handle_bug(
×
36
        self, bug: dict[str, Any], data: dict[str, Any]
37
    ) -> Optional[dict[str, Any]]:
38
        bug_id = str(bug["id"])
×
39

40
        # If the bug was updated later than our latest bugzilla data there could be a race,
41
        # so prefer to do nothing.
42
        if (
×
43
            self.last_bugzilla_import_time
44
            and parser.parse(bug["last_change_time"]) > self.last_bugzilla_import_time
45
        ):
46
            return None
×
47

48
        self.autofix_changes[bug_id] = self.get_autofix_change()
×
49
        return bug
×
50

51
    def get_bz_params(self, date) -> dict[str, Any]:
×
52
        fields = ["id", "summary", "keywords", "last_change_time"]
×
53
        return {"include_fields": fields, "id": self.get_bug_ids()}
×
54

55
    def get_bug_ids(self) -> list[int]:
×
56
        project = "moz-fx-dev-dschubert-wckb"
×
57
        dataset = "webcompat_knowledge_base"
×
58

59
        client = gcp.get_bigquery_client(project, ["cloud-platform", "drive"])
×
60

61
        last_run_at_rows = list(
×
62
            client.query(
63
                f"""
64
SELECT run_at FROM `{project}.{dataset}.import_runs` WHERE is_history_fetch_completed ORDER BY run_at DESC LIMIT 1
65
"""
66
            ).result()
67
        )
68
        if last_run_at_rows:
×
69
            self.last_bugzilla_import_time = last_run_at_rows[0]["run_at"]
×
70

71
        query = f"""
×
72
WITH webcompat_removed AS (
73
  SELECT number FROM `{project}.{dataset}.bugs_history` as bugs_history
74
  JOIN bugs_history.changes AS changes
75
  WHERE changes.field_name = "keywords" AND changes.removed = "webcompat:platform-bug"
76
),
77

78
site_reports AS (
79
  SELECT DISTINCT bugs.number AS number FROM `{project}.{dataset}.bugzilla_bugs` AS bugs
80
  JOIN `{project}.{dataset}.breakage_reports` as breakage_reports ON bugs.number = breakage_reports.breakage_bug
81
  JOIN `{project}.{dataset}.breakage_reports_core_bugs` as breakage_reports_core_bugs ON bugs.number = breakage_reports_core_bugs.breakage_bug
82
  LEFT JOIN webcompat_removed ON webcompat_removed.number = bugs.number
83
  JOIN `{project}.{dataset}.bugzilla_bugs` AS core_bugs ON breakage_reports_core_bugs.core_bug = core_bugs.number
84
  WHERE "webcompat:platform-bug" NOT IN UNNEST(bugs.keywords) AND "webcompat:needs-diagnosis" NOT IN UNNEST(bugs.keywords) AND bugs.resolution = "" AND core_bugs.resolution = "" AND webcompat_removed.number IS NULL
85
),
86

87
core_bugs AS (
88
  SELECT core_bug AS number
89
  FROM `{project}.{dataset}.prioritized_kb_entries` as kb_entries
90
  JOIN `{project}.{dataset}.bugzilla_bugs` as bugzilla_bugs ON bugzilla_bugs.number = kb_entries.core_bug
91
  WHERE "webcompat:platform-bug" not in UNNEST(bugzilla_bugs.keywords)
92
)
93

94
SELECT number FROM (
95
  SELECT number FROM site_reports
96
  UNION ALL
97
  SELECT number FROM core_bugs
98
)
99
LIMIT {self.normal_changes_max}
100
"""
101

102
        return list(row["number"] for row in client.query(query).result())
×
103

104

105
if __name__ == "__main__":
×
106
    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