The following issues were found

script/release/uploaders/upload.py
231 issues
Unable to import 'lib.config'
Error

Line: 19 Column: 1

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

from zipfile import ZipFile
from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                       get_zip_name, enable_verbose_mode, get_platform_key
from lib.util import get_electron_branding, execute, get_electron_version, \
                     s3put, get_electron_exec, get_out_dir, \
                     SRC_DIR, ELECTRON_DIR, TS_NODE


            

Reported by Pylint.

Unable to import 'lib.util'
Error

Line: 21 Column: 1

              from zipfile import ZipFile
from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                       get_zip_name, enable_verbose_mode, get_platform_key
from lib.util import get_electron_branding, execute, get_electron_version, \
                     s3put, get_electron_exec, get_out_dir, \
                     SRC_DIR, ELECTRON_DIR, TS_NODE


ELECTRON_VERSION = get_electron_version()

            

Reported by Pylint.

Unused get_env_var imported from lib.config
Error

Line: 19 Column: 1

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

from zipfile import ZipFile
from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                       get_zip_name, enable_verbose_mode, get_platform_key
from lib.util import get_electron_branding, execute, get_electron_version, \
                     s3put, get_electron_exec, get_out_dir, \
                     SRC_DIR, ELECTRON_DIR, TS_NODE


            

Reported by Pylint.

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

Line: 203 Column: 5

                  with open(fname, 'r+b') as f:
      _zero_zip_date_time(f)
  except:
    raise NonZipFileError(fname)


def _zero_zip_date_time(zip_):
  def purify_extra_data(mm, offset, length, compressed_size=0):
    extra_header_struct = Struct("<HH")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import argparse
import datetime
import hashlib
import json
import mmap
import os

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import mmap
import os
import shutil
import subprocess
from struct import Struct
import sys

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

            

Reported by Bandit.

Import "from zipfile import ZipFile" should be placed at the top of the module
Error

Line: 18 Column: 1

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

from zipfile import ZipFile
from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                       get_zip_name, enable_verbose_mode, get_platform_key
from lib.util import get_electron_branding, execute, get_electron_version, \
                     s3put, get_electron_exec, get_out_dir, \
                     SRC_DIR, ELECTRON_DIR, TS_NODE

            

Reported by Pylint.

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

Line: 19 Column: 1

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

from zipfile import ZipFile
from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                       get_zip_name, enable_verbose_mode, get_platform_key
from lib.util import get_electron_branding, execute, get_electron_version, \
                     s3put, get_electron_exec, get_out_dir, \
                     SRC_DIR, ELECTRON_DIR, TS_NODE


            

Reported by Pylint.

Import "from lib.util import get_electron_branding, execute, get_electron_version, s3put, get_electron_exec, get_out_dir, SRC_DIR, ELECTRON_DIR, TS_NODE" should be placed at the top of the module
Error

Line: 21 Column: 1

              from zipfile import ZipFile
from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                       get_zip_name, enable_verbose_mode, get_platform_key
from lib.util import get_electron_branding, execute, get_electron_version, \
                     s3put, get_electron_exec, get_out_dir, \
                     SRC_DIR, ELECTRON_DIR, TS_NODE


ELECTRON_VERSION = get_electron_version()

            

Reported by Pylint.

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

Line: 44 Column: 1

                                                    'libcxx_objects')


def main():
  args = parse_args()
  if args.verbose:
    enable_verbose_mode()
  if args.upload_to_s3:
    utcnow = datetime.datetime.utcnow()

            

Reported by Pylint.

script/lib/native_tests.py
221 issues
Unable to import 'util'
Error

Line: 7 Column: 1

              import subprocess
import sys

from util import SRC_DIR

PYYAML_LIB_DIR = os.path.join(SRC_DIR, 'third_party', 'pyyaml', 'lib')
sys.path.append(PYYAML_LIB_DIR)
import yaml  #pylint: disable=wrong-import-position,wrong-import-order


            

Reported by Pylint.

Use of unsafe yaml load. Allows instantiation of arbitrary objects. Consider yaml.safe_load().
Security criptography

Line: 147
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b506_yaml_load.html

                @staticmethod
  def __get_config_data(config_path):
    with open(config_path, 'r') as stream:
      return yaml.load(stream)

  @staticmethod
  def __expand_shorthand(value):
    """ Treat a string as {'string_value': None}."""
    if isinstance(value, dict):

            

Reported by Bandit.

Catching too general exception Exception
Error

Line: 264 Column: 12

                  returncode = 0
    try:
      returncode = subprocess.call(args, stdout=stdout, stderr=stderr)
    except Exception as exception:
      if Verbosity.ge(verbosity, Verbosity.ERRORS):
        print("An error occurred while running '{}':".format(self.binary_path),
            '\n', exception, file=sys.stderr)
      returncode = 1


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import print_function

import os
import subprocess
import sys

from util import SRC_DIR

PYYAML_LIB_DIR = os.path.join(SRC_DIR, 'third_party', 'pyyaml', 'lib')

            

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

              from __future__ import print_function

import os
import subprocess
import sys

from util import SRC_DIR

PYYAML_LIB_DIR = os.path.join(SRC_DIR, 'third_party', 'pyyaml', 'lib')

            

Reported by Bandit.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 14 Column: 1

              import yaml  #pylint: disable=wrong-import-position,wrong-import-order

try:
  basestring        # Python 2
except NameError:   # Python 3
  basestring = str  # pylint: disable=redefined-builtin


class Verbosity:

            

Reported by Pylint.

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

Line: 16 Column: 3

              try:
  basestring        # Python 2
except NameError:   # Python 3
  basestring = str  # pylint: disable=redefined-builtin


class Verbosity:
  CHATTY = 'chatty'  # stdout and stderr
  ERRORS = 'errors'  # stderr only

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 16 Column: 1

              try:
  basestring        # Python 2
except NameError:   # Python 3
  basestring = str  # pylint: disable=redefined-builtin


class Verbosity:
  CHATTY = 'chatty'  # stdout and stderr
  ERRORS = 'errors'  # stderr only

            

Reported by Pylint.

Missing class docstring
Error

Line: 19 Column: 1

                basestring = str  # pylint: disable=redefined-builtin


class Verbosity:
  CHATTY = 'chatty'  # stdout and stderr
  ERRORS = 'errors'  # stderr only
  SILENT = 'silent'  # no output

  @staticmethod

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 20 Column: 1

              

class Verbosity:
  CHATTY = 'chatty'  # stdout and stderr
  ERRORS = 'errors'  # stderr only
  SILENT = 'silent'  # no output

  @staticmethod
  def get_all():

            

Reported by Pylint.

script/lib/util.py
152 issues
Unused import atexit
Error

Line: 4 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import atexit
import contextlib
import errno
import json
import os
import shutil

            

Reported by Pylint.

Unused import ssl
Error

Line: 10 Column: 1

              import json
import os
import shutil
import ssl
import stat
import subprocess
import sys
import tarfile
import tempfile

            

Reported by Pylint.

Unused import stat
Error

Line: 11 Column: 1

              import os
import shutil
import ssl
import stat
import subprocess
import sys
import tarfile
import tempfile
# Python 3 / 2 compat import

            

Reported by Pylint.

Unused import tarfile
Error

Line: 14 Column: 1

              import stat
import subprocess
import sys
import tarfile
import tempfile
# Python 3 / 2 compat import
try:
  from urllib.request import urlopen
except ImportError:

            

Reported by Pylint.

Unused import tempfile
Error

Line: 15 Column: 1

              import subprocess
import sys
import tarfile
import tempfile
# Python 3 / 2 compat import
try:
  from urllib.request import urlopen
except ImportError:
  from urllib2 import urlopen

            

Reported by Pylint.

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

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

                safe_mkdir(os.path.dirname(path))
  with open(path, 'wb') as local_file:
    print("Downloading %s to %s" % (url, path))
    web_file = urlopen(url)
    info = web_file.info()
    if hasattr(info, 'getheader'):
      file_size = int(info.getheaders("Content-Length")[0])
    else:
      file_size = int(info.get("Content-Length")[0])

            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from __future__ import print_function
import atexit
import contextlib
import errno
import json
import os
import shutil

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import shutil
import ssl
import stat
import subprocess
import sys
import tarfile
import tempfile
# Python 3 / 2 compat import
try:

            

Reported by Bandit.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 18 Column: 1

              import tempfile
# Python 3 / 2 compat import
try:
  from urllib.request import urlopen
except ImportError:
  from urllib2 import urlopen
import zipfile

from lib.config import is_verbose_mode

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 20 Column: 1

              try:
  from urllib.request import urlopen
except ImportError:
  from urllib2 import urlopen
import zipfile

from lib.config import is_verbose_mode

ELECTRON_DIR = os.path.abspath(

            

Reported by Pylint.

script/lib/git.py
151 issues
Undefined variable 'unicode'
Error

Line: 254 Column: 24

                  for patch in patches:
      filename = get_file_name(patch)
      filepath = posixpath.join(out_dir, filename)
      existing_patch = unicode(io.open(filepath, 'rb').read(), "utf-8")
      formatted_patch = join_patch(patch)
      if formatted_patch != existing_patch:
        bad_patches.append(filename)
    if len(bad_patches) > 0:
      sys.stderr.write(

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import os
import posixpath
import re
import subprocess
import sys


def is_repo_root(path):
  path_exists = os.path.exists(path)

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 19 Column: 1

              import sys


def is_repo_root(path):
  path_exists = os.path.exists(path)
  if not path_exists:
    return False

  git_folder_path = os.path.join(path, '.git')

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 20 Column: 1

              

def is_repo_root(path):
  path_exists = os.path.exists(path)
  if not path_exists:
    return False

  git_folder_path = os.path.join(path, '.git')
  git_folder_exists = os.path.exists(git_folder_path)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 21 Column: 1

              
def is_repo_root(path):
  path_exists = os.path.exists(path)
  if not path_exists:
    return False

  git_folder_path = os.path.join(path, '.git')
  git_folder_exists = os.path.exists(git_folder_path)


            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 22 Column: 1

              def is_repo_root(path):
  path_exists = os.path.exists(path)
  if not path_exists:
    return False

  git_folder_path = os.path.join(path, '.git')
  git_folder_exists = os.path.exists(git_folder_path)

  return git_folder_exists

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 24 Column: 1

                if not path_exists:
    return False

  git_folder_path = os.path.join(path, '.git')
  git_folder_exists = os.path.exists(git_folder_path)

  return git_folder_exists



            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 25 Column: 1

                  return False

  git_folder_path = os.path.join(path, '.git')
  git_folder_exists = os.path.exists(git_folder_path)

  return git_folder_exists


def get_repo_root(path):

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 27 Column: 1

                git_folder_path = os.path.join(path, '.git')
  git_folder_exists = os.path.exists(git_folder_path)

  return git_folder_exists


def get_repo_root(path):
  """Finds a closest ancestor folder which is a repo root."""
  norm_path = os.path.normpath(path)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 31 Column: 1

              

def get_repo_root(path):
  """Finds a closest ancestor folder which is a repo root."""
  norm_path = os.path.normpath(path)
  norm_path_exists = os.path.exists(norm_path)
  if not norm_path_exists:
    return None


            

Reported by Pylint.

script/check-relative-doc-links.py
126 issues
Anomalous backslash in string: '\['. String constant might be missing an r prefix.
Error

Line: 51 Column: 31

                finally:
    f.close()

  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:

            

Reported by Pylint.

Anomalous backslash in string: '\)'. String constant might be missing an r prefix.
Error

Line: 51 Column: 57

                finally:
    f.close()

  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:

            

Reported by Pylint.

Anomalous backslash in string: '\('. String constant might be missing an r prefix.
Error

Line: 51 Column: 40

                finally:
    f.close()

  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:

            

Reported by Pylint.

Anomalous backslash in string: '\]'. String constant might be missing an r prefix.
Error

Line: 51 Column: 38

                finally:
    f.close()

  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:

            

Reported by Pylint.

Anomalous backslash in string: '\['. String constant might be missing an r prefix.
Error

Line: 53 Column: 16

              
  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:
    matchLinks = linkRegexLink.search(line)
    matchReferenceLinks = referenceLinkRegex.search(line)

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 53 Column: 9

              
  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:
    matchLinks = linkRegexLink.search(line)
    matchReferenceLinks = referenceLinkRegex.search(line)

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 53 Column: 39

              
  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:
    matchLinks = linkRegexLink.search(line)
    matchReferenceLinks = referenceLinkRegex.search(line)

            

Reported by Pylint.

Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Error

Line: 53 Column: 24

              
  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:
    matchLinks = linkRegexLink.search(line)
    matchReferenceLinks = referenceLinkRegex.search(line)

            

Reported by Pylint.

Anomalous backslash in string: '\]'. String constant might be missing an r prefix.
Error

Line: 53 Column: 21

              
  linkRegexLink = re.compile('\[(.*?)\]\((?P<link>(.*?))\)')
  referenceLinkRegex = re.compile(
      '^\s{0,3}\[.*?\]:\s*(?P<link>[^<\s]+|<[^<>\r\n]+>)'
  )
  links = []
  for line in lines:
    matchLinks = linkRegexLink.search(line)
    matchReferenceLinks = referenceLinkRegex.search(line)

            

Reported by Pylint.

Anomalous backslash in string: '\-'. String constant might be missing an r prefix.
Error

Line: 98 Column: 37

              

def checkSections(sections, lines):
  invalidCharsRegex = '[^A-Za-z0-9_ \-]'
  sectionHeader = sections[1]
  regexSectionTitle = re.compile('# (?P<header>.*)')
  for line in lines:
    matchHeader = regexSectionTitle.search(line)
    if matchHeader:

            

Reported by Pylint.

script/verify-mksnapshot.py
85 issues
Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function
import argparse
import glob
import os
import platform
import shutil
import subprocess
import sys

            

Reported by Pylint.

Module name "verify-mksnapshot" 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 platform
import shutil
import subprocess
import sys

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import os
import platform
import shutil
import subprocess
import sys

from lib.util import get_electron_branding, rm_rf, scoped_cwd

PROJECT_NAME = get_electron_branding()['project_name']

            

Reported by Bandit.

Too many local variables (20/15)
Error

Line: 18 Column: 1

              SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SNAPSHOT_SOURCE = os.path.join(SOURCE_ROOT, 'spec', 'fixtures', 'testsnap.js')

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

            

Reported by Pylint.

Too many statements (51/50)
Error

Line: 18 Column: 1

              SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SNAPSHOT_SOURCE = os.path.join(SOURCE_ROOT, 'spec', 'fixtures', 'testsnap.js')

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

            

Reported by Pylint.

Too many branches (13/12)
Error

Line: 18 Column: 1

              SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SNAPSHOT_SOURCE = os.path.join(SOURCE_ROOT, 'spec', 'fixtures', 'testsnap.js')

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 1

              SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SNAPSHOT_SOURCE = os.path.join(SOURCE_ROOT, 'spec', 'fixtures', 'testsnap.js')

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 19 Column: 1

              SNAPSHOT_SOURCE = os.path.join(SOURCE_ROOT, 'spec', 'fixtures', 'testsnap.js')

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 21 Column: 1

              def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

  returncode = 0
  try:

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 22 Column: 1

                args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

  returncode = 0
  try:
    with scoped_cwd(app_path):

            

Reported by Pylint.

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

Line: 13 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 download, rm_rf, s3put, safe_mkdir

DIST_URL = 'https://electronjs.org/headers/'



            

Reported by Pylint.

Unable to import 'lib.util'
Error

Line: 14 Column: 1

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

from lib.config import s3_config
from lib.util import download, rm_rf, s3put, safe_mkdir

DIST_URL = 'https://electronjs.org/headers/'


def main():

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 80 Column: 12

                  f = optional_f['filename']
    try:
      result.append(download(f, url + f, os.path.join(directory, f)))
    except Exception:
      if required:
        raise

  return directory, result


            

Reported by Pylint.

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

Line: 1 Column: 1

              #!/usr/bin/env python

import argparse
import hashlib
import os
import shutil
import sys
import tempfile


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

import argparse
import hashlib
import os
import shutil
import sys
import tempfile


            

Reported by Pylint.

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

Line: 13 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 download, rm_rf, s3put, safe_mkdir

DIST_URL = 'https://electronjs.org/headers/'



            

Reported by Pylint.

Import "from lib.util import download, rm_rf, s3put, safe_mkdir" should be placed at the top of the module
Error

Line: 14 Column: 1

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

from lib.config import s3_config
from lib.util import download, rm_rf, s3put, safe_mkdir

DIST_URL = 'https://electronjs.org/headers/'


def main():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 1

              DIST_URL = 'https://electronjs.org/headers/'


def main():
  args = parse_args()
  dist_url = args.dist_url
  if dist_url[-1] != "/":
    dist_url += "/"


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 20 Column: 1

              

def main():
  args = parse_args()
  dist_url = args.dist_url
  if dist_url[-1] != "/":
    dist_url += "/"

  url = dist_url + args.version + '/'

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 21 Column: 1

              
def main():
  args = parse_args()
  dist_url = args.dist_url
  if dist_url[-1] != "/":
    dist_url += "/"

  url = dist_url + args.version + '/'
  directory, files = download_files(url, get_files_list(args.version))

            

Reported by Pylint.

script/verify-ffmpeg.py
58 issues
FIXME: Enable after ELECTRON_ENABLE_LOGGING works again
Error

Line: 48 Column: 3

                      'no-proprietary-codecs.js')
    env = dict(os.environ)
    env['ELECTRON_ENABLE_STACK_DUMPING'] = 'true'
    # FIXME: Enable after ELECTRON_ENABLE_LOGGING works again
    # env['ELECTRON_ENABLE_LOGGING'] = 'true'
    testargs = [electron, test_path]
    if sys.platform != 'linux' and (platform.machine() == 'ARM64' or os.environ.get('TARGET_ARCH') == 'arm64'):
      testargs.append('--disable-accelerated-video-decode')
    subprocess.check_call(testargs, env=env)

            

Reported by Pylint.

Module name "verify-ffmpeg" 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 platform
import shutil
import subprocess
import sys


            

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 platform
import shutil
import subprocess
import sys


            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

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

              import os
import platform
import shutil
import subprocess
import sys

from lib.util import get_electron_branding, rm_rf

PROJECT_NAME = get_electron_branding()['project_name']

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 16 Column: 1

              PRODUCT_NAME = get_electron_branding()['product_name']
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 17 Column: 1

              SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 19 Column: 1

              def main():
  args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

  if sys.platform == 'darwin':
    electron = os.path.join(app_path, 'Contents', 'MacOS', PRODUCT_NAME)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 20 Column: 1

                args = parse_args()

  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

  if sys.platform == 'darwin':
    electron = os.path.join(app_path, 'Contents', 'MacOS', PRODUCT_NAME)
    ffmpeg_name = 'libffmpeg.dylib'

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 21 Column: 1

              
  source_root = os.path.abspath(args.source_root)
  initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

  if sys.platform == 'darwin':
    electron = os.path.join(app_path, 'Contents', 'MacOS', PRODUCT_NAME)
    ffmpeg_name = 'libffmpeg.dylib'
    ffmpeg_app_path = os.path.join(app_path, 'Contents', 'Frameworks',

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 23 Column: 1

                initial_app_path = os.path.join(source_root, args.build_dir)
  app_path = create_app_copy(initial_app_path)

  if sys.platform == 'darwin':
    electron = os.path.join(app_path, 'Contents', 'MacOS', PRODUCT_NAME)
    ffmpeg_name = 'libffmpeg.dylib'
    ffmpeg_app_path = os.path.join(app_path, 'Contents', 'Frameworks',
                    '{0} Framework.framework'.format(PRODUCT_NAME),
                    'Libraries')

            

Reported by Pylint.

script/native-tests.py
53 issues
Module name "native-tests" 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.native_tests import TestsList, Verbosity, DisabledTestsPolicy

            

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.native_tests import TestsList, Verbosity, DisabledTestsPolicy

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              from lib.native_tests import TestsList, Verbosity, DisabledTestsPolicy


class Command:
  LIST = 'list'
  RUN = 'run'


def parse_args():

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 12 Column: 1

              from lib.native_tests import TestsList, Verbosity, DisabledTestsPolicy


class Command:
  LIST = 'list'
  RUN = 'run'


def parse_args():

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 13 Column: 1

              

class Command:
  LIST = 'list'
  RUN = 'run'


def parse_args():
  parser = argparse.ArgumentParser(description='Run Google Test binaries')

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 14 Column: 1

              
class Command:
  LIST = 'list'
  RUN = 'run'


def parse_args():
  parser = argparse.ArgumentParser(description='Run Google Test binaries')


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

                RUN = 'run'


def parse_args():
  parser = argparse.ArgumentParser(description='Run Google Test binaries')

  parser.add_argument('command',
                      choices=[Command.LIST, Command.RUN],
                      help='command to execute')

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 18 Column: 1

              

def parse_args():
  parser = argparse.ArgumentParser(description='Run Google Test binaries')

  parser.add_argument('command',
                      choices=[Command.LIST, Command.RUN],
                      help='command to execute')


            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 20 Column: 1

              def parse_args():
  parser = argparse.ArgumentParser(description='Run Google Test binaries')

  parser.add_argument('command',
                      choices=[Command.LIST, Command.RUN],
                      help='command to execute')

  parser.add_argument('-b', '--binary', nargs='+', required=False,
                      help='binaries to run')

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 24 Column: 1

                                    choices=[Command.LIST, Command.RUN],
                      help='command to execute')

  parser.add_argument('-b', '--binary', nargs='+', required=False,
                      help='binaries to run')
  parser.add_argument('-c', '--config', required=True,
                      help='path to a tests config')
  parser.add_argument('-t', '--tests-dir', required=False,
                      help='path to a directory with test binaries')

            

Reported by Pylint.

build/zip.py
53 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

EXTENSIONS_TO_SKIP = [
  '.pdb',

            

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

EXTENSIONS_TO_SKIP = [
  '.pdb',

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 40 Column: 1

                'gen/ui/webui'
]

def skip_path(dep, dist_zip, target_cpu):
  # Skip specific paths and extensions as well as the following special case:
  # snapshot_blob.bin is a dependency of mksnapshot.zip because
  # v8_context_generator needs it, but this file does not get generated for arm
  # and arm 64 binaries of mksnapshot since they are built on x64 hardware.
  # Consumers of arm and arm64 mksnapshot can generate snapshot_blob.bin

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 47 Column: 1

                # and arm 64 binaries of mksnapshot since they are built on x64 hardware.
  # Consumers of arm and arm64 mksnapshot can generate snapshot_blob.bin
  # themselves by running mksnapshot.
  should_skip = (
    any(dep.startswith(path) for path in PATHS_TO_SKIP) or
    any(dep.endswith(ext) for ext in EXTENSIONS_TO_SKIP) or
    (
      "arm" in target_cpu
      and dist_zip == "mksnapshot.zip"

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 56 Column: 1

                    and dep == "snapshot_blob.bin"
    )
  )
  if should_skip:
    print("Skipping {}".format(dep))
  return should_skip

def execute(argv):
  try:

            

Reported by Pylint.

Bad indentation. Found 4 spaces, expected 8
Style

Line: 57 Column: 1

                  )
  )
  if should_skip:
    print("Skipping {}".format(dep))
  return should_skip

def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 58 Column: 1

                )
  if should_skip:
    print("Skipping {}".format(dep))
  return should_skip

def execute(argv):
  try:
    output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
    return output

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 60 Column: 1

                  print("Skipping {}".format(dep))
  return should_skip

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: 61 Column: 1

                return should_skip

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: 62
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.