blob: d9857daf1a38c5ecf8e7410dc88d1b0acd78f76c [file] [log] [blame]
Joshua Heskethffe42062014-09-05 21:43:52 +10001# Copyright 2014 Rackspace Australia
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import abc
16
17import six
18
19
20@six.add_metaclass(abc.ABCMeta)
21class BaseReporter(object):
22 """Base class for reporters.
23
24 Defines the exact public methods that must be supplied.
25 """
26
Joshua Hesketh352264b2015-08-11 23:42:08 +100027 def __init__(self, reporter_config={}, sched=None, connection=None):
28 self.reporter_config = reporter_config
29 self.sched = sched
30 self.connection = connection
31
32 def stop(self):
33 """Stop the reporter."""
Joshua Heskethffe42062014-09-05 21:43:52 +100034
35 @abc.abstractmethod
Joshua Hesketh352264b2015-08-11 23:42:08 +100036 def report(self, source, change, message):
Joshua Heskethffe42062014-09-05 21:43:52 +100037 """Send the compiled report message."""
38
Joshua Hesketh352264b2015-08-11 23:42:08 +100039 def getSubmitAllowNeeds(self):
Joshua Heskethffe42062014-09-05 21:43:52 +100040 """Get a list of code review labels that are allowed to be
41 "needed" in the submit records for a change, with respect
42 to this queue. In other words, the list of review labels
43 this reporter itself is likely to set before submitting.
44 """
45 return []
Joshua Hesketh352264b2015-08-11 23:42:08 +100046
47 def postConfig(self):
48 """Run tasks after configuration is reloaded"""