Esempio n. 1
0
# -*- coding: utf-8 -*-
import gzip

import requests

from cli_common import utils
from cli_common.log import get_logger
from code_coverage_bot.secrets import secrets

logger = get_logger(__name__)


def coveralls(data):
    logger.info('Upload report to Coveralls')

    r = requests.post('https://coveralls.io/api/v1/jobs', files={
        'json_file': ('json_file', gzip.compress(data), 'gzip/json')
    })

    try:
        result = r.json()
        logger.info('Uploaded report to Coveralls', report=r.text)
    except ValueError:
        raise Exception('Failure to submit data. Response [%s]: %s' % (r.status_code, r.text))

    return result['url'] + '.json'


def codecov(data, commit_sha, flags=None):
    logger.info('Upload report to Codecov')
Esempio n. 2
0
# -*- coding: utf-8 -*-
from collections import OrderedDict
from collections import namedtuple

from cli_common.log import get_logger
from shipit_bot_uplift.api import api_client

logger = get_logger(__name__)

# Status can be: merged, failed, skipped
MergeResult = namedtuple('MergeResult', 'status, message, parent')


class MergeTest(object):
    '''
    A merge test for a set of patches
    against a branch
    '''
    def __init__(self, bugzilla_id, branch, patches):
        self.bugzilla_id = bugzilla_id
        self.branch = branch
        self.patches = patches
        self.parent = None  # Current parent revision
        self.revisions = None  # Listed revisions from patches
        self.results = OrderedDict()  # all the graft results
        self.group = 1  # Group used for every result

    def is_needed(self):
        '''
        Check if running this test is needed:
         * on initial test (no patch status)
Esempio n. 3
0
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from cli_common import log
from cli_common.taskcluster import get_service
from static_analysis_bot.config import settings
from static_analysis_bot.report.base import Reporter

logger = log.get_logger(__name__)


EMAIL_STATS_LINE = '* **{source}**: {publishable} publishable ({total} total)'

EMAIL_HEADER = '''
# Found {publishable} publishable issues ({total} total)

{stats}

Review Url: {review_url}

'''
EMAIL_HEADER_PATCH = '* Improvement patch from {}'


class MailReporter(Reporter):
    '''
    Send an email to admins through Taskcluster service
    '''
    def __init__(self, configuration, client_id, access_token):
Esempio n. 4
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import json
from cli_common import log
from rbtools.api.errors import APIError
from rbtools.api.client import RBClient
from shipit_static_analysis import CLANG_TIDY, CLANG_FORMAT, MOZLINT
from shipit_static_analysis.revisions import MozReviewRevision
from shipit_static_analysis.report.base import Reporter
from shipit_static_analysis.lint import MozLintIssue
from shipit_static_analysis.clang.tidy import ClangTidyIssue
from shipit_static_analysis.clang.format import ClangFormatIssue

logger = log.get_logger(__name__)

MAX_COMMENTS = 30
COMMENT_SUCCESS = '''
C/C++ static analysis didn't find any defects in this patch. Hooray!
'''


class MozReviewReporter(Reporter):
    '''
    API connector to MozReview
    '''

    def __init__(self, configuration, *args):
        '''
        Helper to build an RBTools api root