The following issues were found

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_content_type.py
14 issues
Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2008, 2012 testtools developers. See LICENSE for details.

from testtools import TestCase
from testtools.matchers import Equals, MatchesException, Raises
from testtools.content_type import (
    ContentType,
    JSON,
    UTF8_TEXT,
    )

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

                  )


class TestContentType(TestCase):

    def test___init___None_errors(self):
        raises_value_error = Raises(MatchesException(ValueError))
        self.assertThat(lambda:ContentType(None, None), raises_value_error)
        self.assertThat(lambda:ContentType(None, "traceback"),

            

Reported by Pylint.

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

Line: 14 Column: 5

              
class TestContentType(TestCase):

    def test___init___None_errors(self):
        raises_value_error = Raises(MatchesException(ValueError))
        self.assertThat(lambda:ContentType(None, None), raises_value_error)
        self.assertThat(lambda:ContentType(None, "traceback"),
            raises_value_error)
        self.assertThat(lambda:ContentType("text", None), raises_value_error)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 5

              
class TestContentType(TestCase):

    def test___init___None_errors(self):
        raises_value_error = Raises(MatchesException(ValueError))
        self.assertThat(lambda:ContentType(None, None), raises_value_error)
        self.assertThat(lambda:ContentType(None, "traceback"),
            raises_value_error)
        self.assertThat(lambda:ContentType("text", None), raises_value_error)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 5

                          raises_value_error)
        self.assertThat(lambda:ContentType("text", None), raises_value_error)

    def test___init___sets_ivars(self):
        content_type = ContentType("foo", "bar")
        self.assertEqual("foo", content_type.type)
        self.assertEqual("bar", content_type.subtype)
        self.assertEqual({}, content_type.parameters)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 5

                      self.assertEqual("bar", content_type.subtype)
        self.assertEqual({}, content_type.parameters)

    def test___init___with_parameters(self):
        content_type = ContentType("foo", "bar", {"quux": "thing"})
        self.assertEqual({"quux": "thing"}, content_type.parameters)

    def test___eq__(self):
        content_type1 = ContentType("foo", "bar", {"quux": "thing"})

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 5

                      content_type = ContentType("foo", "bar", {"quux": "thing"})
        self.assertEqual({"quux": "thing"}, content_type.parameters)

    def test___eq__(self):
        content_type1 = ContentType("foo", "bar", {"quux": "thing"})
        content_type2 = ContentType("foo", "bar", {"quux": "thing"})
        content_type3 = ContentType("foo", "bar", {"quux": "thing2"})
        self.assertTrue(content_type1.__eq__(content_type2))
        self.assertFalse(content_type1.__eq__(content_type3))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 38 Column: 5

                      self.assertTrue(content_type1.__eq__(content_type2))
        self.assertFalse(content_type1.__eq__(content_type3))

    def test_basic_repr(self):
        content_type = ContentType('text', 'plain')
        self.assertThat(repr(content_type), Equals('text/plain'))

    def test_extended_repr(self):
        content_type = ContentType(

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 42 Column: 5

                      content_type = ContentType('text', 'plain')
        self.assertThat(repr(content_type), Equals('text/plain'))

    def test_extended_repr(self):
        content_type = ContentType(
            'text', 'plain', {'foo': 'bar', 'baz': 'qux'})
        self.assertThat(
            repr(content_type), Equals('text/plain; baz="qux"; foo="bar"'))


            

Reported by Pylint.

Missing class docstring
Error

Line: 49 Column: 1

                          repr(content_type), Equals('text/plain; baz="qux"; foo="bar"'))


class TestBuiltinContentTypes(TestCase):

    def test_plain_text(self):
        # The UTF8_TEXT content type represents UTF-8 encoded text/plain.
        self.assertThat(UTF8_TEXT.type, Equals('text'))
        self.assertThat(UTF8_TEXT.subtype, Equals('plain'))

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs20.py
14 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 time, wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs20.py
# Ensure we never reconstruct a reverse modify update in the history store based on the onpage overflow value
class test_hs20(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 39 Column: 5

                  session_config = 'isolation=snapshot'

    # Return the k'th (0-based) key.
    def make_column_key(k):
        return k + 1
    def make_string_key(k):
        return str(k)

    key_format_values = [

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 41 Column: 5

                  # Return the k'th (0-based) key.
    def make_column_key(k):
        return k + 1
    def make_string_key(k):
        return str(k)

    key_format_values = [
        ('column', dict(key_format='r', make_key=make_column_key)),
        ('string-row', dict(key_format='S', make_key=make_string_key)),

            

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

# test_hs20.py
# Ensure we never reconstruct a reverse modify update in the history store based on the onpage overflow value
class test_hs20(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 (time, 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 time, wiredtiger, wttest
from wtscenario import make_scenarios

# test_hs20.py
# Ensure we never reconstruct a reverse modify update in the history store based on the onpage overflow value
class test_hs20(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Line too long (109/100)
Error

Line: 33 Column: 1

              from wtscenario import make_scenarios

# test_hs20.py
# Ensure we never reconstruct a reverse modify update in the history store based on the onpage overflow value
class test_hs20(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,eviction=(threads_max=1)'
    session_config = 'isolation=snapshot'

    # Return the k'th (0-based) key.

            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_hs20.py
# Ensure we never reconstruct a reverse modify update in the history store based on the onpage overflow value
class test_hs20(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,eviction=(threads_max=1)'
    session_config = 'isolation=snapshot'

    # Return the k'th (0-based) key.
    def make_column_key(k):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_hs20.py
# Ensure we never reconstruct a reverse modify update in the history store based on the onpage overflow value
class test_hs20(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=50MB,eviction=(threads_max=1)'
    session_config = 'isolation=snapshot'

    # Return the k'th (0-based) key.
    def make_column_key(k):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 39 Column: 5

                  session_config = 'isolation=snapshot'

    # Return the k'th (0-based) key.
    def make_column_key(k):
        return k + 1
    def make_string_key(k):
        return str(k)

    key_format_values = [

            

Reported by Pylint.

src/third_party/gperftools/dist/src/windows/nm-pdb.c
14 issues
printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 133 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                /* Display information about symbols, based on kind of symbol. */
  switch (module_info.SymType)  {
    case SymNone:
      printf(("No symbols available for the module.\n"));
      break;
    case SymExport:
      printf(("Loaded symbols: Exports\n"));
      break;
    case SymCoff:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 136 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("No symbols available for the module.\n"));
      break;
    case SymExport:
      printf(("Loaded symbols: Exports\n"));
      break;
    case SymCoff:
      printf(("Loaded symbols: COFF\n"));
      break;
    case SymCv:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 139 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: Exports\n"));
      break;
    case SymCoff:
      printf(("Loaded symbols: COFF\n"));
      break;
    case SymCv:
      printf(("Loaded symbols: CodeView\n"));
      break;
    case SymSym:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 142 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: COFF\n"));
      break;
    case SymCv:
      printf(("Loaded symbols: CodeView\n"));
      break;
    case SymSym:
      printf(("Loaded symbols: SYM\n"));
      break;
    case SymVirtual:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 145 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: CodeView\n"));
      break;
    case SymSym:
      printf(("Loaded symbols: SYM\n"));
      break;
    case SymVirtual:
      printf(("Loaded symbols: Virtual\n"));
      break;
    case SymPdb:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 148 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: SYM\n"));
      break;
    case SymVirtual:
      printf(("Loaded symbols: Virtual\n"));
      break;
    case SymPdb:
      printf(("Loaded symbols: PDB\n"));
      break;
    case SymDia:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 151 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: Virtual\n"));
      break;
    case SymPdb:
      printf(("Loaded symbols: PDB\n"));
      break;
    case SymDia:
      printf(("Loaded symbols: DIA\n"));
      break;
    case SymDeferred:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 154 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: PDB\n"));
      break;
    case SymDia:
      printf(("Loaded symbols: DIA\n"));
      break;
    case SymDeferred:
      printf(("Loaded symbols: Deferred\n"));  /* not actually loaded */
      break;
    default:

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 157 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: DIA\n"));
      break;
    case SymDeferred:
      printf(("Loaded symbols: Deferred\n"));  /* not actually loaded */
      break;
    default:
      printf(("Loaded symbols: Unknown format.\n"));
      break;
  }

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 160 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

                    printf(("Loaded symbols: Deferred\n"));  /* not actually loaded */
      break;
    default:
      printf(("Loaded symbols: Unknown format.\n"));
      break;
  }

  MaybePrint("Image name", module_info.ImageName);
  MaybePrint("Loaded image name", module_info.LoadedImageName);

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_prepare06.py
14 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename

            

Reported by Pylint.

Unused variable 'c'
Error

Line: 51 Column: 9

              
    def test_timestamp_api(self):
        self.session.create(self.uri, 'key_format={},value_format=i'.format(self.key_format))
        c = self.session.open_cursor(self.uri)

        # It is illegal to set the prepare timestamp older than the oldest
        # timestamp.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(20))
        self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(30))

            

Reported by Pylint.

String statement has no effect
Error

Line: 72 Column: 9

                      self.session.timestamp_transaction('durable_timestamp=' + self.timestamp_str(35))
        self.session.commit_transaction()

        '''
        Commented out for now: the system panics if we fail after preparing a transaction.

        # Check setting a prepared transaction timestamps earlier than the
        # oldest timestamp is invalid, if durable timestamp is less than the
        # stable timestamp.

            

Reported by Pylint.

String statement has no effect
Error

Line: 107 Column: 9

                          self.assertEqual(self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(40)), 0)
            self.session.rollback_transaction()

        '''
        Commented out for now: the system panics if we fail after preparing a transaction.

        # It is illegal to set a commit timestamp less than the prepare
        # timestamp of a transaction.
        self.session.begin_transaction()

            

Reported by Pylint.

String statement has no effect
Error

Line: 121 Column: 9

                          "/less than the prepare timestamp/")
        '''

        '''
        Commented out for now: the system panics if we fail after preparing a transaction.

        # It is legal to set a commit timestamp older than prepare timestamp of
        # a transaction with roundup_timestamps settings.
        self.session.begin_transaction('roundup_timestamps=(prepared=true)')

            

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

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename

            

Reported by Pylint.

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

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename

            

Reported by Pylint.

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

Line: 37 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    key_format_values = [

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    key_format_values = [

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_prepare02.py
14 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_prepare02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'

    def test_prepare_session_operations(self):

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 52 Column: 13

                      # The operations are listed in the same order as they are declared in the session structure.
        # WT_SESSION.close permitted.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.session.reconfigure(), msg)
        # WT_SESSION.strerror permitted, but currently broken in the Python API (WT-5399).
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.open_cursor("table:mytable", None), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.alter("table:mytable", "access_pattern_hint=random"), msg)

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 72 Column: 13

                      self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.rename("table:mytable", "table:mynewtable", None), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.session.reset(), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.salvage("table:mytable", None), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.truncate("table:mytable", None, None, None), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 82 Column: 13

                      self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda: self.session.verify("table:mytable", None), msg)
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.session.begin_transaction(), msg)
        # WT_SESSION.commit_transaction permitted, tested below.
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.session.prepare_transaction("prepare_timestamp=2a"), msg)
        # WT_SESSION.rollback_transaction permitted, tested below.
        self.session.timestamp_transaction("commit_timestamp=2b")

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 90 Column: 13

                      self.session.timestamp_transaction("commit_timestamp=2b")
        self.assertTimestampsEqual(self.session.query_timestamp('get=prepare'), '2a')
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.session.checkpoint(), msg)
        self.session.breakpoint()

        # Commit the transaction. Test that no "not permitted in a prepared transaction" error has
        # set a transaction error flag, that is, we should still be able to commit successfully.
        self.session.timestamp_transaction("commit_timestamp=2b")

            

Reported by Pylint.

Unused variable 'c1'
Error

Line: 101 Column: 9

              
        # Commit after prepare is permitted.
        self.session.begin_transaction()
        c1 = self.session.open_cursor("table:mytable", None)
        self.session.prepare_transaction("prepare_timestamp=2a")
        self.session.timestamp_transaction("commit_timestamp=2b")
        self.session.timestamp_transaction("durable_timestamp=2b")
        self.session.commit_transaction()


            

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 suite_subprocess import suite_subprocess"
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_prepare02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'

    def test_prepare_session_operations(self):

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_prepare02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'

    def test_prepare_session_operations(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 36 Column: 1

              from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_prepare02(wttest.WiredTigerTestCase, suite_subprocess):
    session_config = 'isolation=snapshot'

    def test_prepare_session_operations(self):

        # Test the session methods forbidden after the transaction is prepared.

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs12.py
14 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, time
from wtscenario import make_scenarios

# test_hs12.py
# Verify we can correctly append modifies to the end of string values
class test_hs12(wttest.WiredTigerTestCase):

            

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

# test_hs12.py
# Verify we can correctly append modifies to the end of string values
class test_hs12(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused variable 'valuebig'
Error

Line: 48 Column: 9

                      create_params = 'value_format=S,key_format={}'.format(self.key_format)
        value1 = 'abcedfghijklmnopqrstuvwxyz' * 5
        value2 = 'b' * 100
        valuebig = 'e' * 1000
        self.session.create(uri, create_params)
        cursor = self.session.open_cursor(uri)

        session2 = self.setUpSessionOpen(self.conn)
        session2.create(uri, create_params)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 74 Column: 9

                      session2.begin_transaction()
        cursor2.set_key(1)
        cursor2.search()
        self.assertEquals(cursor2.get_value(),  value1 + 'A')
        cursor2.set_key(2)
        cursor2.search()
        self.assertEquals(cursor2.get_value(),  'AB' + value1)
        session2.commit_transaction()


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 77 Column: 9

                      self.assertEquals(cursor2.get_value(),  value1 + 'A')
        cursor2.set_key(2)
        cursor2.search()
        self.assertEquals(cursor2.get_value(),  'AB' + value1)
        session2.commit_transaction()

        # Begin transaction on session 2 so it sees the current snap_min and snap_max
        session2.begin_transaction()


            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 96 Column: 9

                      # and evict the page.
        evict_cursor = self.session.open_cursor(uri, None, "debug=(release_evict)")
        evict_cursor.set_key(1)
        self.assertEquals(evict_cursor.search(), 0)
        evict_cursor.reset()

        # Try to find the value we saw earlier
        cursor2.set_key(1)
        cursor2.search()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 102 Column: 9

                      # Try to find the value we saw earlier
        cursor2.set_key(1)
        cursor2.search()
        self.assertEquals(cursor2.get_value(), value1 + 'A')
        cursor2.set_key(2)
        cursor2.search()
        self.assertEquals(cursor2.get_value(), 'AB' + value1)

if __name__ == '__main__':

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 105 Column: 9

                      self.assertEquals(cursor2.get_value(), value1 + 'A')
        cursor2.set_key(2)
        cursor2.search()
        self.assertEquals(cursor2.get_value(), 'AB' + value1)

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

            

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.

standard import "import wiredtiger, wttest, time" should be placed before "import wiredtiger, wttest, 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 wiredtiger, wttest, time
from wtscenario import make_scenarios

# test_hs12.py
# Verify we can correctly append modifies to the end of string values
class test_hs12(wttest.WiredTigerTestCase):

            

Reported by Pylint.

src/third_party/gperftools/dist/src/base/linuxthreads.cc
14 issues
strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

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

              
  /* Compute search paths for finding thread directories in /proc            */
  local_itoa(strrchr(strcpy(proc_self_task, "/proc/"), '\000'), ppid);
  strcpy(marker_name, proc_self_task);
  marker_path = marker_name + strlen(marker_name);
  strcat(proc_self_task, "/task/");
  proc_paths[0] = proc_self_task; /* /proc/$$/task/                          */
  proc_paths[1] = "/proc/";       /* /proc/                                  */
  proc_paths[2] = NULL;

            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 414 Column: 22 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                          if (pid && pid != clone_pid) {
              struct kernel_stat tmp_sb;
              char fname[entry->d_reclen + 48];
              strcat(strcat(strcpy(fname, "/proc/"),
                            entry->d_name), marker_path);

              /* Check if the marker is identical to the one we created      */
              if (sys_stat(fname, &tmp_sb) >= 0 &&
                  marker_sb.st_ino == tmp_sb.st_ino) {

            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 414 Column: 15 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                          if (pid && pid != clone_pid) {
              struct kernel_stat tmp_sb;
              char fname[entry->d_reclen + 48];
              strcat(strcat(strcpy(fname, "/proc/"),
                            entry->d_name), marker_path);

              /* Check if the marker is identical to the one we created      */
              if (sys_stat(fname, &tmp_sb) >= 0 &&
                  marker_sb.st_ino == tmp_sb.st_ino) {

            

Reported by FlawFinder.

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

Line: 238 Column: 3 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

               * function and permanently allocate the data on the stack.
 */
static void DirtyStack(size_t amount) {
  char buf[amount];
  memset(buf, 0, amount);
  sys_read(-1, buf, amount);
}



            

Reported by FlawFinder.

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

Line: 261 Column: 3 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 void ListerThread(struct ListerParams *args) {
  int                found_parent = 0;
  pid_t              clone_pid  = sys_gettid(), ppid = sys_getppid();
  char               proc_self_task[80], marker_name[48], *marker_path;
  const char         *proc_paths[3];
  const char *const  *proc_path = proc_paths;
  int                proc = -1, marker = -1, num_threads = 0;
  int                max_threads = 0, sig;
  struct kernel_stat marker_sb, proc_sb;

            

Reported by FlawFinder.

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

Line: 262 Column: 9 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

                int                found_parent = 0;
  pid_t              clone_pid  = sys_gettid(), ppid = sys_getppid();
  char               proc_self_task[80], marker_name[48], *marker_path;
  const char         *proc_paths[3];
  const char *const  *proc_path = proc_paths;
  int                proc = -1, marker = -1, num_threads = 0;
  int                max_threads = 0, sig;
  struct kernel_stat marker_sb, proc_sb;
  stack_t            altstack;

            

Reported by FlawFinder.

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

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

                }

  /* Compute search paths for finding thread directories in /proc            */
  local_itoa(strrchr(strcpy(proc_self_task, "/proc/"), '\000'), ppid);
  strcpy(marker_name, proc_self_task);
  marker_path = marker_name + strlen(marker_name);
  strcat(proc_self_task, "/task/");
  proc_paths[0] = proc_self_task; /* /proc/$$/task/                          */
  proc_paths[1] = "/proc/";       /* /proc/                                  */

            

Reported by FlawFinder.

strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 300 Column: 3 CWE codes: 120
Suggestion: Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused)

                local_itoa(strrchr(strcpy(proc_self_task, "/proc/"), '\000'), ppid);
  strcpy(marker_name, proc_self_task);
  marker_path = marker_name + strlen(marker_name);
  strcat(proc_self_task, "/task/");
  proc_paths[0] = proc_self_task; /* /proc/$$/task/                          */
  proc_paths[1] = "/proc/";       /* /proc/                                  */
  proc_paths[2] = NULL;

  /* Compute path for marker socket in /proc                                 */

            

Reported by FlawFinder.

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

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

                proc_paths[2] = NULL;

  /* Compute path for marker socket in /proc                                 */
  local_itoa(strcpy(marker_path, "/fd/") + 4, marker);
  if (sys_stat(marker_name, &marker_sb) < 0) {
    goto failure;
  }

  /* Catch signals on an alternate pre-allocated stack. This way, we can

            

Reported by FlawFinder.

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

Line: 374 Column: 9 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

                    sig_pids            = pids;
      for (;;) {
        struct KERNEL_DIRENT *entry;
        char buf[4096];
        ssize_t nbytes = GETDENTS(proc, (struct KERNEL_DIRENT *)buf,
                                         sizeof(buf));
        if (nbytes < 0)
          goto failure;
        else if (nbytes == 0) {

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_util07.py
14 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read

            

Reported by Pylint.

Unused import struct
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

Parameters differ from overridden 'close_conn' method
Error

Line: 51 Column: 5

                          cursor[key] = val
        cursor.close()

    def close_conn(self):
        """
        Close the connection if already open.
        """
        if self.conn != None:
            self.conn.close()

            

Reported by Pylint.

Parameters differ from overridden 'open_conn' method
Error

Line: 59 Column: 5

                          self.conn.close()
            self.conn = None

    def open_conn(self):
        """
        Open the connection if already closed.
        """
        if self.conn == None:
            self.conn = self.setUpConnectionOpen(".")

            

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, struct)
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, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

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

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_cursor04.py
14 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 wtscenario import make_scenarios

# test_base04.py
#     Cursor operations
class test_cursor04(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)
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 wtscenario import make_scenarios

# test_base04.py
#     Cursor operations
class test_cursor04(wttest.WiredTigerTestCase):

            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_base04.py
#     Cursor operations
class test_cursor04(wttest.WiredTigerTestCase):
    """
    Test cursor search and search_near
    """
    table_name1 = 'test_cursor04'
    nentries = 20

            

Reported by Pylint.

Method could be a function
Error

Line: 48 Column: 5

                      ('fix', dict(tablekind='fix', uri='table'))
    ])

    def config_string(self):
        """
        Return any additional configuration.
        This method may be overridden.
        """
        return ''

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 65 Column: 5

                          print('**** ERROR in session.create("' + name + '","' + args + '") ***** ')
            raise

    def create_session_and_cursor(self):
        tablearg = self.uri + ":" + self.table_name1
        if self.tablekind == 'row':
            keyformat = 'key_format=S'
        else:
            keyformat = 'key_format=r'  # record format

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 81 Column: 5

                      self.pr('creating cursor')
        return self.session.open_cursor(tablearg, None, None)

    def genkey(self, i):
        if self.tablekind == 'row':
            return 'key' + str(i).zfill(5)  # return key00001, key00002, etc.
        else:
            return self.recno(i+1)


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 82 Column: 9

                      return self.session.open_cursor(tablearg, None, None)

    def genkey(self, i):
        if self.tablekind == 'row':
            return 'key' + str(i).zfill(5)  # return key00001, key00002, etc.
        else:
            return self.recno(i+1)

    def genvalue(self, i):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 87 Column: 5

                      else:
            return self.recno(i+1)

    def genvalue(self, i):
        if self.tablekind == 'fix':
            return int(i & 0xff)
        else:
            return 'value' + str(i)


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 88 Column: 9

                          return self.recno(i+1)

    def genvalue(self, i):
        if self.tablekind == 'fix':
            return int(i & 0xff)
        else:
            return 'value' + str(i)

    def expect_either(self, cursor, lt, gt):

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_backup09.py
14 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

import os, shutil, stat
import helper, wiredtiger, wttest
from wtscenario import make_scenarios

class test_backup09(wttest.WiredTigerTestCase):
    # Have log writes go directly to the OS to avoid log_flush calls before
    # performing file copies not technically part of the backup cursor.

            

Reported by Pylint.

Unused import stat
Error

Line: 33 Column: 1

              #   Verify opening a backup cursor forces a log file switch.
#

import os, shutil, stat
import helper, wiredtiger, wttest
from wtscenario import make_scenarios

class test_backup09(wttest.WiredTigerTestCase):
    # Have log writes go directly to the OS to avoid log_flush calls before

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 64 Column: 13

                      cursor = self.session.open_cursor(self.uri)
        doc_id = 0

        for i in range(10):
            doc_id += 1
            cursor[doc_id] = doc_id

        if self.checkpoint:
            self.session.checkpoint()

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 115 Column: 22

              
        if self.all_log_files:
            doc_cnt = 0
            for key, val in cursor:
                doc_cnt += 1
                self.assertLessEqual(key, last_doc_in_data)

            self.assertEqual(doc_cnt, last_doc_in_data)
        else:

            

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

Line: 33 Column: 1

              #   Verify opening a backup cursor forces a log file switch.
#

import os, shutil, stat
import helper, wiredtiger, wttest
from wtscenario import make_scenarios

class test_backup09(wttest.WiredTigerTestCase):
    # Have log writes go directly to the OS to avoid log_flush calls before

            

Reported by Pylint.

Multiple imports on one line (helper, wiredtiger, wttest)
Error

Line: 34 Column: 1

              #

import os, shutil, stat
import helper, wiredtiger, wttest
from wtscenario import make_scenarios

class test_backup09(wttest.WiredTigerTestCase):
    # Have log writes go directly to the OS to avoid log_flush calls before
    # performing file copies not technically part of the backup cursor.

            

Reported by Pylint.

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

Line: 37 Column: 1

              import helper, wiredtiger, wttest
from wtscenario import make_scenarios

class test_backup09(wttest.WiredTigerTestCase):
    # Have log writes go directly to the OS to avoid log_flush calls before
    # performing file copies not technically part of the backup cursor.
    conn_config = 'config_base=false,create,' \
        'log=(enabled),transaction_sync=(enabled,method=none)'
    uri = 'table:coll1'

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              import helper, wiredtiger, wttest
from wtscenario import make_scenarios

class test_backup09(wttest.WiredTigerTestCase):
    # Have log writes go directly to the OS to avoid log_flush calls before
    # performing file copies not technically part of the backup cursor.
    conn_config = 'config_base=false,create,' \
        'log=(enabled),transaction_sync=(enabled,method=none)'
    uri = 'table:coll1'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 58 Column: 5

                  ]
    scenarios = make_scenarios(types)

    def data_and_start_backup(self):
        self.session.create(self.uri, 'key_format=i,value_format=i')

        cursor = self.session.open_cursor(self.uri)
        doc_id = 0


            

Reported by Pylint.