The following issues were found

src/third_party/wiredtiger/test/suite/test_backup01.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 41 Column: 1

              import string
import time
from wtbackup import backup_base
import wiredtiger
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from helper import compare_files

# test_backup.py
#    Utilities: wt backup

            

Reported by Pylint.

Undefined variable 'wttest'
Error

Line: 191 Column: 5

                          self.objs[0][0], None, "checkpoint=two"))

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

            

Reported by Pylint.

Unused import glob
Error

Line: 35 Column: 1

              # [END_TAGS]
#

import glob
import os
import shutil
import string
import time
from wtbackup import backup_base

            

Reported by Pylint.

Unused import string
Error

Line: 38 Column: 1

              import glob
import os
import shutil
import string
import time
from wtbackup import backup_base
import wiredtiger
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from helper import compare_files

            

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" should be placed before "from wtbackup import backup_base"
Error

Line: 41 Column: 1

              import string
import time
from wtbackup import backup_base
import wiredtiger
from wtdataset import SimpleDataSet, ComplexDataSet, ComplexLSMDataSet
from helper import compare_files

# test_backup.py
#    Utilities: wt backup

            

Reported by Pylint.

Missing class docstring
Error

Line: 48 Column: 1

              # test_backup.py
#    Utilities: wt backup
# Test backup (both backup cursors and the wt backup command).
class test_backup(backup_base):
    dir='backup.dir'            # Backup directory name

    pfx = 'test_backup'
    objs = [
        ( 'file:' + pfx + '.1', SimpleDataSet, 0),

            

Reported by Pylint.

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

Line: 48 Column: 1

              # test_backup.py
#    Utilities: wt backup
# Test backup (both backup cursors and the wt backup command).
class test_backup(backup_base):
    dir='backup.dir'            # Backup directory name

    pfx = 'test_backup'
    objs = [
        ( 'file:' + pfx + '.1', SimpleDataSet, 0),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 64 Column: 5

                  ]

    # Test simple backup cursor open/close.
    def test_cursor_simple(self):
        cursor = self.session.open_cursor('backup:', None, None)
        cursor.close()

    # Test you can't have more than one backup cursor open at a time.
    def test_cursor_single(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 69 Column: 5

                      cursor.close()

    # Test you can't have more than one backup cursor open at a time.
    def test_cursor_single(self):
        cursor = self.session.open_cursor('backup:', None, None)
        msg = '/there is already a backup cursor open/'
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.open_cursor('backup:', None, None), msg)
        cursor.close()

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_checkpoint08.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 36 Column: 1

              # test_checkpoint08.py
# Test that the btree checkpoint is not skipped if there are obsolete pages.

import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 37 Column: 1

              # Test that the btree checkpoint is not skipped if there are obsolete pages.

import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 36 Column: 1

              # test_checkpoint08.py
# Test that the btree checkpoint is not skipped if there are obsolete pages.

import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'

            

Reported by Pylint.

Unused SimpleDataSet imported from wtdataset
Error

Line: 38 Column: 1

              
import wiredtiger, wttest
from wiredtiger import stat
from wtdataset import SimpleDataSet

class test_checkpoint08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,log=(enabled),statistics=(all)'
    session_config = 'isolation=snapshot'


            

Reported by Pylint.

Attribute 'uri1' defined outside __init__
Error

Line: 52 Column: 9

                      return val

    def test_checkpoint08(self):
        self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')

            

Reported by Pylint.

Attribute 'file1' defined outside __init__
Error

Line: 53 Column: 9

              
    def test_checkpoint08(self):
        self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')

            

Reported by Pylint.

Attribute 'uri2' defined outside __init__
Error

Line: 54 Column: 9

                  def test_checkpoint08(self):
        self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')


            

Reported by Pylint.

Attribute 'file2' defined outside __init__
Error

Line: 55 Column: 9

                      self.uri1 = 'table:ckpt08.1'
        self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')

        # Pin oldest and stable to timestamp 1.

            

Reported by Pylint.

Attribute 'hsfile' defined outside __init__
Error

Line: 56 Column: 9

                      self.file1 = 'file:ckpt08.1.wt'
        self.uri2 = 'table:ckpt08.2'
        self.file2 = 'file:ckpt08.2.wt'
        self.hsfile = 'file:WiredTigerHS.wt'
        self.session.create(self.uri1, 'key_format=i,value_format=i')
        self.session.create(self.uri2, 'key_format=i,value_format=i')

        # Pin oldest and stable to timestamp 1.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(1) +

            

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.

src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot04.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, shutil, threading, time
import wiredtiger, wttest
from wtbackup import backup_base
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_checkpoint_snapshot04.py

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 52 Column: 5

              
    scenarios = make_scenarios(target_backup)

    def conn_config(self):
        config = 'cache_size=200MB'
        return config

    def large_updates(self, uri, value, ds, nrows):
        # Update a large number of records.

            

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
import wiredtiger, wttest
from wtbackup import backup_base
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
import wiredtiger, wttest
from wtbackup import backup_base
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios


            

Reported by Pylint.

Unused import threading
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
import wiredtiger, wttest
from wtbackup import backup_base
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios


            

Reported by Pylint.

Unused variable 'k'
Error

Line: 71 Column: 13

                      session.begin_transaction()
        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)


            

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
import wiredtiger, wttest
from wtbackup import backup_base
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios


            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import fnmatch, os, shutil, threading, time
import wiredtiger, wttest
from wtbackup import backup_base
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

# test_checkpoint_snapshot04.py

            

Reported by Pylint.

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

Line: 38 Column: 1

              # test_checkpoint_snapshot04.py
#   Test utility dump of backup and original database when the transaction ids are
#   written to disk.
class test_checkpoint_snapshot04(backup_base):
    dir = 'backup.dir'

    # Create a table.
    uri = "table:test_checkpoint_snapshot04"
    nrows = 5000

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/gc/GC.cpp
19 issues
There is an unknown macro here somewhere. Configuration is required. If JS_PUBLIC_API is a macro then please configure it.
Error

Line: 6753

                  TlsContext.get()->heapState = prevState;
}

JS_PUBLIC_API(JS::HeapState)
JS::CurrentThreadHeapState()
{
    return TlsContext.get()->heapState;
}


            

Reported by Cppcheck.

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: 1215 Column: 28 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                      MOZ_ALWAYS_TRUE(tunables.setParameter(JSGC_MAX_NURSERY_BYTES, maxNurseryBytes, lock));
        setMaxMallocBytes(TuningDefaults::MaxMallocBytes, lock);

        const char* size = getenv("JSGC_MARK_STACK_LIMIT");
        if (size)
            setMarkStackLimit(atoi(size), lock);

        jitReleaseNumber = majorGCNumber + JIT_SCRIPT_RELEASE_TYPES_PERIOD;


            

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: 1226 Column: 28 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                  }

#ifdef JS_GC_ZEAL
    const char* zealSpec = getenv("JS_GC_ZEAL");
    if (zealSpec && zealSpec[0] && !parseAndSetZeal(zealSpec))
        return false;
#endif

    if (!InitTrace(*this))

            

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: 3904 Column: 21 CWE codes: 807 20
Suggestion: Check environment variables carefully before using them

                  if (!arenaLists(kind).isEmpty()) {
        isEmpty = false;
        size_t maxCells = 20;
        char *env = getenv("JS_GC_MAX_LIVE_CELLS");
        if (env && *env)
            maxCells = atol(env);
        for (Arena* current = arenaLists(kind).head(); current; current = current->next) {
            for (ArenaCellIterUnderGC i(current); !i.done(); i.next()) {
                TenuredCell* t = i.getCell();

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 1118 Column: 20 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

              
        const char* p = nullptr;
        if (isdigit(str[0])) {
            zeal = atoi(str);

            size_t offset = strspn(str, "0123456789");
            p = str + offset;
        } else {
            for (auto z : zealModes) {

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 1135 Column: 29 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                          if (!*p || *p == ';') {
                frequency = JS_DEFAULT_ZEAL_FREQ;
            } else if (*p == ',') {
                frequency = atoi(p + 1);
                foundFrequency = true;
            }
        }

        if (zeal < 0 || zeal > int(ZealMode::Limit) || frequency <= 0) {

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 1217 Column: 31 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

              
        const char* size = getenv("JSGC_MARK_STACK_LIMIT");
        if (size)
            setMarkStackLimit(atoi(size), lock);

        jitReleaseNumber = majorGCNumber + JIT_SCRIPT_RELEASE_TYPES_PERIOD;

        if (!nursery().init(maxNurseryBytes, lock))
            return false;

            

Reported by FlawFinder.

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

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

                  TenuredCell* dst = AllocRelocatedCell(zone, thingKind, thingSize);

    // Copy source cell contents to destination.
    memcpy(dst, src, thingSize);

    // Move any uid attached to the object.
    src->zone()->transferUniqueId(dst, src);

    if (IsObjectAllocKind(thingKind)) {

            

Reported by FlawFinder.

atol - Unless checked, the resulting number can exceed the expected range
Security

Line: 3906 Column: 24 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                      size_t maxCells = 20;
        char *env = getenv("JS_GC_MAX_LIVE_CELLS");
        if (env && *env)
            maxCells = atol(env);
        for (Arena* current = arenaLists(kind).head(); current; current = current->next) {
            for (ArenaCellIterUnderGC i(current); !i.done(); i.next()) {
                TenuredCell* t = i.getCell();
                MOZ_ASSERT(t->isMarkedAny(), "unmarked cells should have been finalized");
                if (++numLive <= maxCells) {

            

Reported by FlawFinder.

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

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

                          if (!entry)
                return;

            memcpy((void*)entry->bitmap, (void*)bitmap->bitmap, sizeof(bitmap->bitmap));
            if (!map.putNew(chunk, entry))
                return;
        }
    }


            

Reported by FlawFinder.

site_scons/mongo/install_actions.py
19 issues
Bad except clauses order (OSError is an ancestor class of _CopytreeError)
Error

Line: 72 Column: 20

                              errors.append((srcname, dstname, str(why)))
            # catch the _CopytreeError from the recursive copytree so that we can
            # continue with other files
            except _CopytreeError as err:
                errors.extend(err.args[0])
        try:
            shutil.copystat(src, dst)
        except SCons.Util.WinError:
            # can't copy file access times on Windows

            

Reported by Pylint.

Bad except clauses order (OSError is an ancestor class of _CopytreeError)
Error

Line: 72 Column: 20

                              errors.append((srcname, dstname, str(why)))
            # catch the _CopytreeError from the recursive copytree so that we can
            # continue with other files
            except _CopytreeError as err:
                errors.extend(err.args[0])
        try:
            shutil.copystat(src, dst)
        except SCons.Util.WinError:
            # can't copy file access times on Windows

            

Reported by Pylint.

Undefined variable 'SCons'
Error

Line: 76 Column: 16

                              errors.extend(err.args[0])
        try:
            shutil.copystat(src, dst)
        except SCons.Util.WinError:
            # can't copy file access times on Windows
            pass
        except OSError as why:
            errors.extend((src, dst, str(why)))
        if errors:

            

Reported by Pylint.

Undefined variable 'SCons'
Error

Line: 95 Column: 27

                      if os.path.isdir(source):
            if os.path.exists(dest):
                if not os.path.isdir(dest):
                    raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source)))
            else:
                parent = os.path.split(dest)[0]
                if not os.path.exists(parent):
                    os.makedirs(parent)
            _mongo_copytree(source, dest)

            

Reported by Pylint.

Undefined variable 'SCons'
Error

Line: 115 Column: 19

                      required symlinks."""

        if os.path.isdir(source):
            raise SCons.Errors.UserError("cannot install directory `%s' as a version library" % str(source) )
        else:
            # remove the link if it is already there
            try:
                os.remove(dest)
            except:

            

Reported by Pylint.

Undefined variable 'SCons'
Error

Line: 123 Column: 13

                          except:
                pass
            base_action(source, dest)
            SCons.tool.install.installShlibLinks(dest, source, env)

        return 0

    return (_mongo_copyFunc, _mongo_copyFuncVersionedLib)


            

Reported by Pylint.

No exception type(s) specified
Error

Line: 20 Column: 5

              def _hardlink(src, dst):
    try:
        os.link(src, dst)
    except:
        _copy(src, dst)

available_actions = {
    "copy" : _copy,
    "hardlink" : _hardlink,

            

Reported by Pylint.

XXX What about devices, sockets etc.?
Error

Line: 67 Column: 3

                                  _mongo_copytree(srcname, dstname, symlinks)
                else:
                    base_action(srcname, dstname)
                # XXX What about devices, sockets etc.?
            except (IOError, os.error) as why:
                errors.append((srcname, dstname, str(why)))
            # catch the _CopytreeError from the recursive copytree so that we can
            # continue with other files
            except _CopytreeError as err:

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 88 Column: 39

                  #
    # Functions doing the actual work of the Install Builder.
    #
    def _mongo_copyFunc(dest, source, env):
        """Install a source file or directory into a destination by copying,
        (including copying permission/mode bits)."""

        if os.path.isdir(source):
            if os.path.exists(dest):

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 120 Column: 13

                          # remove the link if it is already there
            try:
                os.remove(dest)
            except:
                pass
            base_action(source, dest)
            SCons.tool.install.installShlibLinks(dest, source, env)

        return 0

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_encrypt07.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):


            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 52 Column: 5

                      extlist.skip_if_missing = True
        extlist.extension('encryptors', self.sys_encrypt)

    def conn_config(self):
        return 'encryption=(name={0}{1}),'.format(
            self.sys_encrypt, self.sys_encrypt_args)

    def rot13(self, s):
        return codecs.encode(s, 'rot_13')

            

Reported by Pylint.

Unused import string
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

Unused import run
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

Unused import os
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 34 Column: 1

              #

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):


            

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, run, string, codecs)
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

standard import "import os, run, string, codecs" should be placed before "import os, run, string, codecs"
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

standard import "import os, run, string, codecs" should be placed before "import os, run, string, codecs"
Error

Line: 33 Column: 1

              #   Salvage encrypted databases
#

import os, run, string, codecs
import wiredtiger, wttest
import test_salvage

# Run the regular salvage test, but with encryption on
class test_encrypt07(test_salvage.test_salvage):

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_pack.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              #    Tests packing using public methods
#

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 33 Column: 1

              #    Tests packing using public methods
#

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'


            

Reported by Pylint.

Unused import sys
Error

Line: 34 Column: 1

              #

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'

    def dump_cursor(self, cursor, name):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 68 Column: 9

                      #self.dump_cursor(forw_idx, 'index')

        forw.set_key(1234)
        self.assertEquals(forw.search(), 0)
        got = forw.get_value()
        if nargs == 1:  # API does not return a list, we want one for comparing
            got = [got]
        self.assertEquals(got, v)


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 72 Column: 9

                      got = forw.get_value()
        if nargs == 1:  # API does not return a list, we want one for comparing
            got = [got]
        self.assertEquals(got, v)

        forw_idx.set_key(*v)
        self.assertEquals(forw_idx.search(), 0)
        self.assertEquals(forw_idx.get_value(), 1234)
        forw.close()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 75 Column: 9

                      self.assertEquals(got, v)

        forw_idx.set_key(*v)
        self.assertEquals(forw_idx.search(), 0)
        self.assertEquals(forw_idx.get_value(), 1234)
        forw.close()
        forw_idx.close()

    def test_packing(self):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 76 Column: 9

              
        forw_idx.set_key(*v)
        self.assertEquals(forw_idx.search(), 0)
        self.assertEquals(forw_idx.get_value(), 1234)
        forw.close()
        forw_idx.close()

    def test_packing(self):
        self.check('iii', 0, 101, -99)

            

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: 33 Column: 1

              #    Tests packing using public methods
#

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'


            

Reported by Pylint.

standard import "import re, sys" should be placed before "import wiredtiger, wttest"
Error

Line: 34 Column: 1

              #

import wiredtiger, wttest
import re, sys

class test_pack(wttest.WiredTigerTestCase):
    name = 'test_pack'

    def dump_cursor(self, cursor, name):

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_schema05.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest, run
from wtscenario import make_scenarios

# test_schema05.py
#    Test indices using a custom extractor.
class test_schema05(wttest.WiredTigerTestCase):

            

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 os
import wiredtiger, wttest, run
from wtscenario import make_scenarios

# test_schema05.py
#    Test indices using a custom extractor.

            

Reported by Pylint.

Unused import run
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest, run
from wtscenario import make_scenarios

# test_schema05.py
#    Test indices using a custom extractor.
class test_schema05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest, run
from wtscenario import make_scenarios

# test_schema05.py
#    Test indices using a custom extractor.
class test_schema05(wttest.WiredTigerTestCase):

            

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, run)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os
import wiredtiger, wttest, run
from wtscenario import make_scenarios

# test_schema05.py
#    Test indices using a custom extractor.
class test_schema05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

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

Line: 35 Column: 1

              
# test_schema05.py
#    Test indices using a custom extractor.
class test_schema05(wttest.WiredTigerTestCase):
    """
    Test indices with a custom extractor.
    This test is the same as test_schema04, except that rows
    are comma separated values (CSV) and we use a custom
    extractor to pull out the index keys.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 60 Column: 5

                      ('index-after', { 'create_index' : 2 }),
    ])

    def conn_extensions(self, extlist):
        extlist.skip_if_missing = True
        extlist.extension('extractors', 'csv')

    def create_indices(self):
        # Create self.nindices index files, each with a column from the CSV

            

Reported by Pylint.

Method could be a function
Error

Line: 60 Column: 5

                      ('index-after', { 'create_index' : 2 }),
    ])

    def conn_extensions(self, extlist):
        extlist.skip_if_missing = True
        extlist.extension('extractors', 'csv')

    def create_indices(self):
        # Create self.nindices index files, each with a column from the CSV

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 64 Column: 5

                      extlist.skip_if_missing = True
        extlist.extension('extractors', 'csv')

    def create_indices(self):
        # Create self.nindices index files, each with a column from the CSV
        for i in range(0, self.nindices):
            si = str(i)
            self.session.create('index:schema05:x' + si,
                                'key_format=S,columns=(key),'

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testscenarios-0.4/lib/testscenarios/testcase.py
19 issues
Unable to import 'testtools.testcase'
Error

Line: 24 Column: 1

              
import unittest

from testtools.testcase import clone_test_with_new_id

from testscenarios.scenarios import generate_scenarios

_doc = """
    When a test object which inherits from WithScenarios is run, and there is a

            

Reported by Pylint.

Super of 'WithScenarios' has no 'debug' member
Error

Line: 56 Column: 20

                          for test in generate_scenarios(self):
                test.debug()
        else:
            return super(WithScenarios, self).debug()

    def run(self, result=None):
        scenarios = self._get_scenarios()
        if scenarios:
            for test in generate_scenarios(self):

            

Reported by Pylint.

Super of 'WithScenarios' has no 'run' member
Error

Line: 65 Column: 20

                              test.run(result)
            return
        else:
            return super(WithScenarios, self).run(result)


class TestWithScenarios(WithScenarios, unittest.TestCase):
    __doc__ = """Unittest TestCase with support for declarative scenarios.
    """ + _doc

            

Reported by Pylint.

Unused clone_test_with_new_id imported from testtools.testcase
Error

Line: 24 Column: 1

              
import unittest

from testtools.testcase import clone_test_with_new_id

from testscenarios.scenarios import generate_scenarios

_doc = """
    When a test object which inherits from WithScenarios is run, and there is a

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #  testscenarios: extensions to python unittest to allow declarative
#  dependency injection ('scenarios') by tests.
#
# Copyright (c) 2009, Robert Collins <robertc@robertcollins.net>
# 
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.

            

Reported by Pylint.

Trailing whitespace
Error

Line: 5 Column: 2

              #  dependency injection ('scenarios') by tests.
#
# Copyright (c) 2009, Robert Collins <robertc@robertcollins.net>
# 
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
# 

            

Reported by Pylint.

Trailing whitespace
Error

Line: 10 Column: 2

              # license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
# license you chose for the specific language governing permissions and
# limitations under that license.

            

Reported by Pylint.

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

Line: 28 Column: 1

              
from testscenarios.scenarios import generate_scenarios

_doc = """
    When a test object which inherits from WithScenarios is run, and there is a
    non-empty scenarios attribute on the object, the test is multiplied by the
    run method into one test per scenario. For this to work reliably the
    WithScenarios.run method must not be overriden in a subclass (or overridden
    compatibly with WithScenarios).

            

Reported by Pylint.

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

Line: 36 Column: 1

                  compatibly with WithScenarios).
    """

class WithScenarios(object):
    __doc__ = """A mixin for TestCase with support for declarative scenarios.
    """ + _doc

    def _get_scenarios(self):
        return getattr(self, 'scenarios', None)

            

Reported by Pylint.

Method name "countTestCases" doesn't conform to snake_case naming style
Error

Line: 43 Column: 5

                  def _get_scenarios(self):
        return getattr(self, 'scenarios', None)

    def countTestCases(self):
        scenarios = self._get_scenarios()
        if not scenarios:
            return 1
        else:
            return len(scenarios)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_bug025.py
19 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

Unused copy_wiredtiger_home imported from helper
Error

Line: 29 Column: 1

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

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

Unused import shutil
Error

Line: 32 Column: 1

              from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.
# After a later access, we crash (null pointer access).
#

            

Reported by Pylint.

Unused variable 'pos'
Error

Line: 55 Column: 9

                      iname_suffix = iname[iname.rindex(':') + 1:]
        filename = 'test_bug025_' + iname_suffix + '.wti'
        self.close_conn()
        pos = os.path.getsize(filename) - 1024
        os.remove(filename)

        # We will get error output, but not always in the same API calls from run to run,
        # in particular the open connection doesn't always report the missing file, as
        # index files are usually lazily loaded. As long as the missing file is reported

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 72 Column: 20

                          # The insert fails, and the cursor remains open.
            try:
                cursor[newkey] = newval
            except Exception as e:
                self.pr('Exception in first access: ' + str(e))

            # The insert fails again.  Before the associated fix was made, the insert crashed.
            try:
                cursor[newkey] = newval    # point of crash

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 78 Column: 20

                          # The insert fails again.  Before the associated fix was made, the insert crashed.
            try:
                cursor[newkey] = newval    # point of crash
            except Exception as e:
                self.pr('Exception in second access: ' + str(e))

            cursor.close()

if __name__ == '__main__':

            

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: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import ComplexDataSet
import os, shutil

# test_bug025.py
# WT-7208: After a missing index is accessed, we return an error.

            

Reported by Pylint.