The following issues were found

src/third_party/wiredtiger/test/wtperf/test_conf_dump.py
54 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 101
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

                      cmd += " -o " + option_o_cmd_str

    print("Running:  " + cmd)
    subprocess.check_call(cmd, shell=True)
    print("=========================\n")

# Build a dictionary of config key and it's value from the given config file.
# Optionally take -C, -T and -o and overwrite/append values as per correct
# precedence

            

Reported by Bandit.

subprocess call with shell=True identified, security issue.
Security injection

Line: 322
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

              # Cleanup generated temp files
subprocess.check_call("rm -rf WT_TEST/", shell=True)
if len(sys.argv) == 1 and conf_file == TMP_CONF:
    subprocess.check_call("rm " + TMP_CONF, shell=True)

print("All tests succeeded")

            

Reported by Bandit.

Redefining name 'option_o' from outer scope (line 313)
Error

Line: 87 Column: 61

                  f.close()

# Build a command from the given options and execute wtperf
def execute_wtperf(conf_file, option_C = "", option_T = "", option_o = ""):
    # Generate the command to run, execute wtperf
    cmd = WTPERF_BIN + " -O " + conf_file
    if option_C:
        cmd += " -C " + option_C
    if option_T:

            

Reported by Pylint.

Redefining name 'option_T' from outer scope (line 315)
Error

Line: 87 Column: 46

                  f.close()

# Build a command from the given options and execute wtperf
def execute_wtperf(conf_file, option_C = "", option_T = "", option_o = ""):
    # Generate the command to run, execute wtperf
    cmd = WTPERF_BIN + " -O " + conf_file
    if option_C:
        cmd += " -C " + option_C
    if option_T:

            

Reported by Pylint.

Redefining name 'option_C' from outer scope (line 314)
Error

Line: 87 Column: 31

                  f.close()

# Build a command from the given options and execute wtperf
def execute_wtperf(conf_file, option_C = "", option_T = "", option_o = ""):
    # Generate the command to run, execute wtperf
    cmd = WTPERF_BIN + " -O " + conf_file
    if option_C:
        cmd += " -C " + option_C
    if option_T:

            

Reported by Pylint.

Redefining name 'conf_file' from outer scope (line 303)
Error

Line: 87 Column: 20

                  f.close()

# Build a command from the given options and execute wtperf
def execute_wtperf(conf_file, option_C = "", option_T = "", option_o = ""):
    # Generate the command to run, execute wtperf
    cmd = WTPERF_BIN + " -O " + conf_file
    if option_C:
        cmd += " -C " + option_C
    if option_T:

            

Reported by Pylint.

Redefining name 'conf_file' from outer scope (line 303)
Error

Line: 108 Column: 9

              # Optionally take -C, -T and -o and overwrite/append values as per correct
# precedence
def build_dict_from_conf(
        conf_file, option_C = "", option_T = "", option_o = ""):
    # Open given conf file and make a dictionary of passed arguments and values
    with open(conf_file) as f:
        lines = f.read().splitlines()

        # Maintain precedence order of config file, -o, -C/-T

            

Reported by Pylint.

Redefining name 'option_C' from outer scope (line 314)
Error

Line: 108 Column: 20

              # Optionally take -C, -T and -o and overwrite/append values as per correct
# precedence
def build_dict_from_conf(
        conf_file, option_C = "", option_T = "", option_o = ""):
    # Open given conf file and make a dictionary of passed arguments and values
    with open(conf_file) as f:
        lines = f.read().splitlines()

        # Maintain precedence order of config file, -o, -C/-T

            

Reported by Pylint.

Redefining name 'option_T' from outer scope (line 315)
Error

Line: 108 Column: 35

              # Optionally take -C, -T and -o and overwrite/append values as per correct
# precedence
def build_dict_from_conf(
        conf_file, option_C = "", option_T = "", option_o = ""):
    # Open given conf file and make a dictionary of passed arguments and values
    with open(conf_file) as f:
        lines = f.read().splitlines()

        # Maintain precedence order of config file, -o, -C/-T

            

Reported by Pylint.

Redefining name 'option_o' from outer scope (line 313)
Error

Line: 108 Column: 50

              # Optionally take -C, -T and -o and overwrite/append values as per correct
# precedence
def build_dict_from_conf(
        conf_file, option_C = "", option_T = "", option_o = ""):
    # Open given conf file and make a dictionary of passed arguments and values
    with open(conf_file) as f:
        lines = f.read().splitlines()

        # Maintain precedence order of config file, -o, -C/-T

            

Reported by Pylint.

src/third_party/wiredtiger/dist/log.py
54 issues
Unused import re
Error

Line: 3 Column: 1

              #!/usr/bin/env python

import os, re, sys, textwrap
from dist import compare_srcfile, format_srcfile
import log_data

# Temporary file.
tmp_file = '__tmp'


            

Reported by Pylint.

Unused import os
Error

Line: 3 Column: 1

              #!/usr/bin/env python

import os, re, sys, textwrap
from dist import compare_srcfile, format_srcfile
import log_data

# Temporary file.
tmp_file = '__tmp'


            

Reported by Pylint.

Unused import textwrap
Error

Line: 3 Column: 1

              #!/usr/bin/env python

import os, re, sys, textwrap
from dist import compare_srcfile, format_srcfile
import log_data

# Temporary file.
tmp_file = '__tmp'


            

Reported by Pylint.

Unused import sys
Error

Line: 3 Column: 1

              #!/usr/bin/env python

import os, re, sys, textwrap
from dist import compare_srcfile, format_srcfile
import log_data

# Temporary file.
tmp_file = '__tmp'


            

Reported by Pylint.

Redefining name 'f' from outer scope (line 132)
Error

Line: 27 Column: 13

                  'uint64' : ('uint64_t', 'Q', '%" PRIu64 "', 'arg', [ '' ]),
}

def cintype(f):
    return field_types[f[0]][0]

def couttype(f):
    type = cintype(f)
    # We already have a pointer to a WT_ITEM

            

Reported by Pylint.

Redefining name 'f' from outer scope (line 132)
Error

Line: 30 Column: 14

              def cintype(f):
    return field_types[f[0]][0]

def couttype(f):
    type = cintype(f)
    # We already have a pointer to a WT_ITEM
    if f[0] == 'item' or f[0] == 'WT_LSN':
        return type
    if type[-1] != '*':

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 31 Column: 5

                  return field_types[f[0]][0]

def couttype(f):
    type = cintype(f)
    # We already have a pointer to a WT_ITEM
    if f[0] == 'item' or f[0] == 'WT_LSN':
        return type
    if type[-1] != '*':
        type += ' '

            

Reported by Pylint.

Redefining name 'f' from outer scope (line 132)
Error

Line: 39 Column: 16

                      type += ' '
    return type + '*'

def clocaltype(f):
    type = cintype(f)
    # Allocate WT_ITEM and WT_LSN structs on the stack
    if f[0] in ('item', 'WT_LSN'):
        return type[:-2]
    return type

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 40 Column: 5

                  return type + '*'

def clocaltype(f):
    type = cintype(f)
    # Allocate WT_ITEM and WT_LSN structs on the stack
    if f[0] in ('item', 'WT_LSN'):
        return type[:-2]
    return type


            

Reported by Pylint.

Redefining name 'f' from outer scope (line 132)
Error

Line: 50 Column: 9

                  return '\n\tchar *escaped;' if has_escape(fields) else ''

def has_escape(fields):
    for f in fields:
        for setup in field_types[f[0]][4]:
            if 'escaped' in setup:
                return True
    return False


            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs27.py
53 issues
Unable to import 'wiredtiger'
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs27.py
# Test that variable-length column store doesn't RLE-compact adjacent data with heterogeneous

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs27.py
# Test that variable-length column store doesn't RLE-compact adjacent data with heterogeneous

            

Reported by Pylint.

Unused variable 'k'
Error

Line: 137 Column: 10

                      km = self.invert_key(key)
        if km is None:
                return False
        (k, m) = km

        # Get the timestamp number associated with readtime.
        m2 = self.invert_timestamp(readtime, -1, self.ntimes)

        # We should see value_2 if we are at or after the time it was written.

            

Reported by Pylint.

Cell variable key defined in loop
Error

Line: 159 Column: 80

                              elif self.doinit:
                    self.assertEqual(cursor[ds.key(key)], self.value_1)
                else:
                    self.assertRaisesException(KeyError, lambda: cursor[ds.key(key)])
        if make_own_txn:
            session.rollback_transaction()
        cursor.close()

    # Scan through the whole table and make sure it's what we expect.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_hs27.py
# Test that variable-length column store doesn't RLE-compact adjacent data with heterogeneous

            

Reported by Pylint.

Class name "test_hs27" doesn't conform to PascalCase naming style
Error

Line: 42 Column: 1

              #
# This works by writing the same value to adjacent keys at different times, evicting them, and
# making sure they read back correctly. (The eviction is necessary to go through the RLE code.)
class test_hs27(wttest.WiredTigerTestCase):
    conn_config = ''
    session_config = 'isolation=snapshot'

    nrows = 100
    value_1 = 'a' * 119

            

Reported by Pylint.

Missing class docstring
Error

Line: 42 Column: 1

              #
# This works by writing the same value to adjacent keys at different times, evicting them, and
# making sure they read back correctly. (The eviction is necessary to go through the RLE code.)
class test_hs27(wttest.WiredTigerTestCase):
    conn_config = ''
    session_config = 'isolation=snapshot'

    nrows = 100
    value_1 = 'a' * 119

            

Reported by Pylint.

Method could be a function
Error

Line: 86 Column: 5

                      group_forward_values, keys_forward_values)

    # Get the m'th writer timestamp.
    def get_writetime(self, m):
        return 40 + 2 * m

    # Get the m'th reader timestamp.
    def get_readtime(self, m):
        return 41 + 2 * m

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 86 Column: 5

                      group_forward_values, keys_forward_values)

    # Get the m'th writer timestamp.
    def get_writetime(self, m):
        return 40 + 2 * m

    # Get the m'th reader timestamp.
    def get_readtime(self, m):
        return 41 + 2 * m

            

Reported by Pylint.

src/third_party/wiredtiger/dist/function.py
52 issues
Unused import os
Error

Line: 5 Column: 1

              
# Check the style of WiredTiger C code.
from __future__ import print_function
import fnmatch, os, re, sys
from dist import all_c_files, compare_srcfile, source_files

# Complain if a function comment is missing.
def missing_comment():
    for f in source_files():

            

Reported by Pylint.

Unused import fnmatch
Error

Line: 5 Column: 1

              
# Check the style of WiredTiger C code.
from __future__ import print_function
import fnmatch, os, re, sys
from dist import all_c_files, compare_srcfile, source_files

# Complain if a function comment is missing.
def missing_comment():
    for f in source_files():

            

Reported by Pylint.

Anomalous backslash in string: '\w'. String constant might be missing an r prefix.
Error

Line: 118 Column: 37

              
    # Check for illegal types.
    for m in illegal_types:
        if re.search('^' + m + "\s*[\w(*]", line):
            print(name + ": illegal type: " + line.strip(), file=sys.stderr)
            sys.exit(1)

    # Check for matching types.
    for n,m in enumerate(types, 0):

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 118 Column: 33

              
    # Check for illegal types.
    for m in illegal_types:
        if re.search('^' + m + "\s*[\w(*]", line):
            print(name + ": illegal type: " + line.strip(), file=sys.stderr)
            sys.exit(1)

    # Check for matching types.
    for n,m in enumerate(types, 0):

            

Reported by Pylint.

Anomalous backslash in string: '\w'. String constant might be missing an r prefix.
Error

Line: 126 Column: 37

                  for n,m in enumerate(types, 0):
        # Don't list '{' as a legal character in a declaration, that's what
        # prevents us from sorting inline union/struct declarations.
        if re.search('^' + m + "\s*[\w(*]", line):
            return True,n
    return False,0

# Put function arguments in correct sort order.
def function_declaration():

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 126 Column: 33

                  for n,m in enumerate(types, 0):
        # Don't list '{' as a legal character in a declaration, that's what
        # prevents us from sorting inline union/struct declarations.
        if re.search('^' + m + "\s*[\w(*]", line):
            return True,n
    return False,0

# Put function arguments in correct sort order.
def function_declaration():

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 149 Column: 25

                              if not tracking:
                    tfile.write(line)
                    if re.search('^{$', line):
                        list = [[] for i in range(len(types))]
                        static_list = [[] for i in range(len(types))]
                        tracking = True;
                    continue

                found,n = function_args(name, line)

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 151 Column: 1

                                  if re.search('^{$', line):
                        list = [[] for i in range(len(types))]
                        static_list = [[] for i in range(len(types))]
                        tracking = True;
                    continue

                found,n = function_args(name, line)
                if found:
                    # List statics first.

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 157 Column: 36

                              found,n = function_args(name, line)
                if found:
                    # List statics first.
                    if re.search("^\s+static", line):
                        static_list[n].append(line)
                        continue

                    # Disallow assignments in the declaration. Ignore braces
                    # to allow automatic array initialization using constant

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 165 Column: 35

                                  # to allow automatic array initialization using constant
                    # initializers (and we've already skipped statics, which
                    # are also typically initialized in the declaration).
                    if re.search("\s=\s[-\w]", line):
                        print(name + ": assignment in string: " + line.strip(),\
                              file=sys.stderr)
                        sys.exit(1);

                    list[n].append(line)

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Debug.py
52 issues
TODO really get memory stats for OS X
Error

Line: 105 Column: 2

                      mstr = mstr.split()[22]
        return int(mstr)
elif sys.platform[:6] == 'darwin':
    #TODO really get memory stats for OS X
    def memory():
        return 0
else:
    try:
        import resource

            

Reported by Pylint.

Using the global statement
Error

Line: 149 Column: 5

                  Trace caller stack and save info into global dicts, which
    are printed automatically at the end of SCons execution.
    """
    global caller_bases, caller_dicts
    import traceback
    tb = traceback.extract_stack(limit=3+back)
    tb.reverse()
    callee = tb[1][:3]
    caller_bases[callee] = caller_bases.get(callee, 0) + 1

            

Reported by Pylint.

Using the global statement
Error

Line: 212 Column: 5

              def Trace(msg, file=None, mode='w', tstamp=None):
    """Write a trace message to a file.  Whenever a file is specified,
    it becomes the default for the next call to Trace()."""
    global TraceDefault
    global TimeStampDefault
    global PreviousTime
    if file is None:
        file = TraceDefault
    else:

            

Reported by Pylint.

Using the global statement
Error

Line: 213 Column: 5

                  """Write a trace message to a file.  Whenever a file is specified,
    it becomes the default for the next call to Trace()."""
    global TraceDefault
    global TimeStampDefault
    global PreviousTime
    if file is None:
        file = TraceDefault
    else:
        TraceDefault = file

            

Reported by Pylint.

Using the global statement
Error

Line: 214 Column: 5

                  it becomes the default for the next call to Trace()."""
    global TraceDefault
    global TimeStampDefault
    global PreviousTime
    if file is None:
        file = TraceDefault
    else:
        TraceDefault = file
    if tstamp is None:

            

Reported by Pylint.

Module name "Debug" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              """SCons.Debug

Code for debugging SCons internal things.  Shouldn't be
needed by most users. Quick shortcuts:

from SCons.Debug import caller_trace
caller_trace()

"""

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 34 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Debug.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import os
import sys
import time
import weakref

            

Reported by Pylint.

Constant name "track_instances" doesn't conform to UPPER_CASE naming style
Error

Line: 44 Column: 1

              
# Global variable that gets set to 'True' by the Main script,
# when the creation of class instances should get tracked.
track_instances = False
# List of currently tracked classes
tracked_classes = {}

def logInstanceCreation(instance, name=None):
    if name is None:

            

Reported by Pylint.

Function name "logInstanceCreation" doesn't conform to snake_case naming style
Error

Line: 48 Column: 1

              # List of currently tracked classes
tracked_classes = {}

def logInstanceCreation(instance, name=None):
    if name is None:
        name = instance.__class__.__name__
    if name not in tracked_classes:
        tracked_classes[name] = []
    if hasattr(instance, '__dict__'):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 1

              # List of currently tracked classes
tracked_classes = {}

def logInstanceCreation(instance, name=None):
    if name is None:
        name = instance.__class__.__name__
    if name not in tracked_classes:
        tracked_classes[name] = []
    if hasattr(instance, '__dict__'):

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/matchers/test_datastructures.py
52 issues
Anomalous backslash in string: '\)'. String constant might be missing an r prefix.
Error

Line: 151 Column: 63

                      self.assertMismatchWithDescriptionMatching(
            [3], MatchesSetwise(Equals(1), Equals(2), Equals(3)),
            MatchesRegex(
                'There were 2 matchers left over: Equals\([12]\), '
                'Equals\([12]\)'))

    def test_two_too_many_values(self):
        self.assertMismatchWithDescriptionMatching(
            [1, 2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),

            

Reported by Pylint.

Anomalous backslash in string: '\('. String constant might be missing an r prefix.
Error

Line: 151 Column: 57

                      self.assertMismatchWithDescriptionMatching(
            [3], MatchesSetwise(Equals(1), Equals(2), Equals(3)),
            MatchesRegex(
                'There were 2 matchers left over: Equals\([12]\), '
                'Equals\([12]\)'))

    def test_two_too_many_values(self):
        self.assertMismatchWithDescriptionMatching(
            [1, 2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),

            

Reported by Pylint.

Anomalous backslash in string: '\)'. String constant might be missing an r prefix.
Error

Line: 152 Column: 30

                          [3], MatchesSetwise(Equals(1), Equals(2), Equals(3)),
            MatchesRegex(
                'There were 2 matchers left over: Equals\([12]\), '
                'Equals\([12]\)'))

    def test_two_too_many_values(self):
        self.assertMismatchWithDescriptionMatching(
            [1, 2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),
            MatchesRegex(

            

Reported by Pylint.

Anomalous backslash in string: '\('. String constant might be missing an r prefix.
Error

Line: 152 Column: 24

                          [3], MatchesSetwise(Equals(1), Equals(2), Equals(3)),
            MatchesRegex(
                'There were 2 matchers left over: Equals\([12]\), '
                'Equals\([12]\)'))

    def test_two_too_many_values(self):
        self.assertMismatchWithDescriptionMatching(
            [1, 2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),
            MatchesRegex(

            

Reported by Pylint.

Anomalous backslash in string: '\['. String constant might be missing an r prefix.
Error

Line: 158 Column: 49

                      self.assertMismatchWithDescriptionMatching(
            [1, 2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),
            MatchesRegex(
                'There were 2 values left over: \[[34], [34]\]'))

    def test_mismatch_and_too_many_matchers(self):
        self.assertMismatchWithDescriptionMatching(
            [2, 3], MatchesSetwise(Equals(0), Equals(1), Equals(2)),
            MatchesRegex(

            

Reported by Pylint.

Anomalous backslash in string: '\]'. String constant might be missing an r prefix.
Error

Line: 158 Column: 61

                      self.assertMismatchWithDescriptionMatching(
            [1, 2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),
            MatchesRegex(
                'There were 2 values left over: \[[34], [34]\]'))

    def test_mismatch_and_too_many_matchers(self):
        self.assertMismatchWithDescriptionMatching(
            [2, 3], MatchesSetwise(Equals(0), Equals(1), Equals(2)),
            MatchesRegex(

            

Reported by Pylint.

Anomalous backslash in string: '\)'. String constant might be missing an r prefix.
Error

Line: 164 Column: 74

                      self.assertMismatchWithDescriptionMatching(
            [2, 3], MatchesSetwise(Equals(0), Equals(1), Equals(2)),
            MatchesRegex(
                '.*There was 1 mismatch and 1 extra matcher: Equals\([01]\)',
                re.S))

    def test_mismatch_and_too_many_values(self):
        self.assertMismatchWithDescriptionMatching(
            [2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),

            

Reported by Pylint.

Anomalous backslash in string: '\('. String constant might be missing an r prefix.
Error

Line: 164 Column: 68

                      self.assertMismatchWithDescriptionMatching(
            [2, 3], MatchesSetwise(Equals(0), Equals(1), Equals(2)),
            MatchesRegex(
                '.*There was 1 mismatch and 1 extra matcher: Equals\([01]\)',
                re.S))

    def test_mismatch_and_too_many_values(self):
        self.assertMismatchWithDescriptionMatching(
            [2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),

            

Reported by Pylint.

Anomalous backslash in string: '\['. String constant might be missing an r prefix.
Error

Line: 171 Column: 60

                      self.assertMismatchWithDescriptionMatching(
            [2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),
            MatchesRegex(
                '.*There was 1 mismatch and 1 extra value: \[[34]\]',
                re.S))

    def test_mismatch_and_two_too_many_matchers(self):
        self.assertMismatchWithDescriptionMatching(
            [3, 4], MatchesSetwise(

            

Reported by Pylint.

Anomalous backslash in string: '\]'. String constant might be missing an r prefix.
Error

Line: 171 Column: 66

                      self.assertMismatchWithDescriptionMatching(
            [2, 3, 4], MatchesSetwise(Equals(1), Equals(2)),
            MatchesRegex(
                '.*There was 1 mismatch and 1 extra value: \[[34]\]',
                re.S))

    def test_mismatch_and_two_too_many_matchers(self):
        self.assertMismatchWithDescriptionMatching(
            [3, 4], MatchesSetwise(

            

Reported by Pylint.

src/third_party/wiredtiger/dist/test_tag.py
52 issues
Redefining name 'tag' from outer scope (line 76)
Error

Line: 28 Column: 18

              #####

##### FUNCTIONS #####
def validate_tag(tag, filename):
    split_tag = tag.split(":")
    # Ensure the array isn't too long.
    if (len(split_tag) > 3):
        print("Tag contains too many sub tags: " + tag + " filename: " + filename);
        exit(1)

            

Reported by Pylint.

Redefining name 'filename' from outer scope (line 64)
Error

Line: 28 Column: 23

              #####

##### FUNCTIONS #####
def validate_tag(tag, filename):
    split_tag = tag.split(":")
    # Ensure the array isn't too long.
    if (len(split_tag) > 3):
        print("Tag contains too many sub tags: " + tag + " filename: " + filename);
        exit(1)

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 32 Column: 1

                  split_tag = tag.split(":")
    # Ensure the array isn't too long.
    if (len(split_tag) > 3):
        print("Tag contains too many sub tags: " + tag + " filename: " + filename);
        exit(1)

    # Walk the pieces of the tag and ensure they exist in test_tags.ok.
    for sub_tag in split_tag:
        if not sub_tag in valid_tags:

            

Reported by Pylint.

Redefining name 'tag' from outer scope (line 76)
Error

Line: 42 Column: 16

                              "Invalid sub tag found: " + sub_tag + " in tag: " + tag + " filename: " + filename)
            exit(1)

def format_tag(tag):
    return tag.replace("_", " ").title()
#####

##### PROCESS ARGS #####
for arg in sys.argv:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import sys
from dist import compare_srcfile

##### LOCAL VARIABLES AND CONSTANTS #####
show_info = False
show_missing_files = False

nb_ignored_files = 0

            

Reported by Pylint.

Constant name "show_info" doesn't conform to UPPER_CASE naming style
Error

Line: 6 Column: 1

              from dist import compare_srcfile

##### LOCAL VARIABLES AND CONSTANTS #####
show_info = False
show_missing_files = False

nb_ignored_files = 0
nb_missing_files = 0
nb_valid_files = 0

            

Reported by Pylint.

Constant name "show_missing_files" doesn't conform to UPPER_CASE naming style
Error

Line: 7 Column: 1

              
##### LOCAL VARIABLES AND CONSTANTS #####
show_info = False
show_missing_files = False

nb_ignored_files = 0
nb_missing_files = 0
nb_valid_files = 0


            

Reported by Pylint.

Constant name "nb_ignored_files" doesn't conform to UPPER_CASE naming style
Error

Line: 9 Column: 1

              show_info = False
show_missing_files = False

nb_ignored_files = 0
nb_missing_files = 0
nb_valid_files = 0

sorted_tags = []
test_files = []

            

Reported by Pylint.

Constant name "nb_missing_files" doesn't conform to UPPER_CASE naming style
Error

Line: 10 Column: 1

              show_missing_files = False

nb_ignored_files = 0
nb_missing_files = 0
nb_valid_files = 0

sorted_tags = []
test_files = []


            

Reported by Pylint.

Constant name "nb_valid_files" doesn't conform to UPPER_CASE naming style
Error

Line: 11 Column: 1

              
nb_ignored_files = 0
nb_missing_files = 0
nb_valid_files = 0

sorted_tags = []
test_files = []

tagged_files = {}

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/run.py
51 issues
Unable to import 'extras'
Error

Line: 16 Column: 1

              import unittest
import sys

from extras import safe_hasattr

from testtools import TextTestResult
from testtools.compat import classtypes, istext, unicode_output_stream
from testtools.testsuite import filter_by_ids, iterate_tests, sorted_tests


            

Reported by Pylint.

Unused classtypes imported from testtools.compat
Error

Line: 19 Column: 1

              from extras import safe_hasattr

from testtools import TextTestResult
from testtools.compat import classtypes, istext, unicode_output_stream
from testtools.testsuite import filter_by_ids, iterate_tests, sorted_tests


defaultTestLoader = unittest.defaultTestLoader
defaultTestLoaderCls = unittest.TestLoader

            

Reported by Pylint.

Unused argument 'verbosity'
Error

Line: 66 Column: 24

              class TestToolsTestRunner(object):
    """ A thunk object to support unittest.TestProgram."""

    def __init__(self, verbosity=None, failfast=None, buffer=None,
        stdout=None):
        """Create a TestToolsTestRunner.

        :param verbosity: Ignored.
        :param failfast: Stop running tests at the first failure.

            

Reported by Pylint.

Unused argument 'buffer'
Error

Line: 66 Column: 55

              class TestToolsTestRunner(object):
    """ A thunk object to support unittest.TestProgram."""

    def __init__(self, verbosity=None, failfast=None, buffer=None,
        stdout=None):
        """Create a TestToolsTestRunner.

        :param verbosity: Ignored.
        :param failfast: Stop running tests at the first failure.

            

Reported by Pylint.

Redefining built-in 'exit'
Error

Line: 174 Column: 21

              
    def __init__(self, module=__name__, defaultTest=None, argv=None,
                    testRunner=None, testLoader=defaultTestLoader,
                    exit=True, verbosity=1, failfast=None, catchbreak=None,
                    buffer=None, stdout=None):
        if module == __name__:
            self.module = None
        elif istext(module):
            self.module = __import__(module)

            

Reported by Pylint.

TODO: preserve existing suites (like testresources does in
Error

Line: 208 Column: 3

                      self.progName = progName
        self.parseArgs(argv)
        if self.load_list:
            # TODO: preserve existing suites (like testresources does in
            # OptimisingTestSuite.add, but with a standard protocol).
            # This is needed because the load_tests hook allows arbitrary
            # suites, even if that is rarely used.
            source = open(self.load_list, 'rb')
            try:

            

Reported by Pylint.

Uses of a deprecated module 'optparse'
Error

Line: 300 Column: 9

                          raise AssertionError("Unable to use discovery, must use python 2.7 "
                    "or greater, or install the discover package.")
        self.progName = '%s discover' % self.progName
        import optparse
        parser = optparse.OptionParser()
        parser.prog = self.progName
        parser.add_option('-v', '--verbose', dest='verbose', default=False,
                          help='Verbose output', action='store_true')
        if self.failfast != False:

            

Reported by Pylint.

Unused variable 'program'
Error

Line: 395 Column: 5

              ################

def main(argv, stdout):
    program = TestProgram(argv=argv, testRunner=partial(TestToolsTestRunner, stdout=stdout),
        stdout=stdout)

if __name__ == '__main__':
    main(sys.argv, sys.stdout)

            

Reported by Pylint.

Class name "defaultTestLoaderCls" doesn't conform to PascalCase naming style
Error

Line: 24 Column: 1

              

defaultTestLoader = unittest.defaultTestLoader
defaultTestLoaderCls = unittest.TestLoader

if getattr(defaultTestLoader, 'discover', None) is None:
    try:
        import discover
        defaultTestLoader = discover.DiscoveringTestLoader()

            

Reported by Pylint.

Constant name "have_discover" doesn't conform to UPPER_CASE naming style
Error

Line: 31 Column: 9

                      import discover
        defaultTestLoader = discover.DiscoveringTestLoader()
        defaultTestLoaderCls = discover.DiscoveringTestLoader
        have_discover = True
    except ImportError:
        have_discover = False
else:
    have_discover = True


            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/workgen.cxx
51 issues
sprintf - Potential format string problem
Security

Line: 253 Column: 13 CWE codes: 134
Suggestion: Make format string constant

                  while (!stopping) {
        if (_workload->options.oldest_timestamp_lag > 0) {
            time_us = WorkgenTimeStamp::get_timestamp_lag(_workload->options.oldest_timestamp_lag);
            sprintf(buf, "oldest_timestamp=%" PRIu64, time_us);
            conn->set_timestamp(conn, buf);
        }

        if (_workload->options.stable_timestamp_lag > 0) {
            time_us = WorkgenTimeStamp::get_timestamp_lag(_workload->options.stable_timestamp_lag);

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 259 Column: 13 CWE codes: 134
Suggestion: Make format string constant

              
        if (_workload->options.stable_timestamp_lag > 0) {
            time_us = WorkgenTimeStamp::get_timestamp_lag(_workload->options.stable_timestamp_lag);
            sprintf(buf, "stable_timestamp=%" PRIu64, time_us);
            conn->set_timestamp(conn, buf);
        }

        WorkgenTimeStamp::sleep(_workload->options.timestamp_advance);
    }

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 1056 Column: 17 CWE codes: 134
Suggestion: Make format string constant

                          if (op->transaction->read_timestamp_lag > 0) {
                uint64_t read =
                  WorkgenTimeStamp::get_timestamp_lag(op->transaction->read_timestamp_lag);
                sprintf(buf, "%s=%" PRIu64, op->transaction->_begin_config.c_str(), read);
            } else {
                sprintf(buf, "%s", op->transaction->_begin_config.c_str());
            }
            WT_ERR(_session->begin_transaction(_session, buf));


            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 1058 Column: 17 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

                                WorkgenTimeStamp::get_timestamp_lag(op->transaction->read_timestamp_lag);
                sprintf(buf, "%s=%" PRIu64, op->transaction->_begin_config.c_str(), read);
            } else {
                sprintf(buf, "%s", op->transaction->_begin_config.c_str());
            }
            WT_ERR(_session->begin_transaction(_session, buf));

            _in_transaction = true;
        }

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 1149 Column: 17 CWE codes: 134
Suggestion: Make format string constant

                          // Set prepare, commit and durable timestamp if prepare is set.
            if (op->transaction->use_prepare_timestamp) {
                time_us = WorkgenTimeStamp::get_timestamp();
                sprintf(buf, "prepare_timestamp=%" PRIu64, time_us);
                ret = _session->prepare_transaction(_session, buf);
                sprintf(
                  buf, "commit_timestamp=%" PRIu64 ",durable_timestamp=%" PRIu64, time_us, time_us);
                ret = _session->commit_transaction(_session, buf);
            } else if (op->transaction->use_commit_timestamp) {

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 1151 Column: 17 CWE codes: 134
Suggestion: Make format string constant

                              time_us = WorkgenTimeStamp::get_timestamp();
                sprintf(buf, "prepare_timestamp=%" PRIu64, time_us);
                ret = _session->prepare_transaction(_session, buf);
                sprintf(
                  buf, "commit_timestamp=%" PRIu64 ",durable_timestamp=%" PRIu64, time_us, time_us);
                ret = _session->commit_transaction(_session, buf);
            } else if (op->transaction->use_commit_timestamp) {
                uint64_t commit_time_us = WorkgenTimeStamp::get_timestamp();
                sprintf(buf, "commit_timestamp=%" PRIu64, commit_time_us);

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 1156 Column: 17 CWE codes: 134
Suggestion: Make format string constant

                              ret = _session->commit_transaction(_session, buf);
            } else if (op->transaction->use_commit_timestamp) {
                uint64_t commit_time_us = WorkgenTimeStamp::get_timestamp();
                sprintf(buf, "commit_timestamp=%" PRIu64, commit_time_us);
                ret = _session->commit_transaction(_session, buf);
            } else {
                ret =
                  _session->commit_transaction(_session, op->transaction->_commit_config.c_str());
            }

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 187 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  WT_CURSOR *cursor;
    uint64_t start, stop, last_interval;
    int ret, cycle_count;
    char uri[BUF_SIZE];

    cycle_count = 0;
    if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) {
        THROW("Error Opening a Session.");
    }

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 195 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

                  }

    for (cycle_count = 0; !stopping; ++cycle_count) {
        sprintf(uri, "table:test_cycle%04d", cycle_count);

        workgen_clock(&start);
        /* Create a table. */
        if ((ret = session->create(session, uri, "key_format=S,value_format=S")) != 0) {
            if (ret == EBUSY)

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 248 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              WorkloadRunner::increment_timestamp(WT_CONNECTION *conn)
{
    uint64_t time_us;
    char buf[BUF_SIZE];

    while (!stopping) {
        if (_workload->options.oldest_timestamp_lag > 0) {
            time_us = WorkgenTimeStamp::get_timestamp_lag(_workload->options.oldest_timestamp_lag);
            sprintf(buf, "oldest_timestamp=%" PRIu64, time_us);

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/testresult/doubles.py
51 issues
Parameters differ from overridden 'addError' method
Error

Line: 96 Column: 5

                      super(ExtendedTestResult, self).__init__()
        self._tags = TagContext()

    def addError(self, test, err=None, details=None):
        self._was_successful = False
        self._events.append(('addError', test, err or details))

    def addFailure(self, test, err=None, details=None):
        self._was_successful = False

            

Reported by Pylint.

Parameters differ from overridden 'addFailure' method
Error

Line: 100 Column: 5

                      self._was_successful = False
        self._events.append(('addError', test, err or details))

    def addFailure(self, test, err=None, details=None):
        self._was_successful = False
        self._events.append(('addFailure', test, err or details))

    def addExpectedFailure(self, test, err=None, details=None):
        self._events.append(('addExpectedFailure', test, err or details))

            

Reported by Pylint.

Parameters differ from overridden 'addExpectedFailure' method
Error

Line: 104 Column: 5

                      self._was_successful = False
        self._events.append(('addFailure', test, err or details))

    def addExpectedFailure(self, test, err=None, details=None):
        self._events.append(('addExpectedFailure', test, err or details))

    def addSkip(self, test, reason=None, details=None):
        self._events.append(('addSkip', test, reason or details))


            

Reported by Pylint.

Parameters differ from overridden 'addSkip' method
Error

Line: 107 Column: 5

                  def addExpectedFailure(self, test, err=None, details=None):
        self._events.append(('addExpectedFailure', test, err or details))

    def addSkip(self, test, reason=None, details=None):
        self._events.append(('addSkip', test, reason or details))

    def addSuccess(self, test, details=None):
        if details:
            self._events.append(('addSuccess', test, details))

            

Reported by Pylint.

Parameters differ from overridden 'addSuccess' method
Error

Line: 110 Column: 5

                  def addSkip(self, test, reason=None, details=None):
        self._events.append(('addSkip', test, reason or details))

    def addSuccess(self, test, details=None):
        if details:
            self._events.append(('addSuccess', test, details))
        else:
            self._events.append(('addSuccess', test))


            

Reported by Pylint.

Parameters differ from overridden 'addUnexpectedSuccess' method
Error

Line: 116 Column: 5

                      else:
            self._events.append(('addSuccess', test))

    def addUnexpectedSuccess(self, test, details=None):
        self._was_successful = False
        if details is not None:
            self._events.append(('addUnexpectedSuccess', test, details))
        else:
            self._events.append(('addUnexpectedSuccess', test))

            

Reported by Pylint.

Class 'LoggingBase' inherits from object, can be safely removed from bases in python3
Error

Line: 16 Column: 1

              from testtools.tags import TagContext


class LoggingBase(object):
    """Basic support for logging of results."""

    def __init__(self):
        self._events = []
        self.shouldStop = False

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 16 Column: 1

              from testtools.tags import TagContext


class LoggingBase(object):
    """Basic support for logging of results."""

    def __init__(self):
        self._events = []
        self.shouldStop = False

            

Reported by Pylint.

Attribute name "shouldStop" doesn't conform to snake_case naming style
Error

Line: 21 Column: 9

              
    def __init__(self):
        self._events = []
        self.shouldStop = False
        self._was_successful = True
        self.testsRun = 0


class Python26TestResult(LoggingBase):

            

Reported by Pylint.

Attribute name "testsRun" doesn't conform to snake_case naming style
Error

Line: 23 Column: 9

                      self._events = []
        self.shouldStop = False
        self._was_successful = True
        self.testsRun = 0


class Python26TestResult(LoggingBase):
    """A precisely python 2.6 like test result, that logs."""


            

Reported by Pylint.