prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  linting in CI works differently than locally
  I'm pretty sure it is pylint 1.9.4.
  See https://github.com/google/clusterfuzz/pull/185 for a discrepancy I noticed between running pylint locally and running it in CI.
  
  When I upgraded my local copy of pylint to 1.9.4 I was able to discover the issue showing up in CI.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/local/butler/lint.py`
  Content:
  ```
  1 # Copyright 2019 Google LLC
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #      http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 """Lint changed code in current branch."""
  15 
  16 import os
  17 import sys
  18 
  19 from local.butler import common
  20 
  21 
  22 def execute(_):
  23   """Lint changed code."""
  24   if "GOOGLE_CLOUDBUILD" in os.environ:
  25     # Explicitly compare against master if we're running on the CI
  26     _, output = common.execute('git diff --name-only master FETCH_HEAD')
  27   else:
  28     _, output = common.execute('git diff --name-only FETCH_HEAD')
  29 
  30   py_changed_file_paths = [
  31       f for f in output.splitlines() if f.endswith('.py') and
  32       # Exclude auto-generated files.
  33       not f.endswith('_pb2.py') and not f.endswith('_pb2_grpc.py')
  34   ]
  35   go_changed_file_paths = [f for f in output.splitlines() if f.endswith('.go')]
  36 
  37   for file_path in py_changed_file_paths:
  38     if os.path.exists(file_path):
  39       common.execute('pylint ' + file_path)
  40       common.execute('yapf -d ' + file_path)
  41 
  42   golint_path = os.path.join('local', 'bin', 'golint')
  43   for file_path in go_changed_file_paths:
  44     if os.path.exists(file_path):
  45       common.execute(golint_path + ' ' + file_path)
  46 
  47       _, output = common.execute('gofmt -d ' + file_path)
  48       if output.strip():
  49         sys.exit(1)
  50
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/local/butler/lint.py b/src/local/butler/lint.py
  --- a/src/local/butler/lint.py
  +++ b/src/local/butler/lint.py
  @@ -16,11 +16,15 @@
   import os
   import sys
   
  +from local.butler import appengine
   from local.butler import common
   
   
   def execute(_):
     """Lint changed code."""
  +  pythonpath = os.getenv('PYTHONPATH', '')
  +  os.environ['PYTHONPATH'] = appengine.find_sdk_path() + ':' + pythonpath
  +
     if "GOOGLE_CLOUDBUILD" in os.environ:
       # Explicitly compare against master if we're running on the CI
       _, output = common.execute('git diff --name-only master FETCH_HEAD')
  
verification_info: {"golden_diff": "diff --git a/src/local/butler/lint.py b/src/local/butler/lint.py\n--- a/src/local/butler/lint.py\n+++ b/src/local/butler/lint.py\n@@ -16,11 +16,15 @@\n import os\n import sys\n \n+from local.butler import appengine\n from local.butler import common\n \n \n def execute(_):\n   \"\"\"Lint changed code.\"\"\"\n+  pythonpath = os.getenv('PYTHONPATH', '')\n+  os.environ['PYTHONPATH'] = appengine.find_sdk_path() + ':' + pythonpath\n+\n   if \"GOOGLE_CLOUDBUILD\" in os.environ:\n     # Explicitly compare against master if we're running on the CI\n     _, output = common.execute('git diff --name-only master FETCH_HEAD')\n", "issue": "linting in CI works differently than locally\nI'm pretty sure it is pylint 1.9.4.\r\nSee https://github.com/google/clusterfuzz/pull/185 for a discrepancy I noticed between running pylint locally and running it in CI.\r\n\r\nWhen I upgraded my local copy of pylint to 1.9.4 I was able to discover the issue showing up in CI.\n", "before_files": [{"content": "# Copyright 2019 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Lint changed code in current branch.\"\"\"\n\nimport os\nimport sys\n\nfrom local.butler import common\n\n\ndef execute(_):\n  \"\"\"Lint changed code.\"\"\"\n  if \"GOOGLE_CLOUDBUILD\" in os.environ:\n    # Explicitly compare against master if we're running on the CI\n    _, output = common.execute('git diff --name-only master FETCH_HEAD')\n  else:\n    _, output = common.execute('git diff --name-only FETCH_HEAD')\n\n  py_changed_file_paths = [\n      f for f in output.splitlines() if f.endswith('.py') and\n      # Exclude auto-generated files.\n      not f.endswith('_pb2.py') and not f.endswith('_pb2_grpc.py')\n  ]\n  go_changed_file_paths = [f for f in output.splitlines() if f.endswith('.go')]\n\n  for file_path in py_changed_file_paths:\n    if os.path.exists(file_path):\n      common.execute('pylint ' + file_path)\n      common.execute('yapf -d ' + file_path)\n\n  golint_path = os.path.join('local', 'bin', 'golint')\n  for file_path in go_changed_file_paths:\n    if os.path.exists(file_path):\n      common.execute(golint_path + ' ' + file_path)\n\n      _, output = common.execute('gofmt -d ' + file_path)\n      if output.strip():\n        sys.exit(1)\n", "path": "src/local/butler/lint.py"}], "after_files": [{"content": "# Copyright 2019 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Lint changed code in current branch.\"\"\"\n\nimport os\nimport sys\n\nfrom local.butler import appengine\nfrom local.butler import common\n\n\ndef execute(_):\n  \"\"\"Lint changed code.\"\"\"\n  pythonpath = os.getenv('PYTHONPATH', '')\n  os.environ['PYTHONPATH'] = appengine.find_sdk_path() + ':' + pythonpath\n\n  if \"GOOGLE_CLOUDBUILD\" in os.environ:\n    # Explicitly compare against master if we're running on the CI\n    _, output = common.execute('git diff --name-only master FETCH_HEAD')\n  else:\n    _, output = common.execute('git diff --name-only FETCH_HEAD')\n\n  py_changed_file_paths = [\n      f for f in output.splitlines() if f.endswith('.py') and\n      # Exclude auto-generated files.\n      not f.endswith('_pb2.py') and not f.endswith('_pb2_grpc.py')\n  ]\n  go_changed_file_paths = [f for f in output.splitlines() if f.endswith('.go')]\n\n  for file_path in py_changed_file_paths:\n    if os.path.exists(file_path):\n      common.execute('pylint ' + file_path)\n      common.execute('yapf -d ' + file_path)\n\n  golint_path = os.path.join('local', 'bin', 'golint')\n  for file_path in go_changed_file_paths:\n    if os.path.exists(file_path):\n      common.execute(golint_path + ' ' + file_path)\n\n      _, output = common.execute('gofmt -d ' + file_path)\n      if output.strip():\n        sys.exit(1)\n", "path": "src/local/butler/lint.py"}]}