The following issues were found

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/mslink.py
50 issues
Attempted relative import beyond top-level package
Error

Line: 49 Column: 1

              import SCons.Tool.msvs
import SCons.Util

from .MSCommon import msvc_setup_env_once, msvc_exists

def pdbGenerator(env, target, source, for_signature):
    try:
        return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG']
    except (AttributeError, IndexError):

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 51 Column: 31

              
from .MSCommon import msvc_setup_env_once, msvc_exists

def pdbGenerator(env, target, source, for_signature):
    try:
        return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG']
    except (AttributeError, IndexError):
        return None


            

Reported by Pylint.

Unused argument 'for_signature'
Error

Line: 51 Column: 39

              
from .MSCommon import msvc_setup_env_once, msvc_exists

def pdbGenerator(env, target, source, for_signature):
    try:
        return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG']
    except (AttributeError, IndexError):
        return None


            

Reported by Pylint.

Unused argument 'env'
Error

Line: 51 Column: 18

              
from .MSCommon import msvc_setup_env_once, msvc_exists

def pdbGenerator(env, target, source, for_signature):
    try:
        return ['/PDB:%s' % target[0].attributes.pdb, '/DEBUG']
    except (AttributeError, IndexError):
        return None


            

Reported by Pylint.

Unused argument 'source'
Error

Line: 57 Column: 25

                  except (AttributeError, IndexError):
        return None

def _dllTargets(target, source, env, for_signature, paramtp):
    listCmd = []
    dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp)
    if dll: listCmd.append("/out:%s"%dll.get_string(for_signature))

    implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX')

            

Reported by Pylint.

Unused argument 'target'
Error

Line: 67 Column: 17

              
    return listCmd

def _dllSources(target, source, env, for_signature, paramtp):
    listCmd = []

    deffile = env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX")
    for src in source:
        # Check explicitly for a non-None deffile so that the __cmp__

            

Reported by Pylint.

Unused argument 'paramtp'
Error

Line: 67 Column: 53

              
    return listCmd

def _dllSources(target, source, env, for_signature, paramtp):
    listCmd = []

    deffile = env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX")
    for src in source:
        # Check explicitly for a non-None deffile so that the __cmp__

            

Reported by Pylint.

Unused variable 'suite'
Error

Line: 120 Column: 18

                                          '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp,
                            "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"))

    version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0'))
    if version_num >= 8.0 and \
            (env.get('WINDOWS_INSERT_MANIFEST', 0) or env.get('WINDOWS_EMBED_MANIFEST', 0)):
        # MSVC 8 and above automatically generate .manifest files that must be installed
        extratargets.append(
            env.ReplaceIxes(dll,

            

Reported by Pylint.

Unused variable 'suite'
Error

Line: 178 Column: 18

                  if not exe:
        raise SCons.Errors.UserError("An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX"))

    version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0'))
    if version_num >= 8.0 and \
            (env.get('WINDOWS_INSERT_MANIFEST', 0) or env.get('WINDOWS_EMBED_MANIFEST', 0)):
        # MSVC 8 and above automatically generate .manifest files that have to be installed
        extratargets.append(
            env.ReplaceIxes(exe,

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 217 Column: 35

              embedManifestExeAction = SCons.Action.Action('$MTEXECOM')
embedManifestDllAction = SCons.Action.Action('$MTSHLIBCOM')

def embedManifestDllCheck(target, source, env):
    """Function run by embedManifestDllCheckAction to check for existence of manifest
    and other conditions, and embed the manifest by calling embedManifestDllAction if so."""
    if env.get('WINDOWS_EMBED_MANIFEST', 0):
        manifestSrc = target[0].get_abspath() + '.manifest'
        if os.path.exists(manifestSrc):

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_rollback_to_stable14.py
50 issues
Unable to import 'wiredtiger'
Error

Line: 32 Column: 1

              import fnmatch, os, shutil, threading, time
from helper import simulate_crash_restart
from test_rollback_to_stable01 import test_rollback_to_stable_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wtthread import checkpoint_thread, op_thread

def mod_val(value, char, location, nbytes=1):

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 60 Column: 5

              
    scenarios = make_scenarios(key_format_values, prepare_values)

    def conn_config(self):
        config = 'cache_size=8MB,statistics=(all),statistics_log=(json,on_close,wait=1),log=(enabled=true),timing_stress_for_test=[history_store_checkpoint_delay]'
        return config

    def test_rollback_to_stable(self):
        nrows = 1500

            

Reported by Pylint.

Undefined variable 'wttest'
Error

Line: 364 Column: 5

                      self.ignoreStdoutPatternIfExists("oldest pinned transaction ID rolled back for eviction")

if __name__ == '__main__':
    wttest.run()

            

Reported by Pylint.

Unused import os
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 fnmatch, os, shutil, threading, time
from helper import simulate_crash_restart
from test_rollback_to_stable01 import test_rollback_to_stable_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import fnmatch
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 fnmatch, os, shutil, threading, time
from helper import simulate_crash_restart
from test_rollback_to_stable01 import test_rollback_to_stable_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import time
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 fnmatch, os, shutil, threading, time
from helper import simulate_crash_restart
from test_rollback_to_stable01 import test_rollback_to_stable_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import shutil
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 fnmatch, os, shutil, threading, time
from helper import simulate_crash_restart
from test_rollback_to_stable01 import test_rollback_to_stable_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused op_thread imported from wtthread
Error

Line: 35 Column: 1

              from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wtthread import checkpoint_thread, op_thread

def mod_val(value, char, location, nbytes=1):
    return value[0:location] + char + value[location+nbytes:]

def append_val(value, char):

            

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 (fnmatch, os, shutil, threading, time)
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 fnmatch, os, shutil, threading, time
from helper import simulate_crash_restart
from test_rollback_to_stable01 import test_rollback_to_stable_base
from wiredtiger import stat
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_config04.py
50 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, shutil
import wiredtiger, wttest
from wiredtiger import stat

# test_config04.py
#    Individually test config options
class test_config04(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import os, shutil
import wiredtiger, wttest
from wiredtiger import stat

# test_config04.py
#    Individually test config options
class test_config04(wttest.WiredTigerTestCase):
    table_name1 = 'test_config04'

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 47 Column: 35

              
    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

Unused argument 'dir'
Error

Line: 47 Column: 35

              
    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

Parameters differ from overridden 'setUpConnectionOpen' method
Error

Line: 47 Column: 5

              
    # Each test needs to set up its connection in its own way,
    # so override these methods to do nothing
    def setUpConnectionOpen(self, dir):
        return None

    def setUpSessionOpen(self, conn):
        return None


            

Reported by Pylint.

TODO: how do we verify that it was set?
Error

Line: 235 Column: 3

              
    def test_error_prefix(self):
        self.common_test('error_prefix="MyOwnPrefix"')
        # TODO: how do we verify that it was set?

    def test_logging(self):
        # Test variations on the log configuration.  The log test takes
        # a configuration string as the first arg and the directory pathname
        # to confirm the existence of the log file.  For now we're testing

            

Reported by Pylint.

TODO: how do we verify that it was set?
Error

Line: 266 Column: 3

              
    def test_multiprocess(self):
        self.common_test('multiprocess')
        # TODO: how do we verify that it was set?

    def test_session_max(self):
        # Note: There isn't any direct way to know that this was set,
        # but we'll have a separate functionality test to test for
        # this indirectly.

            

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 (os, shutil)
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 os, shutil
import wiredtiger, wttest
from wiredtiger import stat

# test_config04.py
#    Individually test config options

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, shutil
import wiredtiger, wttest
from wiredtiger import stat

# test_config04.py
#    Individually test config options
class test_config04(wttest.WiredTigerTestCase):

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/vm/opcode.py
50 issues
Unused import sys
Error

Line: 5 Column: 1

              
from __future__ import print_function
import re
import sys
from xml.sax.saxutils import escape

quoted_pat = re.compile(r"([^A-Za-z0-9]|^)'([^']+)'")
js_pat = re.compile(r"([^A-Za-z0-9]|^)(JS[A-Z0-9_\*]+)")
def codify(text):

            

Reported by Pylint.

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

Line: 16 Column: 40

              
    return text

space_star_space_pat = re.compile('^\s*\* ?', re.M)
def get_comment_body(comment):
    return re.sub(space_star_space_pat, '', comment).split('\n')

quote_pat = re.compile('"([^"]+)"')
str_pat = re.compile('js_([^_]+)_str')

            

Reported by Pylint.

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

Line: 16 Column: 37

              
    return text

space_star_space_pat = re.compile('^\s*\* ?', re.M)
def get_comment_body(comment):
    return re.sub(space_star_space_pat, '', comment).split('\n')

quote_pat = re.compile('"([^"]+)"')
str_pat = re.compile('js_([^_]+)_str')

            

Reported by Pylint.

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

Line: 49 Column: 32

                  index = []
    current_types = None
    category_name = ''
    category_pat = re.compile('\[([^\]]+)\]')
    for line in get_comment_body(comment):
        m = category_pat.search(line)
        if m:
            category_name = m.group(1)
            if category_name == 'Index':

            

Reported by Pylint.

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

Line: 49 Column: 42

                  index = []
    current_types = None
    category_name = ''
    category_pat = re.compile('\[([^\]]+)\]')
    for line in get_comment_body(comment):
        m = category_pat.search(line)
        if m:
            category_name = m.group(1)
            if category_name == 'Index':

            

Reported by Pylint.

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

Line: 49 Column: 37

                  index = []
    current_types = None
    category_name = ''
    category_pat = re.compile('\[([^\]]+)\]')
    for line in get_comment_body(comment):
        m = category_pat.search(line)
        if m:
            category_name = m.group(1)
            if category_name == 'Index':

            

Reported by Pylint.

Redefining built-in 'list'
Error

Line: 131 Column: 18

              
        self.sort_key = ''

def find_by_name(list, name):
    for (n, body) in list:
        if n == name:
            return body

    return None

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 157 Column: 10

              def format_desc(descs):
    current_type = ''
    desc = ''
    for (type, line) in descs:
        if type != current_type:
            if current_type:
                desc += '</{name}>\n'.format(name=current_type)
            current_type = type
            if type:

            

Reported by Pylint.

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

Line: 171 Column: 41

              
    return desc

tag_pat = re.compile('^\s*[A-Za-z]+:\s*|\s*$')
def get_tag_value(line):
    return re.sub(tag_pat, '', line)

def get_opcodes(dir):
    iter_pat = re.compile(r"/\*(.*?)\*/"  # either a documentation comment...

            

Reported by Pylint.

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

Line: 171 Column: 24

              
    return desc

tag_pat = re.compile('^\s*[A-Za-z]+:\s*|\s*$')
def get_tag_value(line):
    return re.sub(tag_pat, '', line)

def get_opcodes(dir):
    iter_pat = re.compile(r"/\*(.*?)\*/"  # either a documentation comment...

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_monkey.py
50 issues
Instance of 'TestObj' has no 'doesntexist' member
Error

Line: 62 Column: 27

                      # the patch.
        self.monkey_patcher.add_patch(self.test_object, 'doesntexist', 'value')
        self.monkey_patcher.patch()
        self.assertEquals(self.test_object.doesntexist, 'value')

    def test_restore_non_existing(self):
        # Restoring a value that didn't exist before the patch deletes the
        # value.
        self.monkey_patcher.add_patch(self.test_object, 'doesntexist', 'value')

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 36 Column: 9

              
        # We can't assert that all state is unchanged, but at least we can
        # check our test object.
        self.assertEquals(self.original_object.foo, self.test_object.foo)
        self.assertEquals(self.original_object.bar, self.test_object.bar)
        self.assertEquals(self.original_object.baz, self.test_object.baz)

    def test_construct_with_patches(self):
        # Constructing a 'MonkeyPatcher' with patches adds all of the given

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 37 Column: 9

                      # We can't assert that all state is unchanged, but at least we can
        # check our test object.
        self.assertEquals(self.original_object.foo, self.test_object.foo)
        self.assertEquals(self.original_object.bar, self.test_object.bar)
        self.assertEquals(self.original_object.baz, self.test_object.baz)

    def test_construct_with_patches(self):
        # Constructing a 'MonkeyPatcher' with patches adds all of the given
        # patches to the patch list.

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 38 Column: 9

                      # check our test object.
        self.assertEquals(self.original_object.foo, self.test_object.foo)
        self.assertEquals(self.original_object.bar, self.test_object.bar)
        self.assertEquals(self.original_object.baz, self.test_object.baz)

    def test_construct_with_patches(self):
        # Constructing a 'MonkeyPatcher' with patches adds all of the given
        # patches to the patch list.
        patcher = MonkeyPatcher((self.test_object, 'foo', 'haha'),

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 46 Column: 9

                      patcher = MonkeyPatcher((self.test_object, 'foo', 'haha'),
                                (self.test_object, 'bar', 'hehe'))
        patcher.patch()
        self.assertEquals('haha', self.test_object.foo)
        self.assertEquals('hehe', self.test_object.bar)
        self.assertEquals(self.original_object.baz, self.test_object.baz)

    def test_patch_existing(self):
        # Patching an attribute that exists sets it to the value defined in the

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 47 Column: 9

                                              (self.test_object, 'bar', 'hehe'))
        patcher.patch()
        self.assertEquals('haha', self.test_object.foo)
        self.assertEquals('hehe', self.test_object.bar)
        self.assertEquals(self.original_object.baz, self.test_object.baz)

    def test_patch_existing(self):
        # Patching an attribute that exists sets it to the value defined in the
        # patch.

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 48 Column: 9

                      patcher.patch()
        self.assertEquals('haha', self.test_object.foo)
        self.assertEquals('hehe', self.test_object.bar)
        self.assertEquals(self.original_object.baz, self.test_object.baz)

    def test_patch_existing(self):
        # Patching an attribute that exists sets it to the value defined in the
        # patch.
        self.monkey_patcher.add_patch(self.test_object, 'foo', 'haha')

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 55 Column: 9

                      # patch.
        self.monkey_patcher.add_patch(self.test_object, 'foo', 'haha')
        self.monkey_patcher.patch()
        self.assertEquals(self.test_object.foo, 'haha')

    def test_patch_non_existing(self):
        # Patching a non-existing attribute sets it to the value defined in
        # the patch.
        self.monkey_patcher.add_patch(self.test_object, 'doesntexist', 'value')

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 62 Column: 9

                      # the patch.
        self.monkey_patcher.add_patch(self.test_object, 'doesntexist', 'value')
        self.monkey_patcher.patch()
        self.assertEquals(self.test_object.doesntexist, 'value')

    def test_restore_non_existing(self):
        # Restoring a value that didn't exist before the patch deletes the
        # value.
        self.monkey_patcher.add_patch(self.test_object, 'doesntexist', 'value')

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 79 Column: 9

                      self.monkey_patcher.add_patch(self.test_object, 'foo', 'blah')
        self.monkey_patcher.add_patch(self.test_object, 'foo', 'BLAH')
        self.monkey_patcher.patch()
        self.assertEquals(self.test_object.foo, 'BLAH')
        self.monkey_patcher.restore()
        self.assertEquals(self.test_object.foo, self.original_object.foo)

    def test_restore_twice_is_a_no_op(self):
        # Restoring an already-restored monkey patch is a no-op.

            

Reported by Pylint.

site_scons/site_tools/icecream.py
50 issues
Unable to import 'SCons'
Error

Line: 30 Column: 1

              
from pkg_resources import parse_version

import SCons

_icecream_version_min = parse_version("1.1rc2")
_icecream_version_gcc_remote_cpp = parse_version("1.2")



            

Reported by Pylint.

Unused argument 'source'
Error

Line: 52 Column: 35

                      return self.result


def icecc_create_env(env, target, source, for_signature):
    # Safe to assume unix here because icecream only works on Unix
    mkdir = "mkdir -p ${TARGET.dir}"

    # Create the env, use awk to get just the tarball name and we store it in
    # the shell variable $ICECC_VERSION_TMP so the subsequent mv command and

            

Reported by Pylint.

Unused argument 'for_signature'
Error

Line: 52 Column: 43

                      return self.result


def icecc_create_env(env, target, source, for_signature):
    # Safe to assume unix here because icecream only works on Unix
    mkdir = "mkdir -p ${TARGET.dir}"

    # Create the env, use awk to get just the tarball name and we store it in
    # the shell variable $ICECC_VERSION_TMP so the subsequent mv command and

            

Reported by Pylint.

TODO: It would be a little more elegant if things in
Error

Line: 61 Column: 3

                  # store it in a known location. Add any files requested from the user environment.
    create_env = "ICECC_VERSION_TMP=$$(${SOURCES[0]} --$ICECC_COMPILER_TYPE ${SOURCES[1]} ${SOURCES[2]}"

    # TODO: It would be a little more elegant if things in
    # ICECC_CREATE_ENV_ADDFILES were handled as sources, because we
    # would get automatic dependency tracking. However, there are some
    # wrinkles around the mapped case so we have opted to leave it as
    # just interpreting the env for now.
    for addfile in env.get('ICECC_CREATE_ENV_ADDFILES', []):

            

Reported by Pylint.

Using an f-string that does not have any interpolated variables
Error

Line: 77 Column: 33

                              env.Depends(target, addfile[1])
            else:
                raise Exception(f"Found incorrect icecream addfile format: {str(addfile)}" +
                                f"\ntuple must two elements of the form" +
                                f"\n('chroot dest path', 'source file path')")
        else:
            try:
                create_env += f" --addfile {env.File(addfile).srcnode().abspath}"
                env.Depends(target, addfile)

            

Reported by Pylint.

Using an f-string that does not have any interpolated variables
Error

Line: 78 Column: 33

                          else:
                raise Exception(f"Found incorrect icecream addfile format: {str(addfile)}" +
                                f"\ntuple must two elements of the form" +
                                f"\n('chroot dest path', 'source file path')")
        else:
            try:
                create_env += f" --addfile {env.File(addfile).srcnode().abspath}"
                env.Depends(target, addfile)
            except:

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 89 Column: 17

                              # https://github.com/icecc/icecream/blob/10b9468f5bd30a0fdb058901e91e7a29f1bfbd42/client/icecc-create-env.in#L534
                # which cuts out the two files based off the equals sign and
                # starting slash of the second file
                raise Exception(f"Found incorrect icecream addfile format: {type(addfile)}" +
                                f"\nvalue provided cannot be converted to a file path")

    create_env += " | awk '/^creating .*\\.tar\\.gz/ { print $$2 }')"

    # Simply move our tarball to the expected locale.

            

Reported by Pylint.

Using an f-string that does not have any interpolated variables
Error

Line: 90 Column: 33

                              # which cuts out the two files based off the equals sign and
                # starting slash of the second file
                raise Exception(f"Found incorrect icecream addfile format: {type(addfile)}" +
                                f"\nvalue provided cannot be converted to a file path")

    create_env += " | awk '/^creating .*\\.tar\\.gz/ { print $$2 }')"

    # Simply move our tarball to the expected locale.
    mv = "mv $$ICECC_VERSION_TMP $TARGET"

            

Reported by Pylint.

TODO: This all happens SCons side now. Should we just use python to
Error

Line: 157 Column: 3

                          # Use curl / wget to download the toolchain because SCons (and ninja)
            # are better at running shell commands than Python functions.
            #
            # TODO: This all happens SCons side now. Should we just use python to
            # fetch instead?
            curl = setupEnv.WhereIs("curl")
            wget = setupEnv.WhereIs("wget")

            if curl:

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 308 Column: 40

                      )
    )[0]

    def icecc_version_string_generator(source, target, env, for_signature):
        if for_signature:
            return icecc_version_string_value.get_csig()
        return icecc_version_string_value.read()

    # Set the values that will be interpolated into the run-icecc script.

            

Reported by Pylint.

src/third_party/wiredtiger/test/wt_hang_analyzer/wt_hang_analyzer.py
49 issues
Unable to import 'win32event'
Error

Line: 50 Column: 5

              _IS_WINDOWS = (sys.platform == "win32")

if _IS_WINDOWS:
    import win32event
    import win32api

"""
Helper class to read output of a subprocess.


            

Reported by Pylint.

Unable to import 'win32api'
Error

Line: 51 Column: 5

              
if _IS_WINDOWS:
    import win32event
    import win32api

"""
Helper class to read output of a subprocess.

Used to avoid deadlocks from the pipe buffer filling up and blocking the subprocess while it's

            

Reported by Pylint.

Unable to import 'win32com.shell'
Error

Line: 196 Column: 9

                      cdb = spawn.find_executable(debugger)
        if cdb is not None:
            return cdb
        from win32com.shell import shell, shellcon

        # Cygwin via sshd does not expose the normal environment variables.
        # Use the shell api to get the variable instead.
        root_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_PROGRAM_FILESX86, None, 0)


            

Reported by Pylint.

Unused import re
Error

Line: 42 Column: 1

              2. WT-6919 - Windows cannot find the debug symbols.
"""

import csv, glob, itertools, logging, re, tempfile, traceback
import os, sys, platform, signal, subprocess, threading, time
from distutils import spawn
from io import BytesIO, TextIOWrapper
from optparse import OptionParser
_IS_WINDOWS = (sys.platform == "win32")

            

Reported by Pylint.

Unused import time
Error

Line: 43 Column: 1

              """

import csv, glob, itertools, logging, re, tempfile, traceback
import os, sys, platform, signal, subprocess, threading, time
from distutils import spawn
from io import BytesIO, TextIOWrapper
from optparse import OptionParser
_IS_WINDOWS = (sys.platform == "win32")


            

Reported by Pylint.

Unused import signal
Error

Line: 43 Column: 1

              """

import csv, glob, itertools, logging, re, tempfile, traceback
import os, sys, platform, signal, subprocess, threading, time
from distutils import spawn
from io import BytesIO, TextIOWrapper
from optparse import OptionParser
_IS_WINDOWS = (sys.platform == "win32")


            

Reported by Pylint.

Uses of a deprecated module 'optparse'
Error

Line: 46 Column: 1

              import os, sys, platform, signal, subprocess, threading, time
from distutils import spawn
from io import BytesIO, TextIOWrapper
from optparse import OptionParser
_IS_WINDOWS = (sys.platform == "win32")

if _IS_WINDOWS:
    import win32event
    import win32api

            

Reported by Pylint.

Unused import win32event
Error

Line: 50 Column: 5

              _IS_WINDOWS = (sys.platform == "win32")

if _IS_WINDOWS:
    import win32event
    import win32api

"""
Helper class to read output of a subprocess.


            

Reported by Pylint.

Unused import win32api
Error

Line: 51 Column: 5

              
if _IS_WINDOWS:
    import win32event
    import win32api

"""
Helper class to read output of a subprocess.

Used to avoid deadlocks from the pipe buffer filling up and blocking the subprocess while it's

            

Reported by Pylint.

String statement has no effect
Error

Line: 53 Column: 1

                  import win32event
    import win32api

"""
Helper class to read output of a subprocess.

Used to avoid deadlocks from the pipe buffer filling up and blocking the subprocess while it's
being waited on.
"""

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_rollback_to_stable01.py
49 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wiredtiger import stat, wiredtiger_strerror, WiredTigerError, WT_ROLLBACK
from wtscenario import make_scenarios
from time import sleep


            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wiredtiger import stat, wiredtiger_strerror, WiredTigerError, WT_ROLLBACK
from wtscenario import make_scenarios
from time import sleep

# test_rollback_to_stable01.py
# Shared base class used by rollback to stable tests.

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 178 Column: 5

              
    scenarios = make_scenarios(key_format_values, in_memory_values, prepare_values)

    def conn_config(self):
        config = 'cache_size=50MB,statistics=(all)'
        if self.in_memory:
            config += ',in_memory=true'
        else:
            config += ',log=(enabled),in_memory=false'

            

Reported by Pylint.

Unused import time
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 time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wiredtiger import stat, wiredtiger_strerror, WiredTigerError, WT_ROLLBACK
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused copy_wiredtiger_home imported from helper
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wiredtiger import stat, wiredtiger_strerror, WiredTigerError, WT_ROLLBACK
from wtscenario import make_scenarios
from time import sleep

            

Reported by Pylint.

Unused argument 'ds'
Error

Line: 90 Column: 42

                              session.rollback_transaction()
            raise(e)

    def large_modifies(self, uri, value, ds, location, nbytes, nrows, prepare, commit_ts):
        # Load a slight modification.
        session = self.session
        try:
            cursor = session.open_cursor(uri)
            session.begin_transaction()

            

Reported by Pylint.

Unused argument 'ds'
Error

Line: 117 Column: 34

                              session.rollback_transaction()
            raise(e)

    def large_removes(self, uri, ds, nrows, prepare, commit_ts):
        # Remove a large number of records.
        session = self.session
        try:
            cursor = session.open_cursor(uri)
            for i in range(1, nrows + 1):

            

Reported by Pylint.

Unused variable 'k'
Error

Line: 150 Column: 13

                          session.begin_transaction('read_timestamp=' + self.timestamp_str(read_ts))
        cursor = session.open_cursor(uri)
        count = 0
        for k, v in cursor:
            self.assertEqual(v, check_value)
            count += 1
        session.commit_transaction()
        self.assertEqual(count, nrows)
        cursor.close()

            

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.

third party import "import wiredtiger, wttest" should be placed before "from helper import copy_wiredtiger_home"
Error

Line: 31 Column: 1

              
import time
from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wiredtiger import stat, wiredtiger_strerror, WiredTigerError, WT_ROLLBACK
from wtscenario import make_scenarios
from time import sleep


            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/multiversion.py
49 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              #

from runner import *
from wiredtiger import *
from workgen import *

def show(tname, s):
    print('')
    print('<><><><> ' + tname + ' <><><><>')

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 32 Column: 1

              
from runner import *
from wiredtiger import *
from workgen import *

def show(tname, s):
    print('')
    print('<><><><> ' + tname + ' <><><><>')
    c = s.open_cursor(tname, None)

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 52 Column: 11

                  else:
        return ''

context = Context()
context.parser.add_argument("--release", dest="release", type=str,
  choices=["4.2", "4.4"], help="The WiredTiger version")
context.initialize()   # parse the arguments.
conn = context.wiredtiger_open("create,cache_size=1G," + create_compat_config(context.args))


            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 62 Column: 56

              tname = 'table:simple'
s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 62 Column: 7

              tname = 'table:simple'
s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 62 Column: 17

              tname = 'table:simple'
s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)


            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 62 Column: 38

              tname = 'table:simple'
s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)


            

Reported by Pylint.

Undefined variable 'Value'
Error

Line: 62 Column: 80

              tname = 'table:simple'
s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)


            

Reported by Pylint.

Undefined variable 'Key'
Error

Line: 62 Column: 52

              tname = 'table:simple'
s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)


            

Reported by Pylint.

Undefined variable 'Thread'
Error

Line: 63 Column: 10

              s.create(tname, 'key_format=S,value_format=S')

ops = Operation(Operation.OP_INSERT, Table(tname), Key(Key.KEYGEN_APPEND, 10), Value(40))
thread = Thread(ops)
workload = Workload(context, thread)
workload.run(conn)
show(tname, s)

thread = Thread(ops * 5)

            

Reported by Pylint.

src/third_party/pcre-8.42/pcregrep.c
49 issues
Resource leak: in
Error

Line: 2347 CWE codes: 775

                if (!silent)
    fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pathname,
      strerror(errno));
  return 2;
  }

/* Now grep the file */

rc = pcregrep(handle, frtype, pathname, (filenames > FN_DEFAULT ||

            

Reported by Cppcheck.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 1641 Column: 11 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                                pcregrep_exit(2);
          }
          endptr = ptr;
          strcpy(endptr, jfriedl_prefix); endptr += strlen(jfriedl_prefix);
          for (i = 0; i < jfriedl_XT; i++) {
                  strncpy(endptr, orig,  length);
                  endptr += length;
          }
          strcpy(endptr, jfriedl_postfix); endptr += strlen(jfriedl_postfix);

            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 1646 Column: 11 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

                                strncpy(endptr, orig,  length);
                  endptr += length;
          }
          strcpy(endptr, jfriedl_postfix); endptr += strlen(jfriedl_postfix);
          length = newlen;
      }

      if (gettimeofday(&start_time, &dummy) != 0)
              perror("bad gettimeofday");

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 2259 Column: 7 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

                      rc = 2;
        break;
        }
      sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile);
      frc = grep_or_recurse(buffer, dir_recurse, FALSE);
      if (frc > 1) rc = frc;
       else if (frc == 0 && rc == 1) rc = 0;
      }


            

Reported by FlawFinder.

getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 3036 Column: 12 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

              
if (locale == NULL)
  {
  locale = getenv("LC_ALL");
  locale_from = "LCC_ALL";
  }

if (locale == NULL)
  {

            

Reported by FlawFinder.

getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 3042 Column: 12 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

              
if (locale == NULL)
  {
  locale = getenv("LC_CTYPE");
  locale_from = "LC_CTYPE";
  }

/* If a locale is set, use it to generate the tables the PCRE needs. Otherwise,
pcretables==NULL, which causes the use of default tables. */

            

Reported by FlawFinder.

getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 3074 Column: 16 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                  }
  if (do_colour)
    {
    char *cs = getenv("PCREGREP_COLOUR");
    if (cs == NULL) cs = getenv("PCREGREP_COLOR");
    if (cs != NULL) colour_string = cs;
    }
  }


            

Reported by FlawFinder.

getenv - Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once
Security

Line: 3075 Column: 26 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                if (do_colour)
    {
    char *cs = getenv("PCREGREP_COLOUR");
    if (cs == NULL) cs = getenv("PCREGREP_COLOR");
    if (cs != NULL) colour_string = cs;
    }
  }

/* Interpret the newline type; the default settings are Unix-like. */

            

Reported by FlawFinder.

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

Line: 287 Column: 14 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

              static patstr **incexlist[4] = { &include_patterns, &exclude_patterns,
                                 &include_dir_patterns, &exclude_dir_patterns };

static const char *incexname[4] = { "--include", "--exclude",
                                    "--include-dir", "--exclude-dir" };

/* Structure for options and list of them */

enum { OP_NODATA, OP_STRING, OP_OP_STRING, OP_NUMBER, OP_LONGNUMBER,

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 706 Column: 1 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                fprintf(stderr, "pcregrep: malloc failed\n");
  pcregrep_exit(2);
  }
memcpy(pattern, filename, len);
memcpy(&(pattern[len]), "\\*", 3);
dir->handle = FindFirstFile(pattern, &(dir->data));
if (dir->handle != INVALID_HANDLE_VALUE)
  {
  free(pattern);

            

Reported by FlawFinder.