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

mozilla / relman-auto-nag / #5325

06 Nov 2024 10:53AM CUT coverage: 21.411% (-0.1%) from 21.516%
#5325

push

coveralls-python

jgraham
Add a rule to sync [webcompat:sightline] whiteboard entry

This should be set on all bugs that are part of the webcompat metrics
set, and by no bugs that aren't.

This initial approach just gets all the bugs that are either in that
set or have the whiteboard entry, and implements the logic to update
them in the client. Given that we expect initially to have ~700 bugs
in that set, this means we need to set the maximum number of bugs to
update to something rather high.

426 of 2902 branches covered (14.68%)

0 of 49 new or added lines in 3 files covered. (0.0%)

1 existing line in 1 file now uncovered.

1942 of 9070 relevant lines covered (21.41%)

0.21 hits per line

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

0.0
/bugbot/log.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
import argparse
×
6
import os
×
7

8
from libmozdata import utils as lmdutils
×
9

10
from . import mail, utils
×
11

12

13
def clean():
×
14
    path = utils.get_config("common", "log")
×
15
    os.remove(path)
×
16

17

18
def get_msg(path):
×
19
    with open(path, "r") as In:
×
20
        data = In.read()
×
21
    errors = 0
×
22
    for line in data.split("\n"):
×
23
        if "ERROR" in line or "CRITICAL" in line:
×
24
            errors += 1
×
25

26
    if errors == 1:
×
27
        return data, []
×
28

29
    return "There are {} errors: see the log in attachment.".format(errors), [path]
×
30

31

32
def send():
×
33
    path = utils.get_config("common", "log")
×
34
    try:
×
35
        n = os.path.getsize(path)
×
36
        if n != 0:
×
37
            login_info = utils.get_login_info()
×
38
            date = lmdutils.get_date("today")
×
39
            msg, files = get_msg(path)
×
40
            mail.send(
×
41
                login_info["ldap_username"],
42
                utils.get_config("common", "on-errors"),
43
                "[bugbot] Something bad happened when running BugBot the {}".format(
44
                    date
45
                ),
46
                msg,
47
                html=False,
48
                login=login_info,
49
                dryrun=False,
50
                files=files,
51
            )
52
    except Exception:
×
53
        pass
×
54

55

56
if __name__ == "__main__":
×
57
    parser = argparse.ArgumentParser(description="Manage logs")
×
58
    parser.add_argument(
×
59
        "-c", "--clean", dest="clean", action="store_true", help="Remove the log files"
60
    )
61
    parser.add_argument(
×
62
        "-s",
63
        "--send",
64
        dest="send",
65
        action="store_true",
66
        help="Send the log if not empty",
67
    )
68
    args = parser.parse_args()
×
69
    if args.clean:
×
70
        clean()
×
71
    if args.send:
×
72
        send()
×
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