The following issues were found

script/release/uploaders/upload-symbols.py
51 issues
Unable to import 'lib.config'
Error

Line: 17 Column: 1

              sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, s3_config
from lib.util import get_electron_branding, execute, s3put, \
                     get_out_dir, ELECTRON_DIR

RELEASE_DIR = get_out_dir()


            

Reported by Pylint.

Unable to import 'lib.util'
Error

Line: 18 Column: 1

                os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, s3_config
from lib.util import get_electron_branding, execute, s3put, \
                     get_out_dir, ELECTRON_DIR

RELEASE_DIR = get_out_dir()



            

Reported by Pylint.

Module name "upload-symbols" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python

import glob
import os
import shutil
import subprocess
import sys
import tempfile


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

import glob
import os
import shutil
import subprocess
import sys
import tempfile


            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import glob
import os
import shutil
import subprocess
import sys
import tempfile

def is_fs_case_sensitive():
  with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 10 Column: 1

              import sys
import tempfile

def is_fs_case_sensitive():
  with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:
    return(not os.path.exists(tmp_file.name.lower()))

sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 11 Column: 1

              import tempfile

def is_fs_case_sensitive():
  with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:
    return(not os.path.exists(tmp_file.name.lower()))

sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))


            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 12 Column: 1

              
def is_fs_case_sensitive():
  with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:
    return(not os.path.exists(tmp_file.name.lower()))

sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, s3_config

            

Reported by Pylint.

Unnecessary parens after 'return' keyword
Error

Line: 12 Column: 1

              
def is_fs_case_sensitive():
  with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:
    return(not os.path.exists(tmp_file.name.lower()))

sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, s3_config

            

Reported by Pylint.

Import "from lib.config import PLATFORM, s3_config" should be placed at the top of the module
Error

Line: 17 Column: 1

              sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, s3_config
from lib.util import get_electron_branding, execute, s3put, \
                     get_out_dir, ELECTRON_DIR

RELEASE_DIR = get_out_dir()


            

Reported by Pylint.

script/release/uploaders/upload-node-headers.py
46 issues
Unable to import 'lib.config'
Error

Line: 12 Column: 1

              sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, get_target_arch, s3_config
from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir

DIST_DIR    = get_dist_dir()
OUT_DIR     = get_out_dir()
GEN_DIR     = os.path.join(OUT_DIR, 'gen')

            

Reported by Pylint.

Unable to import 'lib.util'
Error

Line: 13 Column: 1

                os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, get_target_arch, s3_config
from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir

DIST_DIR    = get_dist_dir()
OUT_DIR     = get_out_dir()
GEN_DIR     = os.path.join(OUT_DIR, 'gen')


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

import argparse
import glob
import os
import shutil
import sys

sys.path.append(

            

Reported by Pylint.

Module name "upload-node-headers" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python

import argparse
import glob
import os
import shutil
import sys

sys.path.append(

            

Reported by Pylint.

Import "from lib.config import PLATFORM, get_target_arch, s3_config" should be placed at the top of the module
Error

Line: 12 Column: 1

              sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, get_target_arch, s3_config
from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir

DIST_DIR    = get_dist_dir()
OUT_DIR     = get_out_dir()
GEN_DIR     = os.path.join(OUT_DIR, 'gen')

            

Reported by Pylint.

Import "from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir" should be placed at the top of the module
Error

Line: 13 Column: 1

                os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import PLATFORM, get_target_arch, s3_config
from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir

DIST_DIR    = get_dist_dir()
OUT_DIR     = get_out_dir()
GEN_DIR     = os.path.join(OUT_DIR, 'gen')


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 1

                'iojs-{0}-headers.tar.gz'
]

def main():
  args = parse_args()

  # Upload node's headers to S3.
  bucket, access_key, secret_key = s3_config()
  upload_node(bucket, access_key, secret_key, args.version)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 27 Column: 1

              ]

def main():
  args = parse_args()

  # Upload node's headers to S3.
  bucket, access_key, secret_key = s3_config()
  upload_node(bucket, access_key, secret_key, args.version)


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 30 Column: 1

                args = parse_args()

  # Upload node's headers to S3.
  bucket, access_key, secret_key = s3_config()
  upload_node(bucket, access_key, secret_key, args.version)


def parse_args():
  parser = argparse.ArgumentParser(description='upload sumsha file')

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 31 Column: 1

              
  # Upload node's headers to S3.
  bucket, access_key, secret_key = s3_config()
  upload_node(bucket, access_key, secret_key, args.version)


def parse_args():
  parser = argparse.ArgumentParser(description='upload sumsha file')
  parser.add_argument('-v', '--version', help='Specify the version',

            

Reported by Pylint.

script/run-clang-format.py
43 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 118
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

                          stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True,
            shell=True)
    except OSError as exc:
        raise DiffError(str(exc))
    proc_stdout = proc.stdout
    proc_stderr = proc.stderr
    if sys.version_info[0] == 3:

            

Reported by Bandit.

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

Line: 99 Column: 9

                  except DiffError:
        raise
    except Exception as e:
        raise UnexpectedError('{}: {}: {}'.format(
            file_name, e.__class__.__name__, e), e)


def run_clang_format_diff(args, file_name):
    try:

            

Reported by Pylint.

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

Line: 108 Column: 9

                      with io.open(file_name, 'r', encoding='utf-8') as f:
            original = f.readlines()
    except IOError as exc:
        raise DiffError(str(exc))
    invocation = [args.clang_format_executable, file_name]
    if args.fix:
        invocation.append('-i')
    try:
        proc = subprocess.Popen(

            

Reported by Pylint.

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

Line: 120 Column: 9

                          universal_newlines=True,
            shell=True)
    except OSError as exc:
        raise DiffError(str(exc))
    proc_stdout = proc.stdout
    proc_stderr = proc.stderr
    if sys.version_info[0] == 3:
        proc_stdout = proc_stdout.detach()
        proc_stderr = proc_stderr.detach()

            

Reported by Pylint.

Module name "run-clang-format" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python
"""A wrapper script around clang-format, suitable for linting multiple files
and to use for continuous integration.
This is an alternative API for the clang-format command line.
It runs over multiple files and directories in parallel.
A diff output is produced and a sensible exit code is returned.
"""

from __future__ import print_function, unicode_literals

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import os
import posixpath
import signal
import subprocess
import sys
import traceback
import tempfile

from functools import partial

            

Reported by Bandit.

Missing class docstring
Error

Line: 31 Column: 1

              DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx,mm'


class ExitStatus:
    SUCCESS = 0
    DIFF = 1
    TROUBLE = 2



            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 31 Column: 1

              DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx,mm'


class ExitStatus:
    SUCCESS = 0
    DIFF = 1
    TROUBLE = 2



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 37 Column: 1

                  TROUBLE = 2


def list_files(files, recursive=False, extensions=None, exclude=None):
    if extensions is None:
        extensions = []
    if exclude is None:
        exclude = []


            

Reported by Pylint.

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

Line: 44 Column: 9

                      exclude = []

    out = []
    for f in files:
        if recursive and os.path.isdir(f):
            for dirpath, dnames, fnames in os.walk(f):
                fpaths = [os.path.join(dirpath, fname) for fname in fnames]
                for pattern in exclude:
                    dnames[:] = [

            

Reported by Pylint.

script/lib/config.py
43 issues
TODO Remove ATOM_SHELL_* fallback values
Error

Line: 47 Column: 3

              def get_env_var(name):
  value = os.environ.get('ELECTRON_' + name, '')
  if not value:
    # TODO Remove ATOM_SHELL_* fallback values
    value = os.environ.get('ATOM_SHELL_' + name, '')
    if value:
      print('Warning: Use $ELECTRON_' + name +
            ' instead of $ATOM_SHELL_' + name)
  return value

            

Reported by Pylint.

Using the global statement
Error

Line: 68 Column: 3

              
def enable_verbose_mode():
  print('Running in verbose mode')
  global verbose_mode
  verbose_mode = True


def is_verbose_mode():
  return verbose_mode

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import os
import sys

PLATFORM = {
  'cygwin': 'win32',
  'msys': 'win32',

            

Reported by Pylint.

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

Line: 27 Column: 1

                'libvk_swiftshader.so'
]

verbose_mode = False


def get_platform_key():
  if 'MAS_BUILD' in os.environ:
    return 'mas'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 30 Column: 1

              verbose_mode = False


def get_platform_key():
  if 'MAS_BUILD' in os.environ:
    return 'mas'
  else:
    return PLATFORM


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 31 Column: 3

              

def get_platform_key():
  if 'MAS_BUILD' in os.environ:
    return 'mas'
  else:
    return PLATFORM



            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 31 Column: 1

              

def get_platform_key():
  if 'MAS_BUILD' in os.environ:
    return 'mas'
  else:
    return PLATFORM



            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 32 Column: 1

              
def get_platform_key():
  if 'MAS_BUILD' in os.environ:
    return 'mas'
  else:
    return PLATFORM


def get_target_arch():

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 33 Column: 1

              def get_platform_key():
  if 'MAS_BUILD' in os.environ:
    return 'mas'
  else:
    return PLATFORM


def get_target_arch():
  arch = os.environ.get('TARGET_ARCH')

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 34 Column: 1

                if 'MAS_BUILD' in os.environ:
    return 'mas'
  else:
    return PLATFORM


def get_target_arch():
  arch = os.environ.get('TARGET_ARCH')
  if arch is None:

            

Reported by Pylint.

script/release/uploaders/upload-index-json.py
42 issues
Unable to import 'urllib2'
Error

Line: 7 Column: 1

              import json
import os
import sys
import urllib2

sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import s3_config

            

Reported by Pylint.

Unable to import 'lib.config'
Error

Line: 12 Column: 1

              sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import s3_config
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR

OUT_DIR     = get_out_dir()

BASE_URL = 'https://electron-metadumper.herokuapp.com/?version='

            

Reported by Pylint.

Unable to import 'lib.util'
Error

Line: 13 Column: 1

                os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import s3_config
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR

OUT_DIR     = get_out_dir()

BASE_URL = 'https://electron-metadumper.herokuapp.com/?version='


            

Reported by Pylint.

Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Security blacklist

Line: 31
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen

              
def get_content(retry_count = 5):
  try:
    request = urllib2.Request(
      BASE_URL + version,
      headers={"Authorization" : authToken}
    )

    proposed_content = urllib2.urlopen(

            

Reported by Bandit.

Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Security blacklist

Line: 36
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen

                    headers={"Authorization" : authToken}
    )

    proposed_content = urllib2.urlopen(
      request
    ).read()

    if is_json(proposed_content):
      return proposed_content

            

Reported by Bandit.

Catching too general exception Exception
Error

Line: 44 Column: 10

                    return proposed_content
    print("bad attempt")
    raise Exception("Failed to fetch valid JSON from the metadumper service")
  except Exception as e:
    if retry_count == 0:
      raise e
    return get_content(retry_count - 1)

def main():

            

Reported by Pylint.

Module name "upload-index-json" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import json
import os
import sys
import urllib2

sys.path.append(

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import json
import os
import sys
import urllib2

sys.path.append(

            

Reported by Pylint.

Import "from lib.config import s3_config" should be placed at the top of the module
Error

Line: 12 Column: 1

              sys.path.append(
  os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import s3_config
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR

OUT_DIR     = get_out_dir()

BASE_URL = 'https://electron-metadumper.herokuapp.com/?version='

            

Reported by Pylint.

Import "from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR" should be placed at the top of the module
Error

Line: 13 Column: 1

                os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))

from lib.config import s3_config
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR

OUT_DIR     = get_out_dir()

BASE_URL = 'https://electron-metadumper.herokuapp.com/?version='


            

Reported by Pylint.

script/zip-symbols.py
42 issues
Module name "zip-symbols" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import argparse
import glob
import os
import sys

from lib.config import PLATFORM, get_target_arch

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import argparse
import glob
import os
import sys

from lib.config import PLATFORM, get_target_arch

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              PROJECT_NAME = get_electron_branding()['project_name']
OUT_DIR = get_out_dir()

def main():
  print('Zipping Symbols')
  if get_target_arch() == 'mips64el':
    return

  args = parse_args()

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 18 Column: 1

              OUT_DIR = get_out_dir()

def main():
  print('Zipping Symbols')
  if get_target_arch() == 'mips64el':
    return

  args = parse_args()
  dist_name = 'symbols.zip'

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 19 Column: 1

              
def main():
  print('Zipping Symbols')
  if get_target_arch() == 'mips64el':
    return

  args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 20 Column: 1

              def main():
  print('Zipping Symbols')
  if get_target_arch() == 'mips64el':
    return

  args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 22 Column: 1

                if get_target_arch() == 'mips64el':
    return

  args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

  with scoped_cwd(args.build_dir):

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 23 Column: 1

                  return

  args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

  with scoped_cwd(args.build_dir):
    dirs = ['breakpad_symbols']

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 24 Column: 1

              
  args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

  with scoped_cwd(args.build_dir):
    dirs = ['breakpad_symbols']
    print('Making symbol zip: ' + zip_file)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 25 Column: 1

                args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

  with scoped_cwd(args.build_dir):
    dirs = ['breakpad_symbols']
    print('Making symbol zip: ' + zip_file)
    make_zip(zip_file, licenses, dirs)

            

Reported by Pylint.

build/dump_syms.py
41 issues
Undefined variable 'binary'
Error

Line: 23 Column: 71

              def get_symbol_path(symbol_data):
  module_info = get_module_info(symbol_data[:symbol_data.index('\n')])
  if not module_info:
    raise Exception("Couldn't get module info for binary '{}'".format(binary))
  exe_name = module_info.name.replace('.pdb', '')
  return os.path.join(module_info.name, module_info.hash, exe_name + ".sym")

def mkdir_p(path):
  """Simulates mkdir -p."""

            

Reported by Pylint.

No value for argument 'stamp_file' in function call
Error

Line: 53 Column: 3

                  pass

if __name__ == '__main__':
  main(*sys.argv[1:])

            

Reported by Pylint.

No value for argument 'out_dir' in function call
Error

Line: 53 Column: 3

                  pass

if __name__ == '__main__':
  main(*sys.argv[1:])

            

Reported by Pylint.

No value for argument 'dump_syms' in function call
Error

Line: 53 Column: 3

                  pass

if __name__ == '__main__':
  main(*sys.argv[1:])

            

Reported by Pylint.

No value for argument 'binary' in function call
Error

Line: 53 Column: 3

                  pass

if __name__ == '__main__':
  main(*sys.argv[1:])

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import print_function

import collections
import os
import subprocess
import sys
import errno

# The BINARY_INFO tuple describes a binary as dump_syms identifies it.

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              
import collections
import os
import subprocess
import sys
import errno

# The BINARY_INFO tuple describes a binary as dump_syms identifies it.
BINARY_INFO = collections.namedtuple('BINARY_INFO',

            

Reported by Bandit.

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

Line: 10 Column: 1

              import errno

# The BINARY_INFO tuple describes a binary as dump_syms identifies it.
BINARY_INFO = collections.namedtuple('BINARY_INFO',
                                     ['platform', 'arch', 'hash', 'name'])

def get_module_info(header_info):
  # header info is of the form "MODULE $PLATFORM $ARCH $HASH $BINARY"
  info_split = header_info.strip().split(' ', 4)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              BINARY_INFO = collections.namedtuple('BINARY_INFO',
                                     ['platform', 'arch', 'hash', 'name'])

def get_module_info(header_info):
  # header info is of the form "MODULE $PLATFORM $ARCH $HASH $BINARY"
  info_split = header_info.strip().split(' ', 4)
  if len(info_split) != 5 or info_split[0] != 'MODULE':
    return None
  return BINARY_INFO(*info_split[1:])

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 15 Column: 1

              
def get_module_info(header_info):
  # header info is of the form "MODULE $PLATFORM $ARCH $HASH $BINARY"
  info_split = header_info.strip().split(' ', 4)
  if len(info_split) != 5 or info_split[0] != 'MODULE':
    return None
  return BINARY_INFO(*info_split[1:])

def get_symbol_path(symbol_data):

            

Reported by Pylint.

build/zip_libcxx.py
40 issues
Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
import zipfile

def execute(argv):
  try:

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              #!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
import zipfile

def execute(argv):
  try:

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 8 Column: 1

              import sys
import zipfile

def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 9 Column: 1

              import zipfile

def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 10 Column: 1

              
def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e


            

Reported by Pylint.

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

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

              
def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e


            

Reported by Bandit.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 11 Column: 1

              def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e

def get_object_files(base_path, archive_name):

            

Reported by Pylint.

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

Line: 12 Column: 3

                try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e

def get_object_files(base_path, archive_name):
  archive_file = os.path.join(base_path, archive_name)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 12 Column: 1

                try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e

def get_object_files(base_path, archive_name):
  archive_file = os.path.join(base_path, archive_name)

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 13 Column: 1

                  output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output
  except subprocess.CalledProcessError as e:
    print(e.output)
    raise e

def get_object_files(base_path, archive_name):
  archive_file = os.path.join(base_path, archive_name)
  output = execute(['nm', '-g', archive_file]).decode('ascii')

            

Reported by Pylint.

script/copy-debug-symbols.py
39 issues
Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys

from lib.config import LINUX_BINARIES, PLATFORM
from lib.util import execute, get_out_dir, safe_mkdir


            

Reported by Pylint.

Module name "copy-debug-symbols" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys

from lib.config import LINUX_BINARIES, PLATFORM
from lib.util import execute, get_out_dir, safe_mkdir


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              from lib.util import execute, get_out_dir, safe_mkdir

# It has to be done before stripping the binaries.
def copy_debug_from_binaries(directory, out_dir, target_cpu, compress):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 12 Column: 1

              
# It has to be done before stripping the binaries.
def copy_debug_from_binaries(directory, out_dir, target_cpu, compress):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 13 Column: 1

              # It has to be done before stripping the binaries.
def copy_debug_from_binaries(directory, out_dir, target_cpu, compress):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
  if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 14 Column: 1

              def copy_debug_from_binaries(directory, out_dir, target_cpu, compress):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
  if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
     target_cpu == 'arm64'):

            

Reported by Pylint.

Bad indentation. Found 6 spaces, expected 12
Style

Line: 15 Column: 1

                for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
  if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
     target_cpu == 'arm64'):
    # Skip because no objcopy binary on the given target.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

                  if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
  if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
     target_cpu == 'arm64'):
    # Skip because no objcopy binary on the given target.
    return    
  debug_name = get_debug_name(binary_path)

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 17 Column: 1

                  if os.path.isfile(binary_path):
      copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
  if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
     target_cpu == 'arm64'):
    # Skip because no objcopy binary on the given target.
    return    
  debug_name = get_debug_name(binary_path)

            

Reported by Pylint.

Consider merging these comparisons with "in" to "target_cpu in ('x86', 'arm', 'arm64')"
Error

Line: 18 Column: 31

                    copy_debug_from_binary(binary_path, out_dir, target_cpu, compress)

def copy_debug_from_binary(binary_path, out_dir, target_cpu, compress):
  if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
     target_cpu == 'arm64'):
    # Skip because no objcopy binary on the given target.
    return    
  debug_name = get_debug_name(binary_path)
  cmd = ['objcopy', '--only-keep-debug']

            

Reported by Pylint.

script/strip-binaries.py
33 issues
Module name "strip-binaries" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys

from lib.config import LINUX_BINARIES, enable_verbose_mode
from lib.util import execute, get_out_dir


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys

from lib.config import LINUX_BINARIES, enable_verbose_mode
from lib.util import execute, get_out_dir


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              from lib.config import LINUX_BINARIES, enable_verbose_mode
from lib.util import execute, get_out_dir

def strip_binaries(directory, target_cpu):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      strip_binary(binary_path, target_cpu)


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 11 Column: 1

              from lib.util import execute, get_out_dir

def strip_binaries(directory, target_cpu):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      strip_binary(binary_path, target_cpu)

def strip_binary(binary_path, target_cpu):

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 12 Column: 1

              
def strip_binaries(directory, target_cpu):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      strip_binary(binary_path, target_cpu)

def strip_binary(binary_path, target_cpu):
  if target_cpu == 'arm':

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 13 Column: 1

              def strip_binaries(directory, target_cpu):
  for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      strip_binary(binary_path, target_cpu)

def strip_binary(binary_path, target_cpu):
  if target_cpu == 'arm':
    strip = 'arm-linux-gnueabihf-strip'

            

Reported by Pylint.

Bad indentation. Found 6 spaces, expected 12
Style

Line: 14 Column: 1

                for binary in LINUX_BINARIES:
    binary_path = os.path.join(directory, binary)
    if os.path.isfile(binary_path):
      strip_binary(binary_path, target_cpu)

def strip_binary(binary_path, target_cpu):
  if target_cpu == 'arm':
    strip = 'arm-linux-gnueabihf-strip'
  elif target_cpu == 'arm64':

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

                  if os.path.isfile(binary_path):
      strip_binary(binary_path, target_cpu)

def strip_binary(binary_path, target_cpu):
  if target_cpu == 'arm':
    strip = 'arm-linux-gnueabihf-strip'
  elif target_cpu == 'arm64':
    strip = 'aarch64-linux-gnu-strip'
  elif target_cpu == 'mips64el':

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 17 Column: 1

                    strip_binary(binary_path, target_cpu)

def strip_binary(binary_path, target_cpu):
  if target_cpu == 'arm':
    strip = 'arm-linux-gnueabihf-strip'
  elif target_cpu == 'arm64':
    strip = 'aarch64-linux-gnu-strip'
  elif target_cpu == 'mips64el':
    strip = 'mips64el-redhat-linux-strip'

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 18 Column: 1

              
def strip_binary(binary_path, target_cpu):
  if target_cpu == 'arm':
    strip = 'arm-linux-gnueabihf-strip'
  elif target_cpu == 'arm64':
    strip = 'aarch64-linux-gnu-strip'
  elif target_cpu == 'mips64el':
    strip = 'mips64el-redhat-linux-strip'
  else:

            

Reported by Pylint.