The following issues were found

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

Line: 1 Column: 1

              # basic multiplication
print('0' * 5)

# check negative, 0, positive; lhs and rhs multiplication
for i in (-4, -2, 0, 2, 4):
    print(i * '12')
    print('12' * i)

# check that we don't modify existing object

            

Reported by Pylint.

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

Line: 10 Column: 1

                  print('12' * i)

# check that we don't modify existing object
a = '123'
c = a * 3
print(a, c)

            

Reported by Pylint.

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

Line: 11 Column: 1

              
# check that we don't modify existing object
a = '123'
c = a * 3
print(a, c)

            

Reported by Pylint.

tests/import/module_getattr.py
3 issues
Statement seems to have no effect
Error

Line: 6 Column: 5

              # ensure that does_not_exist doesn't exist to start with
this = __import__(__name__)
try:
    this.does_not_exist
    assert False
except AttributeError:
    pass

# define __getattr__

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test __getattr__ on module

# ensure that does_not_exist doesn't exist to start with
this = __import__(__name__)
try:
    this.does_not_exist
    assert False
except AttributeError:
    pass

            

Reported by Pylint.

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

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

              this = __import__(__name__)
try:
    this.does_not_exist
    assert False
except AttributeError:
    pass

# define __getattr__
def __getattr__(attr):

            

Reported by Bandit.

tests/pyb/board_pybv1x.py
3 issues
Unable to import 'pyb'
Error

Line: 3 Column: 1

              # Test board-specific items on PYBv1.x

import os, pyb

if not "PYBv1." in os.uname().machine:
    print("SKIP")
    raise SystemExit

# test creating UART by id/name

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Test board-specific items on PYBv1.x

import os, pyb

if not "PYBv1." in os.uname().machine:
    print("SKIP")
    raise SystemExit

# test creating UART by id/name

            

Reported by Pylint.

Multiple imports on one line (os, pyb)
Error

Line: 3 Column: 1

              # Test board-specific items on PYBv1.x

import os, pyb

if not "PYBv1." in os.uname().machine:
    print("SKIP")
    raise SystemExit

# test creating UART by id/name

            

Reported by Pylint.

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

Line: 1 Column: 1

              # Test calling non-special method inherited from native type

class mytuple(tuple):
    pass

t = mytuple((1, 2, 3))
print(t)
print(t == (1, 2, 3))
print((1, 2, 3) == t)

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # Test calling non-special method inherited from native type

class mytuple(tuple):
    pass

t = mytuple((1, 2, 3))
print(t)
print(t == (1, 2, 3))
print((1, 2, 3) == t)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # Test calling non-special method inherited from native type

class mytuple(tuple):
    pass

t = mytuple((1, 2, 3))
print(t)
print(t == (1, 2, 3))
print((1, 2, 3) == t)

            

Reported by Pylint.

examples/micropython.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # micropython module placeholder for CPython

# Dummy function decorators


def nodecor(x):
    return x



            

Reported by Pylint.

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

Line: 6 Column: 1

              # Dummy function decorators


def nodecor(x):
    return x


bytecode = native = viper = nodecor

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              # Dummy function decorators


def nodecor(x):
    return x


bytecode = native = viper = nodecor

            

Reported by Pylint.

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

Line: 1 Column: 1

              # test when we subclass a type with the buffer protocol

class my_bytes(bytes):
    pass

b1 = my_bytes([0, 1])
b2 = my_bytes([2, 3])
b3 = bytes([4, 5])


            

Reported by Pylint.

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

Line: 3 Column: 1

              # test when we subclass a type with the buffer protocol

class my_bytes(bytes):
    pass

b1 = my_bytes([0, 1])
b2 = my_bytes([2, 3])
b3 = bytes([4, 5])


            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # test when we subclass a type with the buffer protocol

class my_bytes(bytes):
    pass

b1 = my_bytes([0, 1])
b2 = my_bytes([2, 3])
b3 = bytes([4, 5])


            

Reported by Pylint.

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

Line: 1 Column: 1

              # Test calling non-special method inherited from native type

class mylist(list):
    pass

l = mylist([1, 2, 3])
print(l)
l.append(10)
print(l)

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              # Test calling non-special method inherited from native type

class mylist(list):
    pass

l = mylist([1, 2, 3])
print(l)
l.append(10)
print(l)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # Test calling non-special method inherited from native type

class mylist(list):
    pass

l = mylist([1, 2, 3])
print(l)
l.append(10)
print(l)

            

Reported by Pylint.

tests/basics/int_big_xor3.py
3 issues
Trailing whitespace
Error

Line: 1 Column: 11

              # test - + 

print( -97989513389222316022151446562729620153292831887555425160965597396
     ^ 23716683549865351578586448630079789776107310103486834795830390982)

print( -53817081128841898634258263553430908085326601592682411889506742059
     ^ 37042558948907407488299113387826240429667200950043601129661240876)

print( -26167512042587370698808974207700979337713004510730289760097826496

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test - + 

print( -97989513389222316022151446562729620153292831887555425160965597396
     ^ 23716683549865351578586448630079789776107310103486834795830390982)

print( -53817081128841898634258263553430908085326601592682411889506742059
     ^ 37042558948907407488299113387826240429667200950043601129661240876)

print( -26167512042587370698808974207700979337713004510730289760097826496

            

Reported by Pylint.

Trailing whitespace
Error

Line: 27 Column: 11

              print( -40019818573920230246248826511203818792007462193311949166285967147
     ^ 9487909752)

# test + - 

print( 97989513389222316022151446562729620153292831887555425160965597396
     ^ -23716683549865351578586448630079789776107310103486834795830390982)

print( 53817081128841898634258263553430908085326601592682411889506742059

            

Reported by Pylint.

tests/float/int_power.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # negative power should produce float

x = 2
print(x ** -2)

x = 3
x **= -2
print("%.5f" % x)

            

Reported by Pylint.

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

Line: 3 Column: 1

              # negative power should produce float

x = 2
print(x ** -2)

x = 3
x **= -2
print("%.5f" % x)

            

Reported by Pylint.

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

Line: 6 Column: 1

              x = 2
print(x ** -2)

x = 3
x **= -2
print("%.5f" % x)

            

Reported by Pylint.

tools/mpy_cross_all.py
3 issues
Starting a process with a shell, possible injection detected, security issue.
Security injection

Line: 43
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html

                              out_fpath,
            )
            # print(cmd)
            res = os.system(cmd)
            assert res == 0

            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
import argparse
import os
import os.path

argparser = argparse.ArgumentParser(description="Compile all .py files to .mpy recursively")
argparser.add_argument("-o", "--out", help="output directory (default: input dir)")
argparser.add_argument("--target", help="select MicroPython target config")
argparser.add_argument(

            

Reported by Pylint.

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

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

                          )
            # print(cmd)
            res = os.system(cmd)
            assert res == 0

            

Reported by Bandit.