The following issues were found

jstests/ocsp/lib/ocsp_mock.py
8 issues
Unable to import 'mock_ocsp_responder'
Error

Line: 13 Column: 1

              
sys.path.append(os.path.join(os.getcwd() ,'src', 'third_party', 'mock_ocsp_responder'))

import mock_ocsp_responder

def main():
    """Main entry point"""
    parser = argparse.ArgumentParser(description="MongoDB Mock OCSP Responder.")


            

Reported by Pylint.

Import "import mock_ocsp_responder" should be placed at the top of the module
Error

Line: 13 Column: 1

              
sys.path.append(os.path.join(os.getcwd() ,'src', 'third_party', 'mock_ocsp_responder'))

import mock_ocsp_responder

def main():
    """Main entry point"""
    parser = argparse.ArgumentParser(description="MongoDB Mock OCSP Responder.")


            

Reported by Pylint.

Line too long (108/100)
Error

Line: 27 Column: 1

              
    parser.add_argument('-v', '--verbose', action='count', help="Enable verbose tracing")

    parser.add_argument('--ocsp_responder_cert', type=str, required=True, help="OCSP Responder Certificate")

    parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile")

    parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")


            

Reported by Pylint.

Line too long (103/100)
Error

Line: 29 Column: 1

              
    parser.add_argument('--ocsp_responder_cert', type=str, required=True, help="OCSP Responder Certificate")

    parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile")

    parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")

    parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")


            

Reported by Pylint.

Line too long (185/100)
Error

Line: 31 Column: 1

              
    parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile")

    parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")

    parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")

    parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds")


            

Reported by Pylint.

Line too long (136/100)
Error

Line: 33 Column: 1

              
    parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test")

    parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")

    parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds")

    args = parser.parse_args()
    if args.verbose:

            

Reported by Pylint.

Line too long (126/100)
Error

Line: 35 Column: 1

              
    parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for")

    parser.add_argument('--response_delay_seconds', type=int, default=0, help="Delays the response by this number of seconds")

    args = parser.parse_args()
    if args.verbose:
        logging.basicConfig(level=logging.DEBUG)


            

Reported by Pylint.

Line too long (260/100)
Error

Line: 42 Column: 1

                      logging.basicConfig(level=logging.DEBUG)

    print('Initializing OCSP Responder')
    mock_ocsp_responder.init_responder(issuer_cert=args.ca_file, responder_cert=args.ocsp_responder_cert, responder_key=args.ocsp_responder_key, fault=args.fault, next_update_seconds=args.next_update_seconds, response_delay_seconds=args.response_delay_seconds)

    mock_ocsp_responder.init(port=args.port, debug=args.verbose, host=args.bind_ip)

    print('Mock OCSP Responder is running on port %s' % (str(args.port)))


            

Reported by Pylint.

src/third_party/boost/boost/spirit/home/classic/utility/confix.hpp
8 issues
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: 61 Column: 7 CWE codes: 362

                      self_t;

    confix_parser(OpenT const &open_, ExprT const &expr_, CloseT const &close_)
    : open(open_), expr(expr_), close(close_)
    {}

    template <typename ScannerT>
    typename parser_result<self_t, ScannerT>::type
    parse(ScannerT const& scan) const

            

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: 69 Column: 54 CWE codes: 362

                  parse(ScannerT const& scan) const
    {
        return impl::confix_parser_type<CategoryT>::
            parse(NestedT(), LexemeT(), *this, scan, open, expr, close);
    }

private:

    typename as_parser<OpenT>::type::embed_t open;

            

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: 74 Column: 46 CWE codes: 362

              
private:

    typename as_parser<OpenT>::type::embed_t open;
    typename as_parser<ExprT>::type::embed_t expr;
    typename as_parser<CloseT>::type::embed_t close;
};

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)

            

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: 345 Column: 9 CWE codes: 362

                  typedef comment_nest_parser<OpenT, CloseT> self_t;

    comment_nest_parser(OpenT const &open_, CloseT const &close_):
        open(open_), close(close_)
    {}

    template<typename ScannerT>
    typename parser_result<self_t, ScannerT>::type
        parse(ScannerT const &scan) const

            

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: 353 Column: 13 CWE codes: 362

                      parse(ScannerT const &scan) const
    {
        return do_parse(
            open >> *(*this | (anychar_p - close)) >> close,
            scan);
    }

private:
    template<typename ParserT, typename ScannerT>

            

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: 368 Column: 46 CWE codes: 362

                          >(p, scan, scan);
    }

    typename as_parser<OpenT>::type::embed_t open;
    typename as_parser<CloseT>::type::embed_t close;
};

///////////////////////////////////////////////////////////////////////////////
//

            

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: 389 Column: 29 CWE codes: 362

              
template<typename OpenT, typename CloseT>
inline typename comment_nest_p_result<OpenT,CloseT>::type 
comment_nest_p(OpenT const &open, CloseT const &close)
{
    typedef typename comment_nest_p_result<OpenT,CloseT>::type
        result_t;

    return result_t(

            

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: 395 Column: 35 CWE codes: 362

                      result_t;

    return result_t(
        as_parser<OpenT>::convert(open),
        as_parser<CloseT>::convert(close)
    );
}

///////////////////////////////////////////////////////////////////////////////

            

Reported by FlawFinder.

src/mongo/bson/util/simple8b_type_util.cpp
8 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 86 Column: 14 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              }

OID Simple8bTypeUtil::decodeObjectId(int64_t val, OID::InstanceUnique processUnique) {
    unsigned char objId[OID::kOIDSize];

    val = LittleEndian<uint64_t>::store(val);
    uint8_t* encodedBytes = reinterpret_cast<uint8_t*>(&val);

    // Set Timestamp and Counter variables together.

            

Reported by FlawFinder.

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

Line: 74 Column: 27 CWE codes: 120 20

                  ConstDataView cdv = oid.view();

    // Copy counter and timestamp bytes so that they match the specs in the header.
    encodedBytes[0] = cdv.read<uint8_t>(3);   // Timestamp index 3.
    encodedBytes[1] = cdv.read<uint8_t>(11);  // Counter index 2.
    encodedBytes[2] = cdv.read<uint8_t>(2);   // Timestamp index 2.
    encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.

            

Reported by FlawFinder.

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

Line: 75 Column: 27 CWE codes: 120 20

              
    // Copy counter and timestamp bytes so that they match the specs in the header.
    encodedBytes[0] = cdv.read<uint8_t>(3);   // Timestamp index 3.
    encodedBytes[1] = cdv.read<uint8_t>(11);  // Counter index 2.
    encodedBytes[2] = cdv.read<uint8_t>(2);   // Timestamp index 2.
    encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.
    encodedBytes[6] = cdv.read<uint8_t>(0);   // Timestamp index 0.

            

Reported by FlawFinder.

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

Line: 76 Column: 27 CWE codes: 120 20

                  // Copy counter and timestamp bytes so that they match the specs in the header.
    encodedBytes[0] = cdv.read<uint8_t>(3);   // Timestamp index 3.
    encodedBytes[1] = cdv.read<uint8_t>(11);  // Counter index 2.
    encodedBytes[2] = cdv.read<uint8_t>(2);   // Timestamp index 2.
    encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.
    encodedBytes[6] = cdv.read<uint8_t>(0);   // Timestamp index 0.


            

Reported by FlawFinder.

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

Line: 77 Column: 27 CWE codes: 120 20

                  encodedBytes[0] = cdv.read<uint8_t>(3);   // Timestamp index 3.
    encodedBytes[1] = cdv.read<uint8_t>(11);  // Counter index 2.
    encodedBytes[2] = cdv.read<uint8_t>(2);   // Timestamp index 2.
    encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.
    encodedBytes[6] = cdv.read<uint8_t>(0);   // Timestamp index 0.

    return LittleEndian<uint64_t>::load(encoded);

            

Reported by FlawFinder.

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

Line: 78 Column: 27 CWE codes: 120 20

                  encodedBytes[1] = cdv.read<uint8_t>(11);  // Counter index 2.
    encodedBytes[2] = cdv.read<uint8_t>(2);   // Timestamp index 2.
    encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.
    encodedBytes[6] = cdv.read<uint8_t>(0);   // Timestamp index 0.

    return LittleEndian<uint64_t>::load(encoded);
}

            

Reported by FlawFinder.

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

Line: 79 Column: 27 CWE codes: 120 20

                  encodedBytes[2] = cdv.read<uint8_t>(2);   // Timestamp index 2.
    encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.
    encodedBytes[6] = cdv.read<uint8_t>(0);   // Timestamp index 0.

    return LittleEndian<uint64_t>::load(encoded);
}


            

Reported by FlawFinder.

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

Line: 80 Column: 27 CWE codes: 120 20

                  encodedBytes[3] = cdv.read<uint8_t>(10);  // Counter index 1.
    encodedBytes[4] = cdv.read<uint8_t>(1);   // Timestamp index 1.
    encodedBytes[5] = cdv.read<uint8_t>(9);   // Counter index 0.
    encodedBytes[6] = cdv.read<uint8_t>(0);   // Timestamp index 0.

    return LittleEndian<uint64_t>::load(encoded);
}

OID Simple8bTypeUtil::decodeObjectId(int64_t val, OID::InstanceUnique processUnique) {

            

Reported by FlawFinder.

src/third_party/boost/boost/random/linear_congruential.hpp
8 issues
random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 36 Column: 11 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              #include <boost/random/detail/disable_warnings.hpp>

namespace boost {
namespace random {

/**
 * Instantiations of class template linear_congruential_engine model a
 * \pseudo_random_number_generator. Linear congruential pseudo-random
 * number generators are described in:

            

Reported by FlawFinder.

setstate - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 269 Column: 20 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                          if(x >= (min)() && x <= (max)()) {
                _x = x;
            } else {
                is.setstate(std::ios_base::failbit);
            }
        }
    }

    /// \endcond

            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 446 Column: 13 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                  { return !(x == y); }
private:
    /// \cond show_private
    typedef random::linear_congruential_engine<uint64_t,
        // xxxxULL is not portable
        uint64_t(0xDEECE66DUL) | (uint64_t(0x5) << 32),
        0xB, uint64_t(1)<<48> lcf_t;
    lcf_t lcf;


            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 460 Column: 7 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              
} // namespace random

using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;

} // namespace boost


            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 461 Column: 7 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              } // namespace random

using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;

} // namespace boost

#include <boost/random/detail/enable_warnings.hpp>

            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 462 Column: 7 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              
using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;

} // namespace boost

#include <boost/random/detail/enable_warnings.hpp>


            

Reported by FlawFinder.

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

Line: 253 Column: 13 CWE codes: 120 20

                  operator>>(std::basic_istream<CharT,Traits>& is,
               linear_congruential_engine& lcg)
    {
        lcg.read(is);
        return is;
    }
#endif

private:

            

Reported by FlawFinder.

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

Line: 263 Column: 10 CWE codes: 120 20

                  /// \cond show_private

    template<class CharT, class Traits>
    void read(std::basic_istream<CharT, Traits>& is) {
        IntType x;
        if(is >> x) {
            if(x >= (min)() && x <= (max)()) {
                _x = x;
            } else {

            

Reported by FlawFinder.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/virtualenv.py
8 issues
Line too long (125/100)
Error

Line: 29 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Platform/virtualenv.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import os
import sys
import SCons.Util


            

Reported by Pylint.

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

Line: 36 Column: 1

              import SCons.Util


virtualenv_enabled_by_default = False


def _enable_virtualenv_default():
    return SCons.Util.get_os_env_bool('SCONS_ENABLE_VIRTUALENV', virtualenv_enabled_by_default)


            

Reported by Pylint.

Variable name "rp" doesn't conform to snake_case naming style
Error

Line: 63 Column: 5

                  """Returns true, if **path** is located under the **base** directory."""
    if not path or not base: # empty path may happen, base too
        return False
    rp = os.path.relpath(path, base)
    return ((not rp.startswith(os.path.pardir)) and (not rp == os.path.curdir))


def _inject_venv_variables(env):
    if 'ENV' not in env:

            

Reported by Pylint.

Unnecessary parens after 'return' keyword
Error

Line: 64 Column: 1

                  if not path or not base: # empty path may happen, base too
        return False
    rp = os.path.relpath(path, base)
    return ((not rp.startswith(os.path.pardir)) and (not rp == os.path.curdir))


def _inject_venv_variables(env):
    if 'ENV' not in env:
        env['ENV'] = {}

            

Reported by Pylint.

Variable name "ENV" doesn't conform to snake_case naming style
Error

Line: 70 Column: 5

              def _inject_venv_variables(env):
    if 'ENV' not in env:
        env['ENV'] = {}
    ENV = env['ENV']
    for name in virtualenv_variables:
        try:
            ENV[name] = os.environ[name]
        except KeyError:
            pass

            

Reported by Pylint.

Function name "ImportVirtualenv" doesn't conform to snake_case naming style
Error

Line: 94 Column: 1

                  return [path for path in path_list if IsInVirtualenv(path)]


def ImportVirtualenv(env):
    """Copies virtualenv-related environment variables from OS environment
    to ``env['ENV']`` and prepends virtualenv's PATH to ``env['ENV']['PATH']``.
    """
    _inject_venv_variables(env)
    _inject_venv_path(env)

            

Reported by Pylint.

Function name "Virtualenv" doesn't conform to snake_case naming style
Error

Line: 102 Column: 1

                  _inject_venv_path(env)


def Virtualenv():
    """Returns path to the virtualenv home if scons is executing within a
    virtualenv or None, if not."""
    if _running_in_virtualenv():
        return sys.prefix
    return None

            

Reported by Pylint.

Function name "IsInVirtualenv" doesn't conform to snake_case naming style
Error

Line: 110 Column: 1

                  return None


def IsInVirtualenv(path):
    """Returns True, if **path** is under virtualenv's home directory. If not,
    or if we don't use virtualenv, returns False."""
    return _is_path_in(path, Virtualenv())



            

Reported by Pylint.

buildscripts/gdb/mongo_lock.py
8 issues
Unable to import 'gdb'
Error

Line: 6 Column: 1

              import re
import sys

import gdb
import gdb.printing

if sys.version_info[0] < 3:
    raise gdb.GdbError(
        "MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2")

            

Reported by Pylint.

Unable to import 'gdb.printing'
Error

Line: 7 Column: 1

              import sys

import gdb
import gdb.printing

if sys.version_info[0] < 3:
    raise gdb.GdbError(
        "MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2")


            

Reported by Pylint.

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

Line: 14 Column: 1

                      "MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2")


class NonExecutingThread(object):
    """NonExecutingThread class.

    Idle multi-statement transactions can hold locks that are not associated with an active
    thread. In order to generate meaningful digraphs that include these locks, we create an
    object that implements the "Thread" class interface but populates with LockerId rather than

            

Reported by Pylint.

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

Line: 43 Column: 1

                      return "LockerId {}".format(self.locker_id)


class Thread(object):
    """Thread class."""

    def __init__(self, thread_id, lwpid, thread_name):
        """Initialize Thread."""
        self.thread_id = thread_id

            

Reported by Pylint.

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

Line: 68 Column: 1

                      return "Thread 0x{:012x}".format(self.thread_id)


class Lock(object):
    """Lock class."""

    def __init__(self, addr, resource):
        """Initialize Lock."""
        self.addr = addr

            

Reported by Pylint.

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

Line: 92 Column: 1

                      return "Lock 0x{:012x}".format(self.addr)


class Graph(object):
    """Graph class.

    The Graph is a dict with the following structure:
      {'node_key': {'node': {id: val}, 'next_nodes': [node_key_1, ...]}}
    Example graph:

            

Reported by Pylint.

Variable name "sb" doesn't conform to snake_case naming style
Error

Line: 177 Column: 9

              
    def to_graph(self, nodes=None, message=None):
        """Return the 'to_graph'."""
        sb = []
        sb.append('# Legend:')
        sb.append('#    Thread 1 -> Lock C (MODE_IX) indicates Thread 1 is waiting on Lock C and'
                  ' Lock C is currently held in MODE_IX')
        sb.append('#    Lock C (MODE_IX) -> Thread 2 indicates Lock C is held by Thread 2 in'
                  ' MODE_IX')

            

Reported by Pylint.

Variable name "fh" doesn't conform to snake_case naming style
Error

Line: 439 Column: 47

                              cycle_message = "# Cycle detected in the graph nodes %s" % cycle_nodes
            if graph_file:
                print("Saving digraph to %s" % graph_file)
                with open(graph_file, 'w') as fh:
                    fh.write(graph.to_graph(nodes=cycle_nodes, message=cycle_message))
                print(cycle_message.split("# ")[1])
            else:
                print(graph.to_graph(nodes=cycle_nodes, message=cycle_message))


            

Reported by Pylint.

src/third_party/wiredtiger/lang/python/wiredtiger/init.py
8 issues
Unable to import '_wiredtiger'
Error

Line: 52 Column: 1

              
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does.  It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
    value = getattr(swig_wiredtiger, name)
    setattr(me, name, value)

            

Reported by Pylint.

Unable to import 'swig_wiredtiger'
Error

Line: 53 Column: 1

              # explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does.  It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
    value = getattr(swig_wiredtiger, name)
    setattr(me, name, value)

            

Reported by Pylint.

Unused import _wiredtiger
Error

Line: 52 Column: 1

              
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does.  It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
    value = getattr(swig_wiredtiger, name)
    setattr(me, name, value)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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

            

Reported by Pylint.

Multiple imports on one line (os, sys)
Error

Line: 35 Column: 1

              # This is needed because SWIG's import helper code created by certain SWIG
# versions may be broken, see: https://github.com/swig/swig/issues/769 .
# Importing indirectly seems to avoid these issues.
import os, sys
fname = os.path.basename(__file__)
if fname != '__init__.py' and fname != '__init__.pyc':
    print(__file__ + ': this file is not yet installed')
    sys.exit(1)


            

Reported by Pylint.

Consider merging these comparisons with "in" to "fname not in ('__init__.py', '__init__.pyc')"
Error

Line: 37 Column: 4

              # Importing indirectly seems to avoid these issues.
import os, sys
fname = os.path.basename(__file__)
if fname != '__init__.py' and fname != '__init__.pyc':
    print(__file__ + ': this file is not yet installed')
    sys.exit(1)

if sys.version_info[0] <= 2:
    print('WiredTiger requires Python version 3.0 or above')

            

Reported by Pylint.

Import "import _wiredtiger" should be placed at the top of the module
Error

Line: 52 Column: 1

              
# explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does.  It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
    value = getattr(swig_wiredtiger, name)
    setattr(me, name, value)

            

Reported by Pylint.

Import "import swig_wiredtiger" should be placed at the top of the module
Error

Line: 53 Column: 1

              # explicitly importing _wiredtiger in advance of SWIG allows us to not
# use relative importing, as SWIG does.  It doesn't work for us with Python2.
import _wiredtiger
import swig_wiredtiger
for name in dir(swig_wiredtiger):
    value = getattr(swig_wiredtiger, name)
    setattr(me, name, value)

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Platform/darwin.py
8 issues
Attempted relative import beyond top-level package
Error

Line: 35 Column: 1

              
__revision__ = "src/engine/SCons/Platform/darwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

from . import posix
import os

def generate(env):
    posix.generate(env)
    env['SHLIBSUFFIX'] = '.dylib'

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 51 Column: 5

                  # make sure this works on Macs with Tiger or earlier
    try:
        dirlist = os.listdir('/etc/paths.d')
    except:
        dirlist = []

    for file in dirlist:
        filelist.append('/etc/paths.d/'+file)


            

Reported by Pylint.

Line too long (121/100)
Error

Line: 33 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Platform/darwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

from . import posix
import os

def generate(env):

            

Reported by Pylint.

standard import "import os" should be placed before "from . import posix"
Error

Line: 36 Column: 1

              __revision__ = "src/engine/SCons/Platform/darwin.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

from . import posix
import os

def generate(env):
    posix.generate(env)
    env['SHLIBSUFFIX'] = '.dylib'
    # put macports paths at front to override Apple's versions, fink path is after

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 38 Column: 1

              from . import posix
import os

def generate(env):
    posix.generate(env)
    env['SHLIBSUFFIX'] = '.dylib'
    # put macports paths at front to override Apple's versions, fink path is after
    # For now let people who want Macports or Fink tools specify it!
    # env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'

            

Reported by Pylint.

Trailing whitespace
Error

Line: 44 Column: 1

                  # put macports paths at front to override Apple's versions, fink path is after
    # For now let people who want Macports or Fink tools specify it!
    # env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'
    
    # Store extra system paths in env['ENV']['PATHOSX']
    
    filelist = ['/etc/paths',]
    # make sure this works on Macs with Tiger or earlier
    try:

            

Reported by Pylint.

Trailing whitespace
Error

Line: 46 Column: 1

                  # env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'
    
    # Store extra system paths in env['ENV']['PATHOSX']
    
    filelist = ['/etc/paths',]
    # make sure this works on Macs with Tiger or earlier
    try:
        dirlist = os.listdir('/etc/paths.d')
    except:

            

Reported by Pylint.

Variable name "f" doesn't conform to snake_case naming style
Error

Line: 59 Column: 37

              
    for file in filelist:
        if os.path.isfile(file):
            with open(file, 'r') as f:
                lines = f.readlines()
                for line in lines:
                    if line:
                        env.AppendENVPath('PATHOSX', line.strip('\n'))


            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/suite_random.py
8 issues
Module 'wttest' has no 'getRandomSeed' member
Error

Line: 60 Column: 28

                      w = self.seedw
        z = self.seedz
        if w == 0 or z == 0:
            seedw, seedz = wttest.getRandomSeed()
            self.seedw = int(seedw) & 0xffffffff
            self.seedz = int(seedz) & 0xffffffff

        self.seedz = (36969 * (z & 65535) + (z >> 16)) & 0xffffffff
        self.seedw = (18000 * (w & 65535) + (w >> 16)) & 0xffffffff

            

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.

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

Line: 33 Column: 1

              #    A quick and predictable pseudo random number generator.
import wttest

class suite_random:
    """
    Generate random 32 bit integers that are predictable,
    and use no global state.  We use the Multiply-with-carry
    method invented by George Marsaglia, because it is quick
    and easy to implement.

            

Reported by Pylint.

Variable name "w" doesn't conform to snake_case naming style
Error

Line: 57 Column: 9

                      """
        returns a random 32 bit integer
        """
        w = self.seedw
        z = self.seedz
        if w == 0 or z == 0:
            seedw, seedz = wttest.getRandomSeed()
            self.seedw = int(seedw) & 0xffffffff
            self.seedz = int(seedz) & 0xffffffff

            

Reported by Pylint.

Variable name "z" doesn't conform to snake_case naming style
Error

Line: 58 Column: 9

                      returns a random 32 bit integer
        """
        w = self.seedw
        z = self.seedz
        if w == 0 or z == 0:
            seedw, seedz = wttest.getRandomSeed()
            self.seedw = int(seedw) & 0xffffffff
            self.seedz = int(seedz) & 0xffffffff


            

Reported by Pylint.

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

Line: 68 Column: 5

                      self.seedw = (18000 * (w & 65535) + (w >> 16)) & 0xffffffff
        return ((z << 16) + (w & 65535)) & 0xffffffff

    def rand_range(self, n, m):
        """
        returns a random integer in the range [N,M).
        """
        if m > 0xffffffff or n < 0:
            raise ValueError("rand32_range expects args between 0 , 2^32")

            

Reported by Pylint.

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

Line: 68 Column: 5

                      self.seedw = (18000 * (w & 65535) + (w >> 16)) & 0xffffffff
        return ((z << 16) + (w & 65535)) & 0xffffffff

    def rand_range(self, n, m):
        """
        returns a random integer in the range [N,M).
        """
        if m > 0xffffffff or n < 0:
            raise ValueError("rand32_range expects args between 0 , 2^32")

            

Reported by Pylint.

Variable name "r" doesn't conform to snake_case naming style
Error

Line: 76 Column: 9

                          raise ValueError("rand32_range expects args between 0 , 2^32")
        if n >= m:
            raise ValueError("rand32_range(n,m) expects n < m")
        r = self.rand32()
        return (r % (m - n)) + n

    def rand_float(self):
        """
        returns a random floating point value between 0 and 1.0

            

Reported by Pylint.

src/third_party/boost/boost/multi_index/detail/iter_adaptor.hpp
8 issues
equal - Function does not check the second iterator for over-read conditions
Security

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

                }

  template<class Class>
  static bool equal(const Class& x,const Class& y)
  {
    return x.equal(y);
  }

  template<class Class>

            

Reported by FlawFinder.

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

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

                template<class Class>
  static bool equal(const Class& x,const Class& y)
  {
    return x.equal(y);
  }

  template<class Class>
  static void increment(Class& x)
  {

            

Reported by FlawFinder.

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

Line: 101 Column: 33 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

              
  friend bool operator==(const Derived& x,const Derived& y)
  {
    return iter_adaptor_access::equal(x,y);
  }

  Derived& operator++()
  {
    iter_adaptor_access::increment(final());

            

Reported by FlawFinder.

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

Line: 120 Column: 31 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

                const forward_iter_adaptor_base<Derived,Base>& x,
  const forward_iter_adaptor_base<Derived,Base>& y)
{
  return iter_adaptor_access::equal(
    static_cast<const Derived&>(x),static_cast<const Derived&>(y));
}

template<>
struct iter_adaptor_selector<std::forward_iterator_tag>

            

Reported by FlawFinder.

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

Line: 153 Column: 33 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

              
  friend bool operator==(const Derived& x,const Derived& y)
  {
    return iter_adaptor_access::equal(x,y);
  }

  Derived& operator++()
  {
    iter_adaptor_access::increment(final());

            

Reported by FlawFinder.

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

Line: 178 Column: 31 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

                const bidirectional_iter_adaptor_base<Derived,Base>& x,
  const bidirectional_iter_adaptor_base<Derived,Base>& y)
{
  return iter_adaptor_access::equal(
    static_cast<const Derived&>(x),static_cast<const Derived&>(y));
}

template<>
struct iter_adaptor_selector<std::bidirectional_iterator_tag>

            

Reported by FlawFinder.

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

Line: 212 Column: 33 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

              
  friend bool operator==(const Derived& x,const Derived& y)
  {
    return iter_adaptor_access::equal(x,y);
  }

  friend bool operator<(const Derived& x,const Derived& y)
  {
    return iter_adaptor_access::distance_to(x,y)>0;

            

Reported by FlawFinder.

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

Line: 259 Column: 31 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

                const random_access_iter_adaptor_base<Derived,Base>& x,
  const random_access_iter_adaptor_base<Derived,Base>& y)
{
  return iter_adaptor_access::equal(
    static_cast<const Derived&>(x),static_cast<const Derived&>(y));
}

template<class Derived,class Base>
bool operator<(

            

Reported by FlawFinder.