Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 7b45217

Browse files
author
Jon Wayne Parrott
authored
Move run_pylint to gcp-devrel-py-tools (#153)
1 parent ca1eabc commit 7b45217

7 files changed

Lines changed: 84 additions & 278 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ tests/data/user-key.json
3030

3131
# PyCharm configuration:
3232
.idea
33+
34+
# Generated files
35+
pylintrc
36+
pylintrc.test

pylint.config.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright 2016 Google Inc.
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+
15+
"""This module is used to config gcp-devrel-py-tools run-pylint."""
16+
17+
import copy
18+
19+
library_additions = {
20+
'MESSAGES CONTROL': {
21+
'disable': [
22+
'I',
23+
'import-error',
24+
'no-member',
25+
'protected-access',
26+
'redefined-variable-type',
27+
'similarities',
28+
'no-else-return',
29+
],
30+
},
31+
}
32+
33+
library_replacements = {
34+
'MASTER': {
35+
'ignore': ['CVS', '.git', '.cache', '.tox', '.nox'],
36+
'load-plugins': 'pylint.extensions.check_docs',
37+
},
38+
'REPORTS': {
39+
'reports': 'no',
40+
},
41+
'BASIC': {
42+
'method-rgx': '[a-z_][a-z0-9_]{2,40}$',
43+
'function-rgx': '[a-z_][a-z0-9_]{2,40}$',
44+
},
45+
'TYPECHECK': {
46+
'ignored-modules': ['six', 'google.protobuf'],
47+
},
48+
'DESIGN': {
49+
'min-public-methods': '0',
50+
'max-args': '10',
51+
'max-attributes': '15',
52+
},
53+
}
54+
55+
test_additions = copy.deepcopy(library_additions)
56+
test_additions['MESSAGES CONTROL']['disable'].extend([
57+
'missing-docstring',
58+
'no-self-use',
59+
'redefined-outer-name',
60+
'unused-argument',
61+
'no-name-in-module',
62+
])
63+
test_replacements = copy.deepcopy(library_replacements)
64+
test_replacements.setdefault('BASIC', {})
65+
test_replacements['BASIC'].update({
66+
'good-names': ['i', 'j', 'k', 'ex', 'Run', '_', 'fh', 'pytestmark'],
67+
'method-rgx': '[a-z_][a-z0-9_]{2,80}$',
68+
'function-rgx': '[a-z_][a-z0-9_]{2,80}$',
69+
})
70+
71+
ignored_files = ()

scripts/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

scripts/run_pylint.py

Lines changed: 0 additions & 260 deletions
This file was deleted.

scripts/travis.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,3 @@ fi
4040
# Run tox.
4141
echo "Running tox..."
4242
tox
43-
44-
# Run tox for sub-packages.
45-
if [[ $TOXENV != "docs" && -z $SYSTEM_TEST ]]; then
46-
echo "Running tox for google_auth_httplib2..."
47-
cd additional_packages/google_auth_httplib2
48-
# --workdir is specified to avoid path names being too long, which
49-
# causes subprocess calls to hit the execve character limit.
50-
# See https://github.com/pypa/virtualenv/issues/596
51-
tox --workdir ~/.tox-httplib2
52-
cd $ROOT
53-
echo "Running tox for google_auth_oauthlib..."
54-
cd additional_packages/google_auth_oauthlib
55-
tox --workdir ~/.tox-oauthlib
56-
fi

tests/transport/test_requests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def refresh(self, request):
4949

5050
class MockAdapter(requests.adapters.BaseAdapter):
5151
def __init__(self, responses, headers=None):
52+
super(MockAdapter, self).__init__()
5253
self.responses = responses
5354
self.requests = []
5455
self.headers = headers or {}
@@ -57,6 +58,11 @@ def send(self, request, **kwargs):
5758
self.requests.append(request)
5859
return self.responses.pop(0)
5960

61+
def close(self): # pragma: NO COVER
62+
# pylint wants this to be here because it's abstract in the base
63+
# class, but requests never actually calls it.
64+
return
65+
6066

6167
def make_response(status=http_client.OK, data=None):
6268
response = requests.Response()

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ commands =
7777
--import-order-style=google \
7878
--application-import-names="google,tests,system_tests" \
7979
google tests
80-
python {toxinidir}/scripts/run_pylint.py \
80+
gcp-devrel-py-tools run-pylint \
81+
--config pylint.config.py \
8182
--library-filesets google \
8283
--test-filesets tests system_tests
8384
deps =
8485
flake8
8586
flake8-import-order
8687
pylint
8788
docutils
89+
gcp-devrel-py-tools

0 commit comments

Comments
 (0)