The following issues were found

tests/multi_net/uasyncio_tcp_client_rst.py
18 issues
Undefined variable 'multitest'
Error

Line: 35 Column: 5

                  global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)


def instance0():

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 41 Column: 26

              

def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    asyncio.run(main())


def instance1():
    if not hasattr(socket, "SO_LINGER"):

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 41 Column: 5

              

def instance0():
    multitest.globals(IP=multitest.get_network_ip())
    asyncio.run(main())


def instance1():
    if not hasattr(socket, "SO_LINGER"):

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 47 Column: 9

              
def instance1():
    if not hasattr(socket, "SO_LINGER"):
        multitest.skip()
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    lgr_onoff = 1
    lgr_linger = 0

            

Reported by Pylint.

Undefined variable 'multitest'
Error

Line: 48 Column: 5

              def instance1():
    if not hasattr(socket, "SO_LINGER"):
        multitest.skip()
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    lgr_onoff = 1
    lgr_linger = 0
    s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", lgr_onoff, lgr_linger))

            

Reported by Pylint.

Undefined variable 'IP'
Error

Line: 50 Column: 34

                      multitest.skip()
    multitest.next()
    s = socket.socket()
    s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
    lgr_onoff = 1
    lgr_linger = 0
    s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", lgr_onoff, lgr_linger))
    s.send(b"GET / HTTP/1.0\r\n\r\n")
    time.sleep(0.1)

            

Reported by Pylint.

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

Line: 10 Column: 9

                      import asyncio
    except ImportError:
        print("SKIP")
        raise SystemExit

import struct, time, socket

PORT = 8000


            

Reported by Pylint.

Global variable 'ev' undefined at the module level
Error

Line: 32 Column: 5

              

async def main():
    global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)

            

Reported by Pylint.

Possible binding to all interfaces.
Security

Line: 34
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b104_hardcoded_bind_all_interfaces.html

              async def main():
    global ev
    ev = asyncio.Event()
    server = await asyncio.start_server(handle_connection, "0.0.0.0", PORT)
    multitest.next()
    async with server:
        await asyncio.wait_for(ev.wait(), 10)



            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # Test TCP server with client issuing TCP RST part way through read

try:
    import uasyncio as asyncio
except ImportError:
    try:
        import asyncio
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

tests/thread/mutate_bytearray.py
18 issues
Undefined variable 'n_finished'
Error

Line: 24 Column: 9

              
    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0

            

Reported by Pylint.

Unused variable 'repeat'
Error

Line: 12 Column: 9

              
# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1


            

Reported by Pylint.

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

Line: 13 Column: 13

              # main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            l = len(ba)

            

Reported by Pylint.

Using the global statement
Error

Line: 23 Column: 9

                          assert len(ba) >= l + 1

    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 4

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test concurrent mutating access to a shared bytearray object
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread

# the shared bytearray
ba = bytearray()


            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

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

Line: 11 Column: 1

              ba = bytearray()

# main thread function
def th(n, lo, hi):
    for repeat in range(n):
        for i in range(lo, hi):
            l = len(ba)
            ba.append(i)
            assert len(ba) >= l + 1

            

Reported by Pylint.

tests/basics/class_bases.py
18 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test for type.__bases__ implementation

if not hasattr(object, '__bases__'):
    print("SKIP")
    raise SystemExit

class A:
    pass


            

Reported by Pylint.

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

Line: 7 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    pass

class B(object):
    pass


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 7 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    pass

class B(object):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

                  print("SKIP")
    raise SystemExit

class A:
    pass

class B(object):
    pass


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

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

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

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

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              class A:
    pass

class B(object):
    pass

class C(B):
    pass


            

Reported by Pylint.

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

Line: 13 Column: 1

              class B(object):
    pass

class C(B):
    pass

class D(C, A):
    pass


            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

              class B(object):
    pass

class C(B):
    pass

class D(C, A):
    pass


            

Reported by Pylint.

tests/float/float1.py
18 issues
bad operand type for unary ~: float
Error

Line: 98 Column: 5

              # unsupported unary ops

try:
    ~1.2
except TypeError:
    print("TypeError")

try:
    1.2 in 3.4

            

Reported by Pylint.

Value '3.4' doesn't support membership test
Error

Line: 103 Column: 12

                  print("TypeError")

try:
    1.2 in 3.4
except TypeError:
    print("TypeError")

# small int on LHS, float on RHS, unsupported op
try:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test basic float capabilities

# literals
print(0.12)
print(1.0)
print(1.2)
print(0e0)
print(0e0)
print(0e-0)

            

Reported by Pylint.

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

Line: 50 Column: 1

              print(-(1.2))

# division of integers
x = 1 / 2
print(x)

# /= operator
a = 1
a /= 2

            

Reported by Pylint.

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

Line: 54 Column: 1

              print(x)

# /= operator
a = 1
a /= 2
print(a)

# floor division
print(1.0 // 2)

            

Reported by Pylint.

Comparison should be -3.4 >= 1.2
Error

Line: 64 Column: 7

              
# comparison
print(1.2 <= 3.4)
print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)


            

Reported by Pylint.

Comparison should be -3.4 <= 1.2
Error

Line: 66 Column: 7

              print(1.2 <= 3.4)
print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")

            

Reported by Pylint.

Redundant comparison - 0.0 == False
Error

Line: 67 Column: 7

              print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")
print(nan == 1.2)

            

Reported by Pylint.

Comparison '1.0 == True' should be '1.0 is True' if checking for the singleton value True, or 'bool(1.0)' if testing for truthiness
Error

Line: 67 Column: 21

              print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")
print(nan == 1.2)

            

Reported by Pylint.

Redundant comparison - 1.0 == True
Error

Line: 67 Column: 21

              print(1.2 <= -3.4)
print(1.2 >= 3.4)
print(1.2 >= -3.4)
print(0.0 == False, 1.0 == True)
print(False == 0.0, True == 1.0)

# comparison of nan is special
nan = float("nan")
print(nan == 1.2)

            

Reported by Pylint.

tests/basics/builtin_callable.py
18 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test builtin callable

# primitives should not be callable
print(callable(None))
print(callable(1))
print(callable([]))
print(callable("dfsd"))

# modules should not be callabe

            

Reported by Pylint.

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

Line: 23 Column: 1

              print(callable(lambda:None))

# user defined functions should be callable
def f():
    pass
print(callable(f))

# types should be callable, but not instances
class A:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 23 Column: 1

              print(callable(lambda:None))

# user defined functions should be callable
def f():
    pass
print(callable(f))

# types should be callable, but not instances
class A:

            

Reported by Pylint.

Missing class docstring
Error

Line: 28 Column: 1

              print(callable(f))

# types should be callable, but not instances
class A:
    pass
print(callable(A))
print(callable(A()))

# instances with __call__ method should be callable

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 28 Column: 1

              print(callable(f))

# types should be callable, but not instances
class A:
    pass
print(callable(A))
print(callable(A()))

# instances with __call__ method should be callable

            

Reported by Pylint.

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

Line: 28 Column: 1

              print(callable(f))

# types should be callable, but not instances
class A:
    pass
print(callable(A))
print(callable(A()))

# instances with __call__ method should be callable

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 34 Column: 1

              print(callable(A()))

# instances with __call__ method should be callable
class B:
    def __call__(self):
        pass
print(callable(B()))

# this checks internal use of callable when extracting members from an instance

            

Reported by Pylint.

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

Line: 34 Column: 1

              print(callable(A()))

# instances with __call__ method should be callable
class B:
    def __call__(self):
        pass
print(callable(B()))

# this checks internal use of callable when extracting members from an instance

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              print(callable(A()))

# instances with __call__ method should be callable
class B:
    def __call__(self):
        pass
print(callable(B()))

# this checks internal use of callable when extracting members from an instance

            

Reported by Pylint.

Missing class docstring
Error

Line: 40 Column: 1

              print(callable(B()))

# this checks internal use of callable when extracting members from an instance
class C:
    def f(self):
        return "A.f"
class D:
    g = C() # g is a value and is not callable
print(callable(D().g))

            

Reported by Pylint.

ports/stm32/dma.c
18 issues
Array 'dma_handle[7]' accessed at index 7, which is out of bounds.
Error

Line: 677 CWE codes: 788

              }
void DMA1_Stream7_IRQHandler(void) {
    IRQ_ENTER(DMA1_Stream7_IRQn);
    if (dma_handle[dma_id_7] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_7]);
    }
    IRQ_EXIT(DMA1_Stream7_IRQn);
}
void DMA2_Stream0_IRQHandler(void) {

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 7, which is out of bounds.
Error

Line: 678 CWE codes: 788

              void DMA1_Stream7_IRQHandler(void) {
    IRQ_ENTER(DMA1_Stream7_IRQn);
    if (dma_handle[dma_id_7] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_7]);
    }
    IRQ_EXIT(DMA1_Stream7_IRQn);
}
void DMA2_Stream0_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream0_IRQn);

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 8, which is out of bounds.
Error

Line: 684 CWE codes: 788

              }
void DMA2_Stream0_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream0_IRQn);
    if (dma_handle[dma_id_8] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_8]);
    }
    IRQ_EXIT(DMA2_Stream0_IRQn);
}
void DMA2_Stream1_IRQHandler(void) {

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 8, which is out of bounds.
Error

Line: 685 CWE codes: 788

              void DMA2_Stream0_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream0_IRQn);
    if (dma_handle[dma_id_8] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_8]);
    }
    IRQ_EXIT(DMA2_Stream0_IRQn);
}
void DMA2_Stream1_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream1_IRQn);

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 9, which is out of bounds.
Error

Line: 691 CWE codes: 788

              }
void DMA2_Stream1_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream1_IRQn);
    if (dma_handle[dma_id_9] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_9]);
    }
    IRQ_EXIT(DMA2_Stream1_IRQn);
}
void DMA2_Stream2_IRQHandler(void) {

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 9, which is out of bounds.
Error

Line: 692 CWE codes: 788

              void DMA2_Stream1_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream1_IRQn);
    if (dma_handle[dma_id_9] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_9]);
    }
    IRQ_EXIT(DMA2_Stream1_IRQn);
}
void DMA2_Stream2_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream2_IRQn);

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 10, which is out of bounds.
Error

Line: 698 CWE codes: 788

              }
void DMA2_Stream2_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream2_IRQn);
    if (dma_handle[dma_id_10] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_10]);
    }
    IRQ_EXIT(DMA2_Stream2_IRQn);
}
void DMA2_Stream3_IRQHandler(void) {

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 10, which is out of bounds.
Error

Line: 699 CWE codes: 788

              void DMA2_Stream2_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream2_IRQn);
    if (dma_handle[dma_id_10] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_10]);
    }
    IRQ_EXIT(DMA2_Stream2_IRQn);
}
void DMA2_Stream3_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream3_IRQn);

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 11, which is out of bounds.
Error

Line: 705 CWE codes: 788

              }
void DMA2_Stream3_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream3_IRQn);
    if (dma_handle[dma_id_11] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_11]);
    }
    IRQ_EXIT(DMA2_Stream3_IRQn);
}
void DMA2_Stream4_IRQHandler(void) {

            

Reported by Cppcheck.

Array 'dma_handle[7]' accessed at index 11, which is out of bounds.
Error

Line: 706 CWE codes: 788

              void DMA2_Stream3_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream3_IRQn);
    if (dma_handle[dma_id_11] != NULL) {
        HAL_DMA_IRQHandler(dma_handle[dma_id_11]);
    }
    IRQ_EXIT(DMA2_Stream3_IRQn);
}
void DMA2_Stream4_IRQHandler(void) {
    IRQ_ENTER(DMA2_Stream4_IRQn);

            

Reported by Cppcheck.

tests/extmod/vfs_lfs_mtime.py
18 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import utime, uos

    utime.time
    utime.sleep
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import utime, uos

    utime.time
    utime.sleep
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 8 Column: 5

              
    utime.time
    utime.sleep
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 11 Column: 5

                  uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 30 Column: 25

                      for i in range(len(buf)):
            self.data[addr + i] = buf[i]

    def ioctl(self, op, arg):
        if op == 4:  # block count
            return len(self.data) // self.ERASE_BLOCK_SIZE
        if op == 5:  # block size
            return self.ERASE_BLOCK_SIZE
        if op == 6:  # erase block

            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 104)
Error

Line: 39 Column: 10

                          return 0


def test(bdev, vfs_class):
    print("test", vfs_class)

    # Initial format of block device.
    vfs_class.mkfs(bdev)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test for VfsLfs using a RAM device, mtime feature

try:
    import utime, uos

    utime.time
    utime.sleep
    uos.VfsLfs2
except (ImportError, AttributeError):

            

Reported by Pylint.

Multiple imports on one line (utime, uos)
Error

Line: 4 Column: 5

              # Test for VfsLfs using a RAM device, mtime feature

try:
    import utime, uos

    utime.time
    utime.sleep
    uos.VfsLfs2
except (ImportError, AttributeError):

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

                  raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024

    def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 5

                  def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)

    def readblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):

            

Reported by Pylint.

tests/inlineasm/asmrettype.py
18 issues
Undefined variable 'micropython'
Error

Line: 4 Column: 2

              # test return type of inline asm


@micropython.asm_thumb
def ret_obj(r0) -> object:
    pass


ret_obj(print)(1)

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 12 Column: 2

              ret_obj(print)(1)


@micropython.asm_thumb
def ret_bool(r0) -> bool:
    pass


print(ret_bool(0), ret_bool(1))

            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 20 Column: 2

              print(ret_bool(0), ret_bool(1))


@micropython.asm_thumb
def ret_int(r0) -> int:
    lsl(r0, r0, 29)


print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4)))

            

Reported by Pylint.

Undefined variable 'lsl'
Error

Line: 22 Column: 5

              
@micropython.asm_thumb
def ret_int(r0) -> int:
    lsl(r0, r0, 29)


print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4)))



            

Reported by Pylint.

Undefined variable 'micropython'
Error

Line: 28 Column: 2

              print(ret_int(0), hex(ret_int(1)), hex(ret_int(2)), hex(ret_int(4)))


@micropython.asm_thumb
def ret_uint(r0) -> uint:
    lsl(r0, r0, 29)


print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4)))

            

Reported by Pylint.

Undefined variable 'uint'
Error

Line: 29 Column: 21

              

@micropython.asm_thumb
def ret_uint(r0) -> uint:
    lsl(r0, r0, 29)


print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4)))

            

Reported by Pylint.

Undefined variable 'lsl'
Error

Line: 30 Column: 5

              
@micropython.asm_thumb
def ret_uint(r0) -> uint:
    lsl(r0, r0, 29)


print(ret_uint(0), hex(ret_uint(1)), hex(ret_uint(2)), hex(ret_uint(4)))

            

Reported by Pylint.

Unused argument 'r0'
Error

Line: 5 Column: 13

              

@micropython.asm_thumb
def ret_obj(r0) -> object:
    pass


ret_obj(print)(1)


            

Reported by Pylint.

Unused argument 'r0'
Error

Line: 13 Column: 14

              

@micropython.asm_thumb
def ret_bool(r0) -> bool:
    pass


print(ret_bool(0), ret_bool(1))


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test return type of inline asm


@micropython.asm_thumb
def ret_obj(r0) -> object:
    pass


ret_obj(print)(1)

            

Reported by Pylint.

tests/extmod/vfs_lfs_error.py
18 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              try:
    import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 7 Column: 5

                  import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit



            

Reported by Pylint.

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

Line: 10 Column: 5

                  uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")
    raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024


            

Reported by Pylint.

Unused argument 'arg'
Error

Line: 29 Column: 25

                      for i in range(len(buf)):
            self.data[addr + i] = buf[i]

    def ioctl(self, op, arg):
        if op == 4:  # block count
            return len(self.data) // self.ERASE_BLOCK_SIZE
        if op == 5:  # block size
            return self.ERASE_BLOCK_SIZE
        if op == 6:  # erase block

            

Reported by Pylint.

Redefining name 'bdev' from outer scope (line 119)
Error

Line: 38 Column: 10

                          return 0


def test(bdev, vfs_class):
    print("test", vfs_class)

    # mkfs with too-small block device
    try:
        vfs_class.mkfs(RAMBlockDevice(1))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test for VfsLittle using a RAM device, testing error handling

try:
    import uos

    uos.VfsLfs1
    uos.VfsLfs2
except (ImportError, AttributeError):
    print("SKIP")

            

Reported by Pylint.

Missing class docstring
Error

Line: 13 Column: 1

                  raise SystemExit


class RAMBlockDevice:
    ERASE_BLOCK_SIZE = 1024

    def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                  def __init__(self, blocks):
        self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE)

    def readblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):

            

Reported by Pylint.

Consider using enumerate instead of iterating with range and len
Error

Line: 21 Column: 9

              
    def readblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 5

                      for i in range(len(buf)):
            buf[i] = self.data[addr + i]

    def writeblocks(self, block, buf, off):
        addr = block * self.ERASE_BLOCK_SIZE + off
        for i in range(len(buf)):
            self.data[addr + i] = buf[i]

    def ioctl(self, op, arg):

            

Reported by Pylint.

tests/thread/thread_qstr1.py
18 issues
Undefined variable 'n_finished'
Error

Line: 25 Column: 9

              
    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0

            

Reported by Pylint.

Redefining name 'i' from outer scope (line 34)
Error

Line: 19 Column: 9

              
# main thread function
def th(base, n):
    for i in range(n):
        # this will intern the string and check it
        exec("check('%u', %u)" % (base + i, base + i))

    with lock:
        global n_finished

            

Reported by Pylint.

Use of exec detected.
Security

Line: 21
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html

              def th(base, n):
    for i in range(n):
        # this will intern the string and check it
        exec("check('%u', %u)" % (base + i, base + i))

    with lock:
        global n_finished
        n_finished += 1


            

Reported by Bandit.

Use of exec
Error

Line: 21 Column: 9

              def th(base, n):
    for i in range(n):
        # this will intern the string and check it
        exec("check('%u', %u)" % (base + i, base + i))

    with lock:
        global n_finished
        n_finished += 1


            

Reported by Pylint.

Using the global statement
Error

Line: 24 Column: 9

                      exec("check('%u', %u)" % (base + i, base + i))

    with lock:
        global n_finished
        n_finished += 1


lock = _thread.allocate_lock()
n_thread = 4

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test concurrent interning of strings
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

try:
    import utime as time
except ImportError:
    import time
import _thread

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

              import _thread

# function to check the interned string
def check(s, val):
    assert type(s) == str
    assert int(s) == val


# main thread function

            

Reported by Pylint.

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

Line: 12 Column: 1

              import _thread

# function to check the interned string
def check(s, val):
    assert type(s) == str
    assert int(s) == val


# main thread function

            

Reported by Pylint.

Using type() instead of isinstance() for a typecheck.
Error

Line: 13 Column: 12

              
# function to check the interned string
def check(s, val):
    assert type(s) == str
    assert int(s) == val


# main thread function
def th(base, n):

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 13
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
# function to check the interned string
def check(s, val):
    assert type(s) == str
    assert int(s) == val


# main thread function
def th(base, n):

            

Reported by Bandit.