Sfoglia il codice sorgente

pylint: simplify PYLINTRC setup

The os.path.isfile(RC_FILE) check isn't necessary because RC_FILE
always exists -- it's checking for a static file in depot_tools.

os.environ.setdefault('PYLINTRC',...) is the same thing as checking
'PYLINTRC' in os.environ first.  Use that to simplify and drop the
if entirely.

Change-Id: Ib1fb8323c9bceebc5b22484988e9794586aa5e9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6150451
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Mike Frysinger 7 mesi fa
parent
commit
1dd73cd467
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. 1 2
      pylint_main.py

+ 1 - 2
pylint_main.py

@@ -41,8 +41,7 @@ def main(argv):
     # their own PYLINTRC, or set an empty PYLINTRC to use pylint's normal config
     # their own PYLINTRC, or set an empty PYLINTRC to use pylint's normal config
     # file resolution, which would include the "more global" options that are
     # file resolution, which would include the "more global" options that are
     # normally overridden by the depot_tools config.
     # normally overridden by the depot_tools config.
-    if os.path.isfile(RC_FILE) and 'PYLINTRC' not in os.environ:
-        os.environ['PYLINTRC'] = RC_FILE
+    os.environ.setdefault('PYLINTRC', RC_FILE)
 
 
     # This import has to happen after PYLINTRC is set because the module tries
     # This import has to happen after PYLINTRC is set because the module tries
     # to resolve the config file location on load.
     # to resolve the config file location on load.