summaryrefslogtreecommitdiff
path: root/buildscripts/linter
diff options
context:
space:
mode:
authorAmirsaman Memaripour <amirsaman.memaripour@mongodb.com>2022-01-07 15:53:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-07 17:20:56 +0000
commit3f951c777d1002909c6e5cef1a58556e040ebac8 (patch)
tree9f681e4b8b25e5cf8e9322c43e32bd58cd3d85e9 /buildscripts/linter
parent997bade5afb420cdf369d7fc66d7cb9498230635 (diff)
downloadmongo-3f951c777d1002909c6e5cef1a58556e040ebac8.tar.gz
SERVER-59700 Add programming support for tracepoints
Diffstat (limited to 'buildscripts/linter')
-rw-r--r--buildscripts/linter/simplecpplint.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/buildscripts/linter/simplecpplint.py b/buildscripts/linter/simplecpplint.py
index 7f20d7b11d6..a7b74050687 100644
--- a/buildscripts/linter/simplecpplint.py
+++ b/buildscripts/linter/simplecpplint.py
@@ -59,6 +59,7 @@ _RE_MUTEX = re.compile('[ ({,]stdx?::mutex[ ({]')
_RE_ASSERT = re.compile(r'\bassert\s*\(')
_RE_UNSTRUCTURED_LOG = re.compile(r'\blogd\s*\(')
_RE_STD_OPTIONAL = re.compile(r'\bstd::optional\b')
+_RE_TRACING_SUPPORT = re.compile(r'\bTracerProvider::(get|initialize)\b')
_RE_GENERIC_FCV_COMMENT = re.compile(r'\(Generic FCV reference\):')
GENERIC_FCV = [
@@ -145,6 +146,7 @@ class Linter:
self._check_for_mongo_config_header(linenum)
self._check_for_ctype(linenum)
self._check_for_std_optional(linenum)
+ self._check_for_tracing_support(linenum)
# Relax the rule of commenting generic FCV references for files directly related to FCV
# implementations.
@@ -254,6 +256,13 @@ class Linter:
self._error(linenum, 'mongodb/stdoptional',
'Use of std::optional, use boost::optional instead.')
+ def _check_for_tracing_support(self, linenum):
+ line = self.clean_lines[linenum]
+ if _RE_TRACING_SUPPORT.search(line):
+ self._error(
+ linenum, 'mongodb/tracing', 'Illegal use of tracing support, '
+ 'this is only for local development use and should not be committed.')
+
def _license_error(self, linenum, msg, category='legal/license'):
style_url = 'https://github.com/mongodb/mongo/wiki/Server-Code-Style'
self._error(linenum, category, '{} See {}'.format(msg, style_url))