The following issues were found

src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/tests/test_subunit_filter.py
42 issues
Unable to import 'testtools'
Error

Line: 26 Column: 1

              from subunit import iso8601
import unittest

from testtools import TestCase
from testtools.compat import _b, BytesIO
from testtools.testresult.doubles import ExtendedTestResult, StreamResult

import subunit
from subunit.test_results import make_tag_filter, TestResultFilter

            

Reported by Pylint.

Unable to import 'testtools.compat'
Error

Line: 27 Column: 1

              import unittest

from testtools import TestCase
from testtools.compat import _b, BytesIO
from testtools.testresult.doubles import ExtendedTestResult, StreamResult

import subunit
from subunit.test_results import make_tag_filter, TestResultFilter
from subunit import ByteStreamToStreamResult, StreamResultToBytes

            

Reported by Pylint.

Unable to import 'testtools.testresult.doubles'
Error

Line: 28 Column: 1

              
from testtools import TestCase
from testtools.compat import _b, BytesIO
from testtools.testresult.doubles import ExtendedTestResult, StreamResult

import subunit
from subunit.test_results import make_tag_filter, TestResultFilter
from subunit import ByteStreamToStreamResult, StreamResultToBytes


            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 91 Column: 35

                          result, filter_success=False, filter_predicate=tag_filter)
        self.run_tests(result_filter)
        tests_included = [
            event[1] for event in result._events if event[0] == 'startTest']
        tests_expected = list(map(
            subunit.RemotedTestCase,
            ['passed', 'error', 'skipped', 'todo']))
        self.assertEquals(tests_expected, tests_included)


            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 116 Column: 13

                           ('addSuccess', foo),
             ('stopTest', foo),
             ],
            result._events)

    def test_exclude_errors(self):
        filtered_result = unittest.TestResult()
        result_filter = TestResultFilter(filtered_result, filter_error=True)
        self.run_tests(result_filter)

            

Reported by Pylint.

Attribute 'maxDiff' defined outside __init__
Error

Line: 234 Column: 9

                      result_filter = TestResultFilter(result)
        self.run_tests(result_filter, subunit_stream)
        foo = subunit.RemotedTestCase('foo')
        self.maxDiff = None
        self.assertEqual(
            [('time', date_a),
             ('time', date_b),
             ('startTest', foo),
             ('addError', foo, {}),

            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 241 Column: 33

                           ('startTest', foo),
             ('addError', foo, {}),
             ('stopTest', foo),
             ('time', date_c)], result._events)

    def test_time_passes_through_filtered_tests(self):
        # Passing a subunit stream through TestResultFilter preserves 'time'
        # directives even if a specific test is filtered out.
        date_a = datetime(year=2000, month=1, day=1, tzinfo=iso8601.UTC)

            

Reported by Pylint.

Unused variable 'foo'
Error

Line: 261 Column: 9

                      result_filter.startTestRun()
        self.run_tests(result_filter, subunit_stream)
        result_filter.stopTestRun()
        foo = subunit.RemotedTestCase('foo')
        self.maxDiff = None
        self.assertEqual(
            [('startTestRun',),
             ('time', date_a),
             ('time', date_c),

            

Reported by Pylint.

Attribute 'maxDiff' defined outside __init__
Error

Line: 262 Column: 9

                      self.run_tests(result_filter, subunit_stream)
        result_filter.stopTestRun()
        foo = subunit.RemotedTestCase('foo')
        self.maxDiff = None
        self.assertEqual(
            [('startTestRun',),
             ('time', date_a),
             ('time', date_c),
             ('stopTestRun',),], result._events)

            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 267 Column: 34

                          [('startTestRun',),
             ('time', date_a),
             ('time', date_c),
             ('stopTestRun',),], result._events)

    def test_skip_preserved(self):
        subunit_stream = _b('\n'.join([
            "test: foo",
            "skip: foo",

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/tests/test_tap2subunit.py
42 issues
Unable to import 'testtools'
Error

Line: 22 Column: 1

              from io import BytesIO, StringIO
import unittest

from testtools import TestCase
from testtools.compat import _u
from testtools.testresult.doubles import StreamResult

import subunit


            

Reported by Pylint.

Unable to import 'testtools.compat'
Error

Line: 23 Column: 1

              import unittest

from testtools import TestCase
from testtools.compat import _u
from testtools.testresult.doubles import StreamResult

import subunit

UTF8_TEXT = 'text/plain; charset=UTF8'

            

Reported by Pylint.

Unable to import 'testtools.testresult.doubles'
Error

Line: 24 Column: 1

              
from testtools import TestCase
from testtools.compat import _u
from testtools.testresult.doubles import StreamResult

import subunit

UTF8_TEXT = 'text/plain; charset=UTF8'


            

Reported by Pylint.

Unused import unittest
Error

Line: 20 Column: 1

              """Tests for TAP2SubUnit."""

from io import BytesIO, StringIO
import unittest

from testtools import TestCase
from testtools.compat import _u
from testtools.testresult.doubles import StreamResult


            

Reported by Pylint.

ok # TODO
Error

Line: 151 Column: 8

              
    def test_ok_TODO_xfail(self):
        # A file
        # ok # TODO
        # results in a xfail test with name 'test 1'
        self.tap.write(_u("ok # TODO\n"))
        self.tap.seek(0)
        result = subunit.TAP2SubUnit(self.tap, self.subunit)
        self.assertEqual(0, result)

            

Reported by Pylint.

ok # TODO Not done yet
Error

Line: 162 Column: 8

              
    def test_ok_TODO_xfail_comment(self):
        # A file
        # ok # TODO Not done yet
        # results in a xfail test with name 'test 1' and a log of Not done yet
        self.tap.write(_u("ok # TODO Not done yet\n"))
        self.tap.seek(0)
        result = subunit.TAP2SubUnit(self.tap, self.subunit)
        self.assertEqual(0, result)

            

Reported by Pylint.

not ok 1 - a fail but # TODO but is TODO
Error

Line: 326 Column: 27

              
    def test_todo_and_skip(self):
        # A file
        # not ok 1 - a fail but # TODO but is TODO
        # not ok 2 - another fail # SKIP instead
        # results in two tests, numbered and commented.
        self.tap.write(_u("not ok 1 - a fail but # TODO but is TODO\n"))
        self.tap.write(_u("not ok 2 - another fail # SKIP instead\n"))
        self.tap.seek(0)

            

Reported by Pylint.

Access to a protected member _events of a client class
Error

Line: 387 Column: 34

                      self.subunit.seek(0)
        eventstream = StreamResult()
        subunit.ByteStreamToStreamResult(self.subunit).run(eventstream)
        self.assertEqual(events, eventstream._events)

            

Reported by Pylint.

Trailing whitespace
Error

Line: 9 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.

Too many public methods (23/20)
Error

Line: 31 Column: 1

              UTF8_TEXT = 'text/plain; charset=UTF8'


class TestTAP2SubUnit(TestCase):
    """Tests for TAP2SubUnit.

    These tests test TAP string data in, and subunit string data out.
    This is ok because the subunit protocol is intended to be stable,
    but it might be easier/pithier to write tests against TAP string in,

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_base05.py
42 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_base05.py
#    Cursor operations
class test_base05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

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

import wiredtiger, wttest
from wtscenario import make_scenarios

# test_base05.py
#    Cursor operations
class test_base05(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_base05.py
#    Cursor operations
class test_base05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

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

Line: 34 Column: 1

              
# test_base05.py
#    Cursor operations
class test_base05(wttest.WiredTigerTestCase):
    """
    Test that various types of content can be stored
    Test the 'english' huffman encoding with English and non-English strings.
    """


            

Reported by Pylint.

Line too long (218/100)
Error

Line: 68 Column: 1

                  # Moby Dick by Herman Melville, Chapter 1 (excerpt)
    english_strings = [
        'Call me Ishmael.',
        'Some years ago-never mind how long precisely-having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.',
        'It is a way I have of driving off the spleen and regulating the circulation.',
        'Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people\'s hats off-then, I account it high time to get to sea as soon as I can.',
        'This is my substitute for pistol and ball.',
        'With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship.',
        'There is nothing surprising in this.',

            

Reported by Pylint.

Line too long (505/100)
Error

Line: 70 Column: 1

                      'Call me Ishmael.',
        'Some years ago-never mind how long precisely-having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.',
        'It is a way I have of driving off the spleen and regulating the circulation.',
        'Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people\'s hats off-then, I account it high time to get to sea as soon as I can.',
        'This is my substitute for pistol and ball.',
        'With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship.',
        'There is nothing surprising in this.',
        'If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.',
        'There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs-commerce surrounds it with her surf.',

            

Reported by Pylint.

Line too long (104/100)
Error

Line: 72 Column: 1

                      'It is a way I have of driving off the spleen and regulating the circulation.',
        'Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people\'s hats off-then, I account it high time to get to sea as soon as I can.',
        'This is my substitute for pistol and ball.',
        'With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship.',
        'There is nothing surprising in this.',
        'If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.',
        'There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs-commerce surrounds it with her surf.',
        'Right and left, the streets take you waterward.',
        'Its extreme downtown is the battery, where that noble mole is washed by waves, and cooled by breezes, which a few hours previous were out of sight of land.',

            

Reported by Pylint.

Line too long (148/100)
Error

Line: 74 Column: 1

                      'This is my substitute for pistol and ball.',
        'With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship.',
        'There is nothing surprising in this.',
        'If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.',
        'There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs-commerce surrounds it with her surf.',
        'Right and left, the streets take you waterward.',
        'Its extreme downtown is the battery, where that noble mole is washed by waves, and cooled by breezes, which a few hours previous were out of sight of land.',
        'Look at the crowds of water-gazers there.',
        'Circumambulate the city of a dreamy Sabbath afternoon.',

            

Reported by Pylint.

Line too long (152/100)
Error

Line: 75 Column: 1

                      'With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship.',
        'There is nothing surprising in this.',
        'If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.',
        'There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs-commerce surrounds it with her surf.',
        'Right and left, the streets take you waterward.',
        'Its extreme downtown is the battery, where that noble mole is washed by waves, and cooled by breezes, which a few hours previous were out of sight of land.',
        'Look at the crowds of water-gazers there.',
        'Circumambulate the city of a dreamy Sabbath afternoon.',
        'Go from Corlears Hook to Coenties Slip, and from thence, by Whitehall, northward.',

            

Reported by Pylint.

src/third_party/wiredtiger/bench/workgen/runner/example_txn.py
42 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              #

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

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 32 Column: 1

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

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "table:test"

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 34 Column: 11

              from wiredtiger import *
from workgen import *

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "table:test"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 39 Column: 9

              s = conn.open_session()
tname = "table:test"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)
table.options.key_size = 20
table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 43 Column: 16

              table.options.key_size = 20
table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 43 Column: 6

              table.options.key_size = 20
table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)


            

Reported by Pylint.

Undefined variable 'Thread'
Error

Line: 44 Column: 10

              table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)

            

Reported by Pylint.

Undefined variable 'Workload'
Error

Line: 45 Column: 16

              
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)
opwrite = Operation(Operation.OP_INSERT, table)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 49 Column: 10

              print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)
opwrite = Operation(Operation.OP_INSERT, table)
treader = Thread(opread)
twriter = Thread(txn(opwrite * 2))
workload = Workload(context, treader * 8 + twriter * 2)
workload.options.run_time = 10

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 49 Column: 20

              print('populate:')
pop_workload.run(conn)

opread = Operation(Operation.OP_SEARCH, table)
opwrite = Operation(Operation.OP_INSERT, table)
treader = Thread(opread)
twriter = Thread(txn(opwrite * 2))
workload = Workload(context, treader * 8 + twriter * 2)
workload.options.run_time = 10

            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_dpd.c
42 issues
Shifting 32-bit value by 50 bits is undefined behaviour
Error

Line: 137 CWE codes: 758

                } else {	// Normal number
    if ((comb & 0x1800) == 0x1800) {	// G0..G1 = 11 -> exp is G2..G11
      exp = (comb >> 1) & 0x3ff;
      bcoeff = ((8 + (comb & 1)) << 50) | trailing;
    } else {
      exp = (comb >> 3) & 0x3ff;
      bcoeff = ((comb & 7) << 50) | trailing;
    }


            

Reported by Cppcheck.

Shifting 32-bit value by 50 bits is undefined behaviour
Error

Line: 140 CWE codes: 758

                    bcoeff = ((8 + (comb & 1)) << 50) | trailing;
    } else {
      exp = (comb >> 3) & 0x3ff;
      bcoeff = ((comb & 7) << 50) | trailing;
    }

    // Zero the coefficient if it is non-canonical (>= 10^16)
    if (bcoeff >= 10000000000000000ull)
      bcoeff = 0;

            

Reported by Cppcheck.

Shifting 32-bit value by 34 bits is undefined behaviour
Error

Line: 157 CWE codes: 758

              #if 1
  yhi =
    ((BID_UINT64) D61 *
     (BID_UINT64) (BID_UINT32) (bcoeff >> (BID_UINT64) 27)) >> (BID_UINT64) 34;
  ylo = bcoeff - 1000000000ull * yhi;
  if (ylo >= 1000000000) {
    ylo = ylo - 1000000000;
    yhi = yhi + 1;
  }

            

Reported by Cppcheck.

Shifting 32-bit value by 50 bits is undefined behaviour
Error

Line: 181 CWE codes: 758

                if (b0 >= 8)	// is b0 8 or 9?
    res =
      sign |
      ((0x1800 | ((exp >> 8) << 9) | ((b0 & 1) << 8) | (exp & 0xff)) <<
       50) | dcoeff;
  else	// else b0 is 0..7
    res =
      sign | ((((exp >> 8) << 11) | (b0 << 8) | (exp & 0xff)) << 50) |
      dcoeff;

            

Reported by Cppcheck.

Shifting 32-bit value by 50 bits is undefined behaviour
Error

Line: 185 CWE codes: 758

                     50) | dcoeff;
  else	// else b0 is 0..7
    res =
      sign | ((((exp >> 8) << 11) | (b0 << 8) | (exp & 0xff)) << 50) |
      dcoeff;

  res |= nanb;

  BID_RETURN (res);

            

Reported by Cppcheck.

Shifting 32-bit value by 40 bits is undefined behaviour
Error

Line: 290 CWE codes: 758

                    // exp = (comb & 0x1000 ? 1 : 0) * 0x200 + (comb & 0x0800 ? 1 : 0) * 0x100; // exp loading bits are G0..G1
    }
  }
  d1 = bid_d2b5[(trailing >> 40) & 0x3ff];
  d2 = bid_d2b4[(trailing >> 30) & 0x3ff];
  d3 = bid_d2b3[(trailing >> 20) & 0x3ff];
  d4 = bid_d2b2[(trailing >> 10) & 0x3ff];
  d5 = bid_d2b[(trailing) & 0x3ff];


            

Reported by Cppcheck.

Shifting 32-bit value by 46 bits is undefined behaviour
Error

Line: 352 CWE codes: 758

                  if ((comb & 0x18000) == 0x18000) {	// G0..G1 = 11 -> exp is G2..G11
      exp = (comb >> 1) & 0x3fff;
      bcoeff.w[1] =
	((BID_UINT64) (8 + (comb & 1)) << (BID_UINT64) 46) | trailing.w[1];
      bcoeff.w[0] = trailing.w[0];
    } else {
      exp = (comb >> 3) & 0x3fff;
      bcoeff.w[1] =
	((BID_UINT64) (comb & 7) << (BID_UINT64) 46) | trailing.w[1];

            

Reported by Cppcheck.

Shifting 32-bit value by 46 bits is undefined behaviour
Error

Line: 357 CWE codes: 758

                  } else {
      exp = (comb >> 3) & 0x3fff;
      bcoeff.w[1] =
	((BID_UINT64) (comb & 7) << (BID_UINT64) 46) | trailing.w[1];
      bcoeff.w[0] = trailing.w[0];
    }
    // Zero the coefficient if non-canonical (>= 10^34)
    if (bcoeff.w[1] > 0x1ed09bead87c0ull ||
	(bcoeff.w[1] == 0x1ed09bead87c0ull

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 375 CWE codes: 758

                  BID_UINT128 b11, b10, b9, b8, b7, b6, b5, b4, b3, b2, b1;
    d1000.w[1] = 0x4189374BC6A7EFull;
    d1000.w[0] = 0x9DB22D0E56041894ull;
    __mul_128x128_high (b11, bcoeff, d1000);
    __mul_128x128_high (b10, b11, d1000);
    __mul_128x128_high (b9, b10, d1000);
    __mul_128x128_high (b8, b9, d1000);
    __mul_128x128_high (b7, b8, d1000);
    __mul_128x128_high (b6, b7, d1000);

            

Reported by Cppcheck.

Shifting 32-bit value by 32 bits is undefined behaviour
Error

Line: 376 CWE codes: 758

                  d1000.w[1] = 0x4189374BC6A7EFull;
    d1000.w[0] = 0x9DB22D0E56041894ull;
    __mul_128x128_high (b11, bcoeff, d1000);
    __mul_128x128_high (b10, b11, d1000);
    __mul_128x128_high (b9, b10, d1000);
    __mul_128x128_high (b8, b9, d1000);
    __mul_128x128_high (b7, b8, d1000);
    __mul_128x128_high (b6, b7, d1000);
    __mul_128x128_high (b5, b6, d1000);

            

Reported by Cppcheck.

src/third_party/wiredtiger/test/suite/wthooks.py
42 issues
Unable to import 'wiredtiger'
Error

Line: 41 Column: 1

              import os, sys
from importlib import import_module
from abc import ABC, abstractmethod
import wiredtiger

# Three kinds of hooks available:
HOOK_REPLACE = 1     # replace the call with the hook function
HOOK_NOTIFY = 2      # call the hook function after the function
HOOK_ARGS = 3        # transform the arg list before the call

            

Reported by Pylint.

No value for argument 'message' in unbound method call
Error

Line: 52 Column: 5

              # cause a test error.
def tty(message):
    from wttest import WiredTigerTestCase
    WiredTigerTestCase.tty(message)

################
# Hooks Overview
#
# Here are some useful terms to know, with some commentary for each.

            

Reported by Pylint.

Unused import os
Error

Line: 38 Column: 1

              #
from __future__ import print_function

import os, sys
from importlib import import_module
from abc import ABC, abstractmethod
import wiredtiger

# Three kinds of hooks available:

            

Reported by Pylint.

Unused import sys
Error

Line: 38 Column: 1

              #
from __future__ import print_function

import os, sys
from importlib import import_module
from abc import ABC, abstractmethod
import wiredtiger

# Three kinds of hooks available:

            

Reported by Pylint.

Unused variable 'notifies'
Error

Line: 102 Column: 5

              def hooked_function(self, orig_func, hook_info_name, *args):
    hook_info = getattr(self, hook_info_name)

    notifies = []
    replace_func = None

    # The three kinds of hooks are acted upon at different times.
    # Before we call the function, we modify the args as indicated
    # by hooks.  Then we call the function, possibly with a replacement.

            

Reported by Pylint.

Unused variable 'replace_func'
Error

Line: 103 Column: 5

                  hook_info = getattr(self, hook_info_name)

    notifies = []
    replace_func = None

    # The three kinds of hooks are acted upon at different times.
    # Before we call the function, we modify the args as indicated
    # by hooks.  Then we call the function, possibly with a replacement.
    # Finally, we'll call any notify hooks.

            

Reported by Pylint.

Dangerous default value [] as argument
Error

Line: 137 Column: 5

              #
# A hook can set up any number of "hook functions".  See hook_demo.py for a sample hook class.
class WiredTigerHookManager(object):
    def __init__(self, hooknames = []):
        self.hooks = []
        names_seen = []
        for name in hooknames:
            # The hooks are indicated as "somename=arg" or simply "somename".
            # hook_somename.py will be imported, and initialized with the arg.

            

Reported by Pylint.

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

Line: 238 Column: 13

                          hooktype = int(value[0])
            fcn = value[1]
        except:
            raise ValueError('value must be (HOOK_xxxx, function)')
        self.hookmgr.add_hook(self.clazz, name, hooktype, fcn)

# Hooks must derive from this class
class WiredTigerHookCreator(ABC):
    # This is called right after creation and should not be overridden.

            

Reported by Pylint.

Attribute 'name' defined outside __init__
Error

Line: 245 Column: 9

              class WiredTigerHookCreator(ABC):
    # This is called right after creation and should not be overridden.
    def _initialize(self, name, hookmgr):
        self.name = name
        self.hookmgr = hookmgr
        self.wiredtiger = HookCreatorProxy(self.hookmgr, wiredtiger)
        self.Connection = HookCreatorProxy(self.hookmgr, wiredtiger.Connection)
        self.Session = HookCreatorProxy(self.hookmgr, wiredtiger.Session)
        self.Cursor = HookCreatorProxy(self.hookmgr, wiredtiger.Cursor)

            

Reported by Pylint.

Attribute 'hookmgr' defined outside __init__
Error

Line: 246 Column: 9

                  # This is called right after creation and should not be overridden.
    def _initialize(self, name, hookmgr):
        self.name = name
        self.hookmgr = hookmgr
        self.wiredtiger = HookCreatorProxy(self.hookmgr, wiredtiger)
        self.Connection = HookCreatorProxy(self.hookmgr, wiredtiger.Connection)
        self.Session = HookCreatorProxy(self.hookmgr, wiredtiger.Session)
        self.Cursor = HookCreatorProxy(self.hookmgr, wiredtiger.Cursor)


            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_prepare_hs04.py
42 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 SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

# test_prepare_hs04.py

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

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

# test_prepare_hs04.py
# Read prepared updates from on-disk with ignore_prepare.
# Committing or aborting a prepared update when there exists a tombstone for that key already.
#

            

Reported by Pylint.

Redefining name 'stat' from outer scope (line 33)
Error

Line: 63 Column: 24

              
    scenarios = make_scenarios(commit_values, key_format_values)

    def get_stat(self, stat):
        stat_cursor = self.session.open_cursor('statistics:')
        val = stat_cursor[stat][2]
        stat_cursor.close()
        return val


            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 78 Column: 72

                          key = commit_key + ds.key(self.nrows + i)
            cursor.set_key(key)
            if conflict == True:
                self.assertRaisesException(wiredtiger.WiredTigerError, lambda:cursor.search(), expected_value)
            elif expected_value == None:
                self.assertEqual(cursor.search(), wiredtiger.WT_NOTFOUND)
            else:
                self.assertEqual(cursor.search(), 0)
                self.assertEqual(cursor.get_value(), expected_value)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 103 Column: 13

                          key = commit_key + ds.key(self.nrows + i)
            cursor.set_key(key)
            cursor.set_value(commit_value)
            self.assertEquals(cursor.insert(), 0)
            self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(1))
        cursor.close()

        # Call checkpoint.
        self.session.checkpoint()

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 115 Column: 13

                          self.session.begin_transaction('isolation=snapshot')
            key = commit_key + ds.key(self.nrows + i)
            cursor.set_key(key)
            self.assertEquals(cursor.remove(), 0)
            self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(10))
        cursor.close()

        # Move the stable timestamp to match the timestamp for the last update.
        self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(10))

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 138 Column: 17

                          for i in range(start, end):
                cursors[j].set_key(commit_key + ds.key(self.nrows + i))
                cursors[j].set_value(prepare_value)
                self.assertEquals(cursors[j].insert(), 0)
            sessions[j].prepare_transaction('prepare_timestamp=' + self.timestamp_str(20))

        hs_writes = self.get_stat(stat.conn.cache_write_hs) - hs_writes_start
        # Assert if not writing anything to the history store.
        self.assertGreaterEqual(hs_writes, 0)

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 228 Column: 13

                      for i in range(1, 10000):
            cursor.set_key(ds.key(self.nrows + i))
            cursor.set_value(bigvalue)
            self.assertEquals(cursor.insert(), 0)
        cursor.close()
        self.session.checkpoint()

        # We put prepared updates in multiple sessions so that we do not hang
        # because of cache being full with uncommitted updates.

            

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

              # OTHER DEALINGS IN THE SOFTWARE.

from helper import copy_wiredtiger_home
import wiredtiger, wttest
from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

# test_prepare_hs04.py

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_stat02.py
41 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 itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet, SimpleLSMDataSet, ComplexDataSet, \
    ComplexLSMDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              from wtdataset import SimpleDataSet, SimpleLSMDataSet, ComplexDataSet, \
    ComplexLSMDataSet
from wtscenario import make_scenarios
from wiredtiger import stat

# test_stat02.py
#    Statistics cursor configurations.
class test_stat_cursor_config(wttest.WiredTigerTestCase):
    pfx = 'test_stat_cursor_config'

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 62 Column: 5

                  scenarios = make_scenarios(uri, data_config, cursor_config)

    # Turn on statistics for this test.
    def conn_config(self):
        return 'statistics=(%s)' % self.data_config

    # For each database/cursor configuration, confirm the right combinations
    # succeed or fail.
    def test_stat_cursor_config(self):

            

Reported by Pylint.

Unused suite_subprocess imported from suite_subprocess
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import itertools, wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtdataset import SimpleDataSet, SimpleLSMDataSet, ComplexDataSet, \
    ComplexLSMDataSet
from wtscenario import make_scenarios
from wiredtiger import stat


            

Reported by Pylint.

Unused argument 'dir'
Error

Line: 158 Column: 35

              
# Test connection error combinations.
class test_stat_cursor_conn_error(wttest.WiredTigerTestCase):
    def setUpConnectionOpen(self, dir):
        return None
    def setUpSessionOpen(self, conn):
        return None

    def test_stat_cursor_conn_error(self):

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 158 Column: 35

              
# Test connection error combinations.
class test_stat_cursor_conn_error(wttest.WiredTigerTestCase):
    def setUpConnectionOpen(self, dir):
        return None
    def setUpSessionOpen(self, conn):
        return None

    def test_stat_cursor_conn_error(self):

            

Reported by Pylint.

Parameters differ from overridden 'setUpConnectionOpen' method
Error

Line: 158 Column: 5

              
# Test connection error combinations.
class test_stat_cursor_conn_error(wttest.WiredTigerTestCase):
    def setUpConnectionOpen(self, dir):
        return None
    def setUpSessionOpen(self, conn):
        return None

    def test_stat_cursor_conn_error(self):

            

Reported by Pylint.

Cell variable config defined in loop
Error

Line: 169 Column: 51

                          config = 'create,statistics=(' + i[0] + ',' + i[1] + ')'
            msg = '/Only one of/'
            self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
                lambda: self.wiredtiger_open('.', config), msg)

# Test data-source error combinations.
class test_stat_cursor_dsrc_error(wttest.WiredTigerTestCase):
    pfx = 'test_stat_cursor_dsrc_error'


            

Reported by Pylint.

Cell variable config defined in loop
Error

Line: 193 Column: 49

                          msg = '/Only one of/'
            self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
                lambda: self.session.open_cursor(
                'statistics:' + self.uri, None, config), msg)

# Test data-source cache walk statistics
class test_stat_cursor_dsrc_cache_walk(wttest.WiredTigerTestCase):
    uri = 'file:test_stat_cursor_dsrc_cache_walk'


            

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/bench/workgen/runner/small_btree_reopen.py
41 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              #

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

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()

            

Reported by Pylint.

Unable to import 'workgen'
Error

Line: 32 Column: 1

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

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "file:test.wt"

            

Reported by Pylint.

Undefined variable 'Context'
Error

Line: 34 Column: 11

              from wiredtiger import *
from workgen import *

context = Context()
conn = context.wiredtiger_open("create,cache_size=500MB")
s = conn.open_session()
tname = "file:test.wt"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)

            

Reported by Pylint.

Undefined variable 'Table'
Error

Line: 39 Column: 9

              s = conn.open_session()
tname = "file:test.wt"
s.create(tname, 'key_format=S,value_format=S')
table = Table(tname)
table.options.key_size = 20
table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 43 Column: 16

              table.options.key_size = 20
table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)


            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 43 Column: 6

              table.options.key_size = 20
table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)


            

Reported by Pylint.

Undefined variable 'Thread'
Error

Line: 44 Column: 10

              table.options.value_size = 100

op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)

op = Operation(Operation.OP_SEARCH, table)

            

Reported by Pylint.

Undefined variable 'Workload'
Error

Line: 45 Column: 16

              
op = Operation(Operation.OP_INSERT, table)
thread = Thread(op * 500000)
pop_workload = Workload(context, thread)
print('populate:')
pop_workload.run(conn)

op = Operation(Operation.OP_SEARCH, table)
op._config = 'reopen'

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 49 Column: 6

              print('populate:')
pop_workload.run(conn)

op = Operation(Operation.OP_SEARCH, table)
op._config = 'reopen'
t = Thread(op)
workload = Workload(context, t * 8)
workload.options.run_time = 120
workload.options.report_interval = 5

            

Reported by Pylint.

Undefined variable 'Operation'
Error

Line: 49 Column: 16

              print('populate:')
pop_workload.run(conn)

op = Operation(Operation.OP_SEARCH, table)
op._config = 'reopen'
t = Thread(op)
workload = Workload(context, t * 8)
workload.options.run_time = 120
workload.options.report_interval = 5

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/jsapi.cpp
41 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 122 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

              JS::CallArgs::requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const
{
    if (length() < required) {
        char numArgsStr[40];
        SprintfLiteral(numArgsStr, "%u", required - 1);
        JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                                  fnname, numArgsStr, required == 2 ? "" : "s");
        return false;
    }

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 3950 Column: 10 CWE codes: 362

                          fclose(fp_);
    }
    FILE* fp() const { return fp_; }
    bool open(JSContext* cx, const char* filename);
    bool readAll(JSContext* cx, FileContents& buffer)
    {
        MOZ_ASSERT(fp_);
        return ReadCompleteFile(cx, fp_, buffer);
    }

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 3965 Column: 11 CWE codes: 362

               * return value must be fclosed unless it is stdin.
 */
bool
AutoFile::open(JSContext* cx, const char* filename)
{
    if (!filename || strcmp(filename, "-") == 0) {
        fp_ = stdin;
    } else {
        fp_ = fopen(filename, "r");

            

Reported by FlawFinder.

fopen - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 3970 Column: 15 CWE codes: 362

                  if (!filename || strcmp(filename, "-") == 0) {
        fp_ = stdin;
    } else {
        fp_ = fopen(filename, "r");
        if (!fp_) {
            /*
             * Use Latin1 variant here because the encoding of filename is
             * platform dependent.
             */

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 4181 Column: 15 CWE codes: 362

                      const char* filename, MutableHandleScript script)
{
    AutoFile file;
    if (!file.open(cx, filename))
        return false;
    CompileOptions options(cx, optionsArg);
    options.setFileAndLine(filename, 1);
    return ::Compile(cx, options, file.fp(), script);
}

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 4889 Column: 19 CWE codes: 362

                  FileContents buffer(cx);
    {
        AutoFile file;
        if (!file.open(cx, filename) || !file.readAll(cx, buffer))
            return false;
    }

    CompileOptions options(cx, optionsArg);
    options.setFileAndLine(filename, 1);

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 406 Column: 79 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

              }

JS_PUBLIC_API(bool)
JS_StrictlyEqual(JSContext* cx, HandleValue value1, HandleValue value2, bool* equal)
{
    AssertHeapIsIdle();
    CHECK_REQUEST(cx);
    assertSameCompartment(cx, value1, value2);
    MOZ_ASSERT(equal);

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 411 Column: 16 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                  AssertHeapIsIdle();
    CHECK_REQUEST(cx);
    assertSameCompartment(cx, value1, value2);
    MOZ_ASSERT(equal);
    return StrictlyEqual(cx, value1, value2, equal);
}

JS_PUBLIC_API(bool)
JS_LooselyEqual(JSContext* cx, HandleValue value1, HandleValue value2, bool* equal)

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 412 Column: 46 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                  CHECK_REQUEST(cx);
    assertSameCompartment(cx, value1, value2);
    MOZ_ASSERT(equal);
    return StrictlyEqual(cx, value1, value2, equal);
}

JS_PUBLIC_API(bool)
JS_LooselyEqual(JSContext* cx, HandleValue value1, HandleValue value2, bool* equal)
{

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 416 Column: 78 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

              }

JS_PUBLIC_API(bool)
JS_LooselyEqual(JSContext* cx, HandleValue value1, HandleValue value2, bool* equal)
{
    AssertHeapIsIdle();
    CHECK_REQUEST(cx);
    assertSameCompartment(cx, value1, value2);
    MOZ_ASSERT(equal);

            

Reported by FlawFinder.