Jon Wayne Parrott | 7b45217 | 2017-04-12 15:33:15 -0700 | [diff] [blame] | 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 = () |