The following issues were found

tests/import/import1b.py
3 issues
Constant name "var" doesn't conform to UPPER_CASE naming style
Error

Line: 1 Column: 1

              var = 123


def throw():
    raise ValueError

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              var = 123


def throw():
    raise ValueError

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              var = 123


def throw():
    raise ValueError

            

Reported by Pylint.

tests/basics/int_big_or2.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test + + 
print( 97989513389222316022151446562729620153292831887555425160965597396
     | 23716683549865351578586448630079789776107310103486834795830390982)

print( 53817081128841898634258263553430908085326601592682411889506742059
     | 37042558948907407488299113387826240429667200950043601129661240876)

print( 26167512042587370698808974207700979337713004510730289760097826496
     | 98456276326770292376138852628141531773120376436197321310863125849)

            

Reported by Pylint.

Trailing whitespace
Error

Line: 1 Column: 11

              # test + + 
print( 97989513389222316022151446562729620153292831887555425160965597396
     | 23716683549865351578586448630079789776107310103486834795830390982)

print( 53817081128841898634258263553430908085326601592682411889506742059
     | 37042558948907407488299113387826240429667200950043601129661240876)

print( 26167512042587370698808974207700979337713004510730289760097826496
     | 98456276326770292376138852628141531773120376436197321310863125849)

            

Reported by Pylint.

Trailing whitespace
Error

Line: 26 Column: 11

              print( 40019818573920230246248826511203818792007462193311949166285967147
     | 9487909752)

# test - - 

print( -97989513389222316022151446562729620153292831887555425160965597396
     | -23716683549865351578586448630079789776107310103486834795830390982)

print( -53817081128841898634258263553430908085326601592682411889506742059

            

Reported by Pylint.

tests/basics/fun_str.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test str of function

def f():
    pass
print(str(f)[:8])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # test str of function

def f():
    pass
print(str(f)[:8])

            

Reported by Pylint.

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

Line: 3 Column: 1

              # test str of function

def f():
    pass
print(str(f)[:8])

            

Reported by Pylint.

examples/hwapi/hwconfig_z_96b_carbon.py
3 issues
Unable to import 'machine'
Error

Line: 1 Column: 1

              from machine import Signal

# 96Boards Carbon board
# USR1 - User controlled led, connected to PD2
# USR2 - User controlled led, connected to PA15
# BT - Bluetooth indicator, connected to PB5.
# Note - 96b_carbon uses (at the time of writing) non-standard
# for Zephyr port device naming convention.
LED = Signal(("GPIOA", 15), Pin.OUT)

            

Reported by Pylint.

Undefined variable 'Pin'
Error

Line: 9 Column: 29

              # BT - Bluetooth indicator, connected to PB5.
# Note - 96b_carbon uses (at the time of writing) non-standard
# for Zephyr port device naming convention.
LED = Signal(("GPIOA", 15), Pin.OUT)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from machine import Signal

# 96Boards Carbon board
# USR1 - User controlled led, connected to PD2
# USR2 - User controlled led, connected to PA15
# BT - Bluetooth indicator, connected to PB5.
# Note - 96b_carbon uses (at the time of writing) non-standard
# for Zephyr port device naming convention.
LED = Signal(("GPIOA", 15), Pin.OUT)

            

Reported by Pylint.

ports/unix/variants/manifest.py
3 issues
Undefined variable 'freeze_as_mpy'
Error

Line: 1 Column: 1

              freeze_as_mpy('$(MPY_DIR)/tools', 'upip.py')
freeze_as_mpy('$(MPY_DIR)/tools', 'upip_utarfile.py', opt=3)

            

Reported by Pylint.

Undefined variable 'freeze_as_mpy'
Error

Line: 2 Column: 1

              freeze_as_mpy('$(MPY_DIR)/tools', 'upip.py')
freeze_as_mpy('$(MPY_DIR)/tools', 'upip_utarfile.py', opt=3)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              freeze_as_mpy('$(MPY_DIR)/tools', 'upip.py')
freeze_as_mpy('$(MPY_DIR)/tools', 'upip_utarfile.py', opt=3)

            

Reported by Pylint.

tests/cpydiff/modules_random_randint.py
3 issues
Line too long (142/100)
Error

Line: 4 Column: 1

              """
categories: Modules,random
description: ``randint`` method can only return an integer that is at most the native word size.
cause: PRNG is only able to generate 32 bits of state at a time. The result is then cast into a native sized int instead of a full int object.
workaround: If you need integers larger than native wordsize use the random module from micropython-lib.
"""

import random


            

Reported by Pylint.

Line too long (104/100)
Error

Line: 5 Column: 1

              categories: Modules,random
description: ``randint`` method can only return an integer that is at most the native word size.
cause: PRNG is only able to generate 32 bits of state at a time. The result is then cast into a native sized int instead of a full int object.
workaround: If you need integers larger than native wordsize use the random module from micropython-lib.
"""

import random



            

Reported by Pylint.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 11
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

              import random


x = random.randint(2 ** 128 - 1, 2 ** 128)
print("x={}".format(x))

            

Reported by Bandit.

tests/basics/set_iter.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              s = {1, 2, 3, 4}
l = list(s)
l.sort()
print(l)


            

Reported by Pylint.

Trailing newlines
Error

Line: 5 Column: 1

              l = list(s)
l.sort()
print(l)


            

Reported by Pylint.

tests/extmod/uhashlib_final.py
2 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 5 Column: 5

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


for algo_name in ("md5", "sha1", "sha256"):
    algo = getattr(uhashlib, algo_name, None)
    if not algo:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              try:
    import uhashlib
except ImportError:
    print("SKIP")
    raise SystemExit


for algo_name in ("md5", "sha1", "sha256"):
    algo = getattr(uhashlib, algo_name, None)

            

Reported by Pylint.

tests/thread/thread_lock1.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test _thread lock object using a single thread
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd

import _thread

# create lock
lock = _thread.allocate_lock()


            

Reported by Pylint.

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

Line: 10 Column: 7

              # create lock
lock = _thread.allocate_lock()

print(type(lock) == _thread.LockType)

# should be unlocked
print(lock.locked())

# basic acquire and release

            

Reported by Pylint.

tests/thread/thread_lock2.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test _thread lock objects with multiple threads
#
# 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: 14 Column: 1

              lock = _thread.allocate_lock()


def thread_entry():
    lock.acquire()
    print("have it")
    lock.release()



            

Reported by Pylint.