The following issues were found

src/third_party/wiredtiger/test/suite/test_txn13.py
13 issues
Unable to import 'wiredtiger'
Error

Line: 37 Column: 1

              #import fnmatch, os, shutil, run, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest

class test_txn13(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn13'
    uri = 'table:' + tablename

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 62 Column: 5

                  scenarios = make_scenarios(key_format_values, size_values)

    # Turn on logging for this test.
    def conn_config(self):
        return 'log=(archive=false,enabled,file_max=%s)' % self.logmax + \
            ',cache_size=20G,eviction_dirty_trigger=100'

    @wttest.longtest('txn tests with huge values')
    def test_large_values(self):

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 89 Column: 17

                          # EFBIG is expected: File too large
            msg = '/exceeds the maximum/'
            self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
                lambda:self.session.commit_transaction(), msg)
            gotException = True
        else:
            self.session.commit_transaction()

        self.assertTrue(gotException == self.expect_err)

            

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

              #import fnmatch, os, shutil, run, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest

class test_txn13(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn13'
    uri = 'table:' + tablename

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 37 Column: 1

              #import fnmatch, os, shutil, run, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wiredtiger, wttest

class test_txn13(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn13'
    uri = 'table:' + tablename

            

Reported by Pylint.

Missing class docstring
Error

Line: 39 Column: 1

              from wtscenario import make_scenarios
import wiredtiger, wttest

class test_txn13(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn13'
    uri = 'table:' + tablename
    # We use 8 ops here to get around the 10 operation check done by WiredTiger to determine if
    # a transaction is blocking or not.

            

Reported by Pylint.

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

Line: 39 Column: 1

              from wtscenario import make_scenarios
import wiredtiger, wttest

class test_txn13(wttest.WiredTigerTestCase, suite_subprocess):
    logmax = "100K"
    tablename = 'test_txn13'
    uri = 'table:' + tablename
    # We use 8 ops here to get around the 10 operation check done by WiredTiger to determine if
    # a transaction is blocking or not.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 62 Column: 5

                  scenarios = make_scenarios(key_format_values, size_values)

    # Turn on logging for this test.
    def conn_config(self):
        return 'log=(archive=false,enabled,file_max=%s)' % self.logmax + \
            ',cache_size=20G,eviction_dirty_trigger=100'

    @wttest.longtest('txn tests with huge values')
    def test_large_values(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 67 Column: 5

                          ',cache_size=20G,eviction_dirty_trigger=100'

    @wttest.longtest('txn tests with huge values')
    def test_large_values(self):
        create_params = 'key_format={},value_format=S'.format(self.key_format)

        # print "Creating %s with config '%s'" % (self.uri, create_params)
        # print "Running with %d" % (self.valuesize)
        self.session.create(self.uri, create_params)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_txn23.py
13 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              #   Transactions: ensure read timestamp is not cleared under cache pressure
#

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

class test_txn23(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 33 Column: 1

              #   Transactions: ensure read timestamp is not cleared under cache pressure
#

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

class test_txn23(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 33 Column: 1

              #   Transactions: ensure read timestamp is not cleared under cache pressure
#

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

class test_txn23(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

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

Line: 37 Column: 1

              from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

class test_txn23(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'
    conn_config = 'cache_size=5MB'

    key_format_values = [
        ('integer-row', dict(key_format='i')),

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              from wtdataset import SimpleDataSet
from wtscenario import make_scenarios

class test_txn23(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'
    conn_config = 'cache_size=5MB'

    key_format_values = [
        ('integer-row', dict(key_format='i')),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 47 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def large_updates(self, uri, value, ds, nrows, commit_ts):
        # Update a large number of records.
        cursor = self.session.open_cursor(uri)
        for i in range(1, nrows + 1):
            self.session.begin_transaction()
            cursor[ds.key(i)] = value

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 47 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def large_updates(self, uri, value, ds, nrows, commit_ts):
        # Update a large number of records.
        cursor = self.session.open_cursor(uri)
        for i in range(1, nrows + 1):
            self.session.begin_transaction()
            cursor[ds.key(i)] = value

            

Reported by Pylint.

Argument name "ds" doesn't conform to snake_case naming style
Error

Line: 47 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def large_updates(self, uri, value, ds, nrows, commit_ts):
        # Update a large number of records.
        cursor = self.session.open_cursor(uri)
        for i in range(1, nrows + 1):
            self.session.begin_transaction()
            cursor[ds.key(i)] = value

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 56 Column: 5

                          self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(commit_ts))
        cursor.close()

    def check(self, check_value, uri, ds, nrows, read_ts):
        for i in range(1, nrows + 1):
            self.session.begin_transaction('read_timestamp=' + self.timestamp_str(read_ts))
            cursor = self.session.open_cursor(uri)
            self.assertEqual(cursor[ds.key(i)], check_value)
            cursor.close()

            

Reported by Pylint.

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

# test_hs08.py
# Verify modify insert into history store logic.

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest, time
from wiredtiger import stat
from wtscenario import make_scenarios

# test_hs08.py
# Verify modify insert into history store logic.
class test_hs08(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 wiredtiger import stat
from wtscenario import make_scenarios

# test_hs08.py
# Verify modify insert into history store logic.

            

Reported by Pylint.

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

Line: 44 Column: 24

                  ]
    scenarios = make_scenarios(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.

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

# test_hs08.py
# Verify modify insert into history store logic.

            

Reported by Pylint.

Multiple imports on one line (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 wiredtiger import stat
from wtscenario import make_scenarios

# test_hs08.py
# Verify modify insert into history store logic.

            

Reported by Pylint.

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

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest, time
from wiredtiger import stat
from wtscenario import make_scenarios

# test_hs08.py
# Verify modify insert into history store logic.
class test_hs08(wttest.WiredTigerTestCase):

            

Reported by Pylint.

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

Line: 35 Column: 1

              
# test_hs08.py
# Verify modify insert into history store logic.
class test_hs08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=100MB,statistics=(all)'
    session_config = 'isolation=snapshot'
    key_format_values = [
        ('column', dict(key_format='r')),
        ('integer-row', dict(key_format='i')),

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              
# test_hs08.py
# Verify modify insert into history store logic.
class test_hs08(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=100MB,statistics=(all)'
    session_config = 'isolation=snapshot'
    key_format_values = [
        ('column', dict(key_format='r')),
        ('integer-row', dict(key_format='i')),

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/vm/Xdr.h
13 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

                          uint8_t* ptr = buf.write(len);
            if (!ptr)
                return fail(JS::TranscodeResult_Throw);
            memcpy(ptr, bytes, len);
        } else {
            const uint8_t* ptr = buf.read(len);
            if (!ptr)
                return fail(JS::TranscodeResult_Failure_BadDecode);
            memcpy(bytes, ptr, len);

            

Reported by FlawFinder.

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

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

                          const uint8_t* ptr = buf.read(len);
            if (!ptr)
                return fail(JS::TranscodeResult_Failure_BadDecode);
            memcpy(bytes, ptr, len);
        }
        return true;
    }

    /*

            

Reported by FlawFinder.

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

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

                          uint8_t* ptr = buf.write(len);
            if (!ptr)
                return fail(JS::TranscodeResult_Throw);
            memcpy(ptr, *sp, len);
        } else {
            const uint8_t* ptr = buf.read(len);
            if (!ptr || ptr[len] != '\0')
                return fail(JS::TranscodeResult_Failure_BadDecode);
            *sp = reinterpret_cast<const char*>(ptr);

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 64 Column: 20 CWE codes: 120 20

                      return ptr;
    }

    const uint8_t* read(size_t n) {
        MOZ_CRASH("Should never read in encode mode");
        return nullptr;
    }

  private:

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 85 Column: 20 CWE codes: 120 20

                    : XDRBufferBase(cx, cursor),
        buffer_(buffer.begin(), buffer.length()) { }

    const uint8_t* read(size_t n) {
        MOZ_ASSERT(cursor_ < buffer_.length());
        uint8_t* ptr = &buffer_[cursor_];
        cursor_ += n;

        // Don't let buggy code read past our buffer

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 215 Column: 34 CWE codes: 120 20

                  }

    bool peekData(const uint8_t** pptr, size_t length) {
        const uint8_t* ptr = buf.read(length);
        if (!ptr)
            return fail(JS::TranscodeResult_Failure_BadDecode);
        *pptr = ptr;
        return true;
    }

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 229 Column: 38 CWE codes: 120 20

                              return fail(JS::TranscodeResult_Throw);
            *ptr = *n;
        } else {
            const uint8_t* ptr = buf.read(sizeof(*n));
            if (!ptr)
                return fail(JS::TranscodeResult_Failure_BadDecode);
            *n = *ptr;
        }
        return true;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 244 Column: 38 CWE codes: 120 20

                              return fail(JS::TranscodeResult_Throw);
            mozilla::LittleEndian::writeUint16(ptr, *n);
        } else {
            const uint8_t* ptr = buf.read(sizeof(*n));
            if (!ptr)
                return fail(JS::TranscodeResult_Failure_BadDecode);
            *n = mozilla::LittleEndian::readUint16(ptr);
        }
        return true;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 259 Column: 38 CWE codes: 120 20

                              return fail(JS::TranscodeResult_Throw);
            mozilla::LittleEndian::writeUint32(ptr, *n);
        } else {
            const uint8_t* ptr = buf.read(sizeof(*n));
            if (!ptr)
                return fail(JS::TranscodeResult_Failure_BadDecode);
            *n = mozilla::LittleEndian::readUint32(ptr);
        }
        return true;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 274 Column: 38 CWE codes: 120 20

                              return fail(JS::TranscodeResult_Throw);
            mozilla::LittleEndian::writeUint64(ptr, *n);
        } else {
            const uint8_t* ptr = buf.read(sizeof(*n));
            if (!ptr)
                return fail(JS::TranscodeResult_Failure_BadDecode);
            *n = mozilla::LittleEndian::readUint64(ptr);
        }
        return true;

            

Reported by FlawFinder.

buildscripts/libdeps/graph_visualizer.py
13 issues
Unused import shutil
Error

Line: 38 Column: 1

              import os
from pathlib import Path
import argparse
import shutil
import subprocess
import platform
import threading
import copy
import textwrap

            

Reported by Pylint.

Unused import platform
Error

Line: 40 Column: 1

              import argparse
import shutil
import subprocess
import platform
import threading
import copy
import textwrap

import flask

            

Reported by Pylint.

Unused import copy
Error

Line: 42 Column: 1

              import subprocess
import platform
import threading
import copy
import textwrap

import flask
from graph_visualizer_web_stack.flask.flask_backend import BackendServer


            

Reported by Pylint.

Unused import flask
Error

Line: 45 Column: 1

              import copy
import textwrap

import flask
from graph_visualizer_web_stack.flask.flask_backend import BackendServer


def get_args():
    """Create the argparse and return passed args."""

            

Reported by Pylint.

TODO: add https command line option and support
Error

Line: 159 Column: 3

              
    args = get_args()

    # TODO: add https command line option and support
    server = BackendServer(graphml_dir=args.graphml_dir,
                           frontend_url=f"http://{args.frontend_host}:{args.frontend_port}")

    app, socketio = server.get_app()
    cwd = Path(__file__).parent / 'graph_visualizer_web_stack'

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 39
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              from pathlib import Path
import argparse
import shutil
import subprocess
import platform
import threading
import copy
import textwrap


            

Reported by Bandit.

Line too long (126/100)
Error

Line: 56 Column: 1

              
    parser.add_argument(
        '--debug', action='store_true', help=
        'Whether or not to run debug server. Note for non-debug, you must build the production frontend with "npm run build".'
    )
    parser.add_argument(
        '--graphml-dir', type=str, action='store', help=
        "Directory where libdeps graphml files live. The UI will allow selecting different graphs from this location",
        default="build/opt")

            

Reported by Pylint.

Line too long (118/100)
Error

Line: 60 Column: 1

                  )
    parser.add_argument(
        '--graphml-dir', type=str, action='store', help=
        "Directory where libdeps graphml files live. The UI will allow selecting different graphs from this location",
        default="build/opt")

    parser.add_argument('--frontend-host', type=str, action='store',
                        help="Hostname where the front end will run.", default="localhost")


            

Reported by Pylint.

subprocess call - check for execution of untrusted input.
Security injection

Line: 84
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

              def execute_and_read_stdout(cmd, cwd, env):
    """Execute passed command and get realtime output."""

    popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=str(cwd), env=env,
                             universal_newlines=True)
    for stdout_line in iter(popen.stdout.readline, ""):
        yield stdout_line
    popen.stdout.close()
    return_code = popen.wait()

            

Reported by Bandit.

Consider using sys.exit()
Error

Line: 104 Column: 9

                          Failed to get node version 12 from 'node -v':
            output: '{output}'
            Perhaps run 'source {cwd}/setup_node_env.sh install'"""))
        exit(1)

    node_modules = cwd / 'node_modules'

    if not node_modules.exists():
        print(

            

Reported by Pylint.

buildscripts/libdeps/gacli.py
13 issues
Unable to import 'networkx'
Error

Line: 36 Column: 1

              from pathlib import Path
import copy

import networkx

import libdeps.analyzer as libdeps_analyzer
from libdeps.graph import LibdepsGraph, CountTypes, LinterTypes



            

Reported by Pylint.

Instance of 'LinterSplitArgs' has no 'valid_choices' member
Error

Line: 50 Column: 68

              
        selected_choices = [v.upper() for v in ''.join(values).split(',') if v]
        invalid_choices = [
            choice for choice in selected_choices if choice not in self.valid_choices
        ]
        if invalid_choices:
            raise Exception(
                f"Invalid choices: {invalid_choices}\nMust use choices from {self.valid_choices}")
        if CountTypes.ALL.name in selected_choices:

            

Reported by Pylint.

Instance of 'LinterSplitArgs' has no 'valid_choices' member
Error

Line: 54 Column: 78

                      ]
        if invalid_choices:
            raise Exception(
                f"Invalid choices: {invalid_choices}\nMust use choices from {self.valid_choices}")
        if CountTypes.ALL.name in selected_choices:
            selected_choices = copy.copy(self.valid_choices)
            selected_choices.remove(CountTypes.ALL.name)
        if selected_choices == []:
            selected_choices = copy.copy(self.default_choices)

            

Reported by Pylint.

Instance of 'LinterSplitArgs' has no 'valid_choices' member
Error

Line: 56 Column: 42

                          raise Exception(
                f"Invalid choices: {invalid_choices}\nMust use choices from {self.valid_choices}")
        if CountTypes.ALL.name in selected_choices:
            selected_choices = copy.copy(self.valid_choices)
            selected_choices.remove(CountTypes.ALL.name)
        if selected_choices == []:
            selected_choices = copy.copy(self.default_choices)
        setattr(namespace, self.dest, [opt.replace('-', '_') for opt in selected_choices])


            

Reported by Pylint.

Instance of 'LinterSplitArgs' has no 'default_choices' member
Error

Line: 59 Column: 42

                          selected_choices = copy.copy(self.valid_choices)
            selected_choices.remove(CountTypes.ALL.name)
        if selected_choices == []:
            selected_choices = copy.copy(self.default_choices)
        setattr(namespace, self.dest, [opt.replace('-', '_') for opt in selected_choices])


class CountSplitArgs(LinterSplitArgs):
    """Special case of common custom arg action for Count types."""

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 42 Column: 1

              from libdeps.graph import LibdepsGraph, CountTypes, LinterTypes


class LinterSplitArgs(argparse.Action):
    """Custom argument action for checking multiple choice comma separated list."""

    def __call__(self, parser, namespace, values, option_string=None):
        """Create a multi choice comma separated list."""


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 63 Column: 1

                      setattr(namespace, self.dest, [opt.replace('-', '_') for opt in selected_choices])


class CountSplitArgs(LinterSplitArgs):
    """Special case of common custom arg action for Count types."""

    valid_choices = [name[0].replace('_', '-') for name in CountTypes.__members__.items()]
    default_choices = [
        name[0] for name in CountTypes.__members__.items() if name[0] != CountTypes.ALL.name

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 72 Column: 1

                  ]


class LintSplitArgs(LinterSplitArgs):
    """Special case of common custom arg action for Count types."""

    valid_choices = [name[0].replace('_', '-') for name in LinterTypes.__members__.items()]
    default_choices = [LinterTypes.PUBLIC_UNUSED.name]


            

Reported by Pylint.

Unnecessary "elif" after "return"
Error

Line: 92 Column: 9

              
    def _get_help_string(self, action):

        if isinstance(action, CountSplitArgs):
            help_text = self._get_help_length(CountTypes)
            return textwrap.dedent(f"""\
                {action.help}
                default: all, choices:
                    {help_text[CountTypes.ALL.name]}perform all counts

            

Reported by Pylint.

Line too long (106/100)
Error

Line: 150 Column: 1

              
    parser.add_argument(
        '--exclude-depends', nargs='+', action='append', default=[], help=
        "Print nodes which depend on the first node of N nodes, but exclude all nodes listed there after."
    )

    parser.add_argument('--graph-paths', nargs='+', action='append', default=[],
                        help="[from_node] [to_node]: Print all paths between 2 nodes.")


            

Reported by Pylint.

src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_add.c
13 issues
Shifting 32-bit value by 53 bits is undefined behaviour
Error

Line: 203 CWE codes: 758

                  // y is 0
    if (!coefficient_x) {	// x==0
      if (exponent_x <= exponent_y)
	res = ((BID_UINT64) exponent_x) << 53;
      else
	res = ((BID_UINT64) exponent_y) << 53;
      if (sign_x == sign_y)
	res |= sign_x;
#ifndef IEEE_ROUND_NEAREST_TIES_AWAY

            

Reported by Cppcheck.

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

Line: 205 CWE codes: 758

                    if (exponent_x <= exponent_y)
	res = ((BID_UINT64) exponent_x) << 53;
      else
	res = ((BID_UINT64) exponent_y) << 53;
      if (sign_x == sign_y)
	res |= sign_x;
#ifndef IEEE_ROUND_NEAREST_TIES_AWAY
#ifndef IEEE_ROUND_NEAREST
      if (rnd_mode == BID_ROUNDING_DOWN && sign_x != sign_y)

            

Reported by Cppcheck.

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

Line: 282 CWE codes: 758

              	switch (rnd_mode) {
	case BID_ROUNDING_DOWN:
	  if (sign_b) {
	    coefficient_a -= ((((BID_SINT64) sign_a) >> 63) | 1);
	    if (coefficient_a < 1000000000000000ull) {
	      exponent_a--;
	      coefficient_a = 9999999999999999ull;
	    } else if (coefficient_a >= 10000000000000000ull) {
	      exponent_a++;

            

Reported by Cppcheck.

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

Line: 294 CWE codes: 758

              	  break;
	case BID_ROUNDING_UP:
	  if (!sign_b) {
	    coefficient_a += ((((BID_SINT64) sign_a) >> 63) | 1);
	    if (coefficient_a < 1000000000000000ull) {
	      exponent_a--;
	      coefficient_a = 9999999999999999ull;
	    } else if (coefficient_a >= 10000000000000000ull) {
	      exponent_a++;

            

Reported by Cppcheck.

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

Line: 340 CWE codes: 758

                  coefficient_a *= bid_power10_table_128[diff_dec_expon].w[0];

    // sign mask
    sign_b = ((BID_SINT64) sign_b) >> 63;
    // apply sign to coeff. of b
    coefficient_b = (coefficient_b + sign_b) ^ sign_b;

    // apply sign to coefficient a
    sign_a = ((BID_SINT64) sign_a) >> 63;

            

Reported by Cppcheck.

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

Line: 345 CWE codes: 758

                  coefficient_b = (coefficient_b + sign_b) ^ sign_b;

    // apply sign to coefficient a
    sign_a = ((BID_SINT64) sign_a) >> 63;
    coefficient_a = (coefficient_a + sign_a) ^ sign_a;

    coefficient_a += coefficient_b;
    // get sign
    sign_s = ((BID_SINT64) coefficient_a) >> 63;

            

Reported by Cppcheck.

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

Line: 350 CWE codes: 758

              
    coefficient_a += coefficient_b;
    // get sign
    sign_s = ((BID_SINT64) coefficient_a) >> 63;
    coefficient_a = (coefficient_a + sign_s) ^ sign_s;
    sign_s &= 0x8000000000000000ull;

    // coefficient_a < 10^16 ?
    if (coefficient_a < bid_power10_table_128[MAX_FORMAT_DIGITS].w[0]) {

            

Reported by Cppcheck.

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

Line: 391 CWE codes: 758

                  coefficient_a += bid_round_const_table[rmode][extra_digits];

    // get P*(2^M[extra_digits])/10^extra_digits
    __mul_64x64_to_128 (CT, coefficient_a,
			bid_reciprocals10_64[extra_digits]);

    // now get P/10^extra_digits: shift C64 right by M[extra_digits]-128
    amount = bid_short_recip_scale[extra_digits];
    C64 = CT.w[1] >> amount;

            

Reported by Cppcheck.

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

Line: 418 CWE codes: 758

                  scale_ca = bid_estimate_decimal_digits[bin_expon_ca];

    sign_ab = sign_a ^ sign_b;
    sign_ab = ((BID_SINT64) sign_ab) >> 63;

    // T1 = 10^(16-diff_dec_expon)
    T1 = bid_power10_table_128[16 - diff_dec_expon].w[0];

    // get number of digits in coefficient_a

            

Reported by Cppcheck.

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

Line: 444 CWE codes: 758

                    bid_round_const_table[rmode][extra_digits];

    // get P*(2^M[extra_digits])/10^extra_digits
    __mul_64x64_to_128 (CT, coefficient_b,
			bid_reciprocals10_64[extra_digits]);

    // now get P/10^extra_digits: shift C64 right by M[extra_digits]-128
    amount = bid_short_recip_scale[extra_digits];
    C0_64 = CT.w[1] >> amount;

            

Reported by Cppcheck.

src/third_party/wiredtiger/test/suite/test_durable_ts02.py
13 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

# test_durable_ts03.py
#    Checking visibility and durability of updates with durable_timestamp

            

Reported by Pylint.

Unused copy_wiredtiger_home imported from helper
Error

Line: 29 Column: 1

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

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

# test_durable_ts03.py

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

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

# test_durable_ts03.py
#    Checking visibility and durability of updates with durable_timestamp

            

Reported by Pylint.

Unused variable 'cursor'
Error

Line: 72 Column: 9

                      ds.populate()

        session = self.conn.open_session(self.session_config)
        cursor = session.open_cursor(uri, None)

        # Set stable timestamp to checkpoint initial data set.
        self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(100))
        self.session.checkpoint()


            

Reported by Pylint.

String statement has no effect
Error

Line: 78 Column: 9

                      self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(100))
        self.session.checkpoint()

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

        # Scenario: 1
        # Check to see commit timestamp > durable timestamap, returns error.
        session.begin_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 helper import copy_wiredtiger_home"
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

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

# test_durable_ts03.py
#    Checking visibility and durability of updates with durable_timestamp

            

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

# test_durable_ts03.py
#    Checking visibility and durability of updates with durable_timestamp

            

Reported by Pylint.

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

Line: 36 Column: 1

              
# test_durable_ts03.py
#    Checking visibility and durability of updates with durable_timestamp
class test_durable_ts03(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'

    keyfmt = [
        ('row-string', dict(keyfmt='S')),
        ('row-int', dict(keyfmt='i')),

            

Reported by Pylint.

Missing class docstring
Error

Line: 36 Column: 1

              
# test_durable_ts03.py
#    Checking visibility and durability of updates with durable_timestamp
class test_durable_ts03(wttest.WiredTigerTestCase):
    session_config = 'isolation=snapshot'

    keyfmt = [
        ('row-string', dict(keyfmt='S')),
        ('row-int', dict(keyfmt='i')),

            

Reported by Pylint.

src/mongo/util/net/ssl_manager_test.cpp
13 issues
syntax error
Error

Line: 118

                  return str;
}

TEST(SSLManager, matchHostname) {
    enum Expected : bool { match = true, mismatch = false };
    const struct {
        Expected expected;
        std::string hostname;
        std::string certName;

            

Reported by Cppcheck.

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

Line: 128 Column: 10 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

                      // clang-format off
        // Matches?  |    Hostname and possibly FQDN   |  Certificate name
        {match,                    "foo.bar.bas" ,           "*.bar.bas."},
        {mismatch,       "foo.subdomain.bar.bas" ,           "*.bar.bas."},
        {match,                    "foo.bar.bas.",           "*.bar.bas."},
        {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas."},

        {match,                    "foo.bar.bas" ,           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas" ,           "*.bar.bas"},

            

Reported by FlawFinder.

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

Line: 130 Column: 10 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

                      {match,                    "foo.bar.bas" ,           "*.bar.bas."},
        {mismatch,       "foo.subdomain.bar.bas" ,           "*.bar.bas."},
        {match,                    "foo.bar.bas.",           "*.bar.bas."},
        {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas."},

        {match,                    "foo.bar.bas" ,           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas" ,           "*.bar.bas"},
        {match,                    "foo.bar.bas.",           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas"},

            

Reported by FlawFinder.

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

Line: 133 Column: 10 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

                      {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas."},

        {match,                    "foo.bar.bas" ,           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas" ,           "*.bar.bas"},
        {match,                    "foo.bar.bas.",           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas"},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas."},

            

Reported by FlawFinder.

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

Line: 135 Column: 10 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

                      {match,                    "foo.bar.bas" ,           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas" ,           "*.bar.bas"},
        {match,                    "foo.bar.bas.",           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas"},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas."},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas."},

            

Reported by FlawFinder.

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

Line: 137 Column: 10 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

                      {match,                    "foo.bar.bas.",           "*.bar.bas"},
        {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas"},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas."},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas."},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas"},

            

Reported by FlawFinder.

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

Line: 138 Column: 10 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

                      {mismatch,       "foo.subdomain.bar.bas.",           "*.bar.bas"},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas."},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas."},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas"},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas"},

            

Reported by FlawFinder.

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

Line: 139 Column: 10 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

              
        {mismatch,                "foo.evil.bas" ,           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas."},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas."},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas"},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas"},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas"},

            

Reported by FlawFinder.

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

Line: 140 Column: 10 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

                      {mismatch,                "foo.evil.bas" ,           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas."},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas."},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas"},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas"},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas"},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas"},

            

Reported by FlawFinder.

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

Line: 142 Column: 10 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

                      {mismatch,                "foo.evil.bas.",           "*.bar.bas."},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas."},

        {mismatch,                "foo.evil.bas" ,           "*.bar.bas"},
        {mismatch,      "foo.subdomain.evil.bas" ,           "*.bar.bas"},
        {mismatch,                "foo.evil.bas.",           "*.bar.bas"},
        {mismatch,      "foo.subdomain.evil.bas.",           "*.bar.bas"},
        // clang-format on
    };

            

Reported by FlawFinder.

src/third_party/boost/boost/regex/v4/regex_workaround.hpp
13 issues
strcat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

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

              
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
   using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
}
#endif

namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
#ifdef BOOST_NO_STD_DISTANCE

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 53 Column: 12 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
   using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
}
#endif

namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
#ifdef BOOST_NO_STD_DISTANCE

            

Reported by FlawFinder.

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

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

              
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
   using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
}
#endif

namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
#ifdef BOOST_NO_STD_DISTANCE

            

Reported by FlawFinder.

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

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

                 using ::size_t;
   using ::abs;
   using ::memset;
   using ::memcpy;
}

#endif

/*****************************************************************************

            

Reported by FlawFinder.

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

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

              	  std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
	  if (lenSourceWithNull > sizeInBytes)
         return 1;
	  std::memcpy(strDestination, strSource, lenSourceWithNull);
      return 0;
   }
   inline std::size_t strcat_s(
      char *strDestination,
      std::size_t sizeInBytes,

            

Reported by FlawFinder.

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

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

              	  std::size_t lenDestination = std::strlen(strDestination);
	  if (lenSourceWithNull + lenDestination > sizeInBytes)
         return 1;
	  std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
      return 0;
   }

#endif


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 53 Column: 61 CWE codes: 126

              
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
   using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
}
#endif

namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
#ifdef BOOST_NO_STD_DISTANCE

            

Reported by FlawFinder.

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

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

                    return stdext::unchecked_copy(first, last, dest);
   }
   template<class InputIterator1, class InputIterator2>
   inline bool equal(
      InputIterator1 first, 
      InputIterator1 last, 
      InputIterator2 with
   )
   {

            

Reported by FlawFinder.

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

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

                    return dest;
   }
   template<class InputIterator1, class InputIterator2>
   inline bool equal(
      InputIterator1 first, 
      InputIterator1 last, 
      InputIterator2 with
   )
   {

            

Reported by FlawFinder.

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

Line: 187 Column: 15 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

                 }
#else 
   using std::copy; 
   using std::equal; 
#endif 
#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__ 

   // use safe versions of strcpy etc:
   using ::strcpy_s;

            

Reported by FlawFinder.