Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions gcloud/bigquery/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,6 @@ def test_delete_w_alternate_client(self):
self.assertEqual(req['path'], '/%s' % PATH)

def test_list_tables_empty(self):
from gcloud.bigquery.table import Table

conn = _Connection({})
client = _Client(project=self.PROJECT, connection=conn)
dataset = self._makeOne(self.DS_NAME, client=client)
Expand Down
2 changes: 0 additions & 2 deletions gcloud/bigquery/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ def __init__(self, *responses):
self._requested = []

def api_request(self, **kw):
from gcloud.exceptions import NotFound
self._requested.append(kw)

response, self._responses = self._responses[0], self._responses[1:]
return response
1 change: 0 additions & 1 deletion gcloud/bigquery/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,6 @@ def test_update_w_alternate_client(self):
import datetime
from gcloud._helpers import UTC
from gcloud._helpers import _millis
from gcloud.bigquery.table import SchemaField

PATH = 'projects/%s/datasets/%s/tables/%s' % (
self.PROJECT, self.DS_NAME, self.TABLE_NAME)
Expand Down
1 change: 0 additions & 1 deletion gcloud/dns/test_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def _makeResource(self):

def _verifyResourceProperties(self, changes, resource, zone):
from gcloud._helpers import _rfc3339_to_datetime
from gcloud._helpers import UTC
self.assertEqual(changes.name, resource['id'])
started = _rfc3339_to_datetime(resource['startTime'])
self.assertEqual(changes.started, started)
Expand Down
1 change: 0 additions & 1 deletion gcloud/storage/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ def __init__(self, *responses):
self._deleted = []

def api_request(self, **kw):
from gcloud.exceptions import NotFound
self._requested.append(kw)
response, self._responses = self._responses[0], self._responses[1:]
return response
Expand Down
12 changes: 12 additions & 0 deletions scripts/pylintrc_default
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ load-plugins=pylint.extensions.check_docs
# - no-name-in-module: Error gives a lot of false positives for names which
# are defined dynamically. Also, any truly missing names
# will be detected by our 100% code coverage.
#
# New opinions in pylint 1.6, enforcing PEP 257. #1968 for eventual fixes
# - catching-non-exception
# - missing-raises-doc
# - missing-returns-doc
# - redundant-returns-doc
# - ungrouped-imports
disable =
maybe-no-member,
no-member,
Expand All @@ -99,6 +106,11 @@ disable =
redefined-variable-type,
wrong-import-position,
no-name-in-module,
catching-non-exception,
missing-raises-doc,
missing-returns-doc,
redundant-returns-doc,
ungrouped-imports


[REPORTS]
Expand Down
24 changes: 15 additions & 9 deletions scripts/run_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
]
IGNORED_FILES = [
os.path.join('docs', 'conf.py'),
# Both these files cause pylint 1.6 to barf. See:
# https://github.com/PyCQA/pylint/issues/998
os.path.join('gcloud', 'bigtable', 'happybase', 'connection.py'),
os.path.join('gcloud', 'streaming', 'http_wrapper.py'),
'setup.py',
]
SCRIPTS_DIR = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -51,8 +55,6 @@
'import-error',
'invalid-name',
'missing-docstring',
'missing-raises-doc',
'missing-returns-doc',
'no-init',
'no-self-use',
'superfluous-parens',
Expand Down Expand Up @@ -227,13 +229,17 @@ def lint_fileset(filenames, rcfile, description):
if os.path.exists(filename)]
if filenames:
rc_flag = '--rcfile=%s' % (rcfile,)
pylint_shell_command = ['pylint', rc_flag] + filenames
status_code = subprocess.call(pylint_shell_command)
if status_code != 0:
error_message = ('Pylint failed on %s with '
'status %d.' % (description, status_code))
print(error_message, file=sys.stderr)
sys.exit(status_code)
pylint_shell_command = ['pylint', rc_flag]
errors = {} # filename -> status_code
for filename in filenames:
cmd = pylint_shell_command + [filename]
status_code = subprocess.call(cmd)
if status_code != 0:
errors[filename] = status_code
if errors:
for filename, status_code in sorted(errors.items()):
print('%-30s: %d' % (filename, status_code), file=sys.stderr)
sys.exit(len(errors))
else:
print('Skipping %s, no files to lint.' % (description,))

Expand Down