diff options
author | Craig Hesling <hesling@chromium.org> | 2021-07-30 22:03:33 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-02 19:54:10 +0000 |
commit | 5af75662e7d236f887cbb1c295e4317fce00184b (patch) | |
tree | d28efdb402025cf3418ac5e6cf8545d156ca1ddc | |
parent | a7a96fc737e40f110bee0a33299c982cdebc7014 (diff) | |
download | chrome-ec-5af75662e7d236f887cbb1c295e4317fce00184b.tar.gz |
pylintrc: Copy Chromium OS platform2's config
This requests that cros lint (and repo upload hook) use the new
Chromium OS 4 space indent policy.
Since legacy python scripts still use 2 space, I added pylint ignore
statements to the individual files to disable indentation checking.
Note: There are still valid pylint errors in some of these legacy scripts.
BRANCH=none
BUG=none
TEST=cros lint util/*.py
Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: I439f5a87bc50f1f43a4996e574bbc0626922a88e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3064761
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
30 files changed, 476 insertions, 0 deletions
diff --git a/chip/ish/util/pack_ec.py b/chip/ish/util/pack_ec.py index f1ce28539e..bd9b823cab 100755 --- a/chip/ish/util/pack_ec.py +++ b/chip/ish/util/pack_ec.py @@ -4,6 +4,10 @@ # Copyright 2019 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # A script to pack EC binary with manifest header according to # Based on 607297_Host_ISH_Firmware_Load_Chrome_OS_SAS_Rev0p5.pdf, diff --git a/chip/mchp/util/pack_ec.py b/chip/mchp/util/pack_ec.py index 4917deee5d..7908b0bf37 100755 --- a/chip/mchp/util/pack_ec.py +++ b/chip/mchp/util/pack_ec.py @@ -3,6 +3,10 @@ # Copyright 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # A script to pack EC binary into SPI flash image for MEC17xx # Based on MEC170x_ROM_Description.pdf DS00002225C (07-28-17). diff --git a/chip/mchp/util/pack_ec_mec152x.py b/chip/mchp/util/pack_ec_mec152x.py index 899ee2af10..34846cd6ba 100755 --- a/chip/mchp/util/pack_ec_mec152x.py +++ b/chip/mchp/util/pack_ec_mec152x.py @@ -3,6 +3,10 @@ # Copyright 2021 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # A script to pack EC binary into SPI flash image for MEC152x # Based on MEC1521/MEC1523_ROM_Description.pdf diff --git a/chip/mchp/util/pack_ec_mec172x.py b/chip/mchp/util/pack_ec_mec172x.py index 2f4727c483..32747d3d9a 100755 --- a/chip/mchp/util/pack_ec_mec172x.py +++ b/chip/mchp/util/pack_ec_mec172x.py @@ -3,6 +3,10 @@ # Copyright 2021 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # A script to pack EC binary into SPI flash image for MEC172x # Based on MEC172x_ROM_Description.pdf revision 6/8/2020 diff --git a/chip/mec1322/util/pack_ec.py b/chip/mec1322/util/pack_ec.py index bec27bdcce..9783ffb2d5 100755 --- a/chip/mec1322/util/pack_ec.py +++ b/chip/mec1322/util/pack_ec.py @@ -3,6 +3,10 @@ # Copyright 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # A script to pack EC binary into SPI flash image for MEC1322 # Based on MEC1322_ROM_Doc_Rev0.5.pdf. diff --git a/cts/common/board.py b/cts/common/board.py index 478da1479c..d2c8e02b04 100644 --- a/cts/common/board.py +++ b/cts/common/board.py @@ -1,6 +1,10 @@ # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # Note: This is a py2/3 compatible file. diff --git a/cts/cts.py b/cts/cts.py index 95a3b1c5f3..c3e0335cab 100755 --- a/cts/cts.py +++ b/cts/cts.py @@ -3,6 +3,10 @@ # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # A script which builds, flashes, and runs EC CTS # diff --git a/extra/stack_analyzer/stack_analyzer.py b/extra/stack_analyzer/stack_analyzer.py index 04c65174f8..77d16d5450 100755 --- a/extra/stack_analyzer/stack_analyzer.py +++ b/extra/stack_analyzer/stack_analyzer.py @@ -2,6 +2,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Statically analyze stack usage of EC firmware. diff --git a/extra/stack_analyzer/stack_analyzer_unittest.py b/extra/stack_analyzer/stack_analyzer_unittest.py index 09753625c9..c36fa9da45 100755 --- a/extra/stack_analyzer/stack_analyzer_unittest.py +++ b/extra/stack_analyzer/stack_analyzer_unittest.py @@ -2,6 +2,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Tests for Stack Analyzer classes and functions.""" diff --git a/extra/tigertool/ecusb/__init__.py b/extra/tigertool/ecusb/__init__.py index c2af553d57..fe4dbc6749 100644 --- a/extra/tigertool/ecusb/__init__.py +++ b/extra/tigertool/ecusb/__init__.py @@ -1,5 +1,9 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes __all__ = ['tiny_servo_common', 'stm32usb', 'stm32uart', 'pty_driver'] diff --git a/extra/tigertool/ecusb/pty_driver.py b/extra/tigertool/ecusb/pty_driver.py index e5ff043aad..137cbc149b 100644 --- a/extra/tigertool/ecusb/pty_driver.py +++ b/extra/tigertool/ecusb/pty_driver.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """ptyDriver class diff --git a/extra/tigertool/ecusb/stm32uart.py b/extra/tigertool/ecusb/stm32uart.py index fa0ed96820..95219455a9 100644 --- a/extra/tigertool/ecusb/stm32uart.py +++ b/extra/tigertool/ecusb/stm32uart.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Allow creation of uart/console interface via stm32 usb endpoint.""" diff --git a/extra/tigertool/ecusb/stm32usb.py b/extra/tigertool/ecusb/stm32usb.py index 875251329f..bfd5fbb1fb 100644 --- a/extra/tigertool/ecusb/stm32usb.py +++ b/extra/tigertool/ecusb/stm32usb.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Allows creation of an interface via stm32 usb.""" diff --git a/extra/tigertool/ecusb/tiny_servo_common.py b/extra/tigertool/ecusb/tiny_servo_common.py index dbbe42fea8..152c238bdf 100644 --- a/extra/tigertool/ecusb/tiny_servo_common.py +++ b/extra/tigertool/ecusb/tiny_servo_common.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Utilities for using lightweight console functions.""" diff --git a/extra/tigertool/ecusb/tiny_servod.py b/extra/tigertool/ecusb/tiny_servod.py index aec87995a4..632d9c3a20 100644 --- a/extra/tigertool/ecusb/tiny_servod.py +++ b/extra/tigertool/ecusb/tiny_servod.py @@ -1,6 +1,10 @@ # Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Helper class to facilitate communication to servo ec console.""" diff --git a/extra/tigertool/tigertool.py b/extra/tigertool/tigertool.py index 21b046c1d3..79aa30c3a4 100755 --- a/extra/tigertool/tigertool.py +++ b/extra/tigertool/tigertool.py @@ -2,6 +2,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Script to control tigertail USB-C Mux board.""" diff --git a/extra/usb_power/convert_power_log_board.py b/extra/usb_power/convert_power_log_board.py index da0750ea86..8aab77ee4c 100644 --- a/extra/usb_power/convert_power_log_board.py +++ b/extra/usb_power/convert_power_log_board.py @@ -2,6 +2,10 @@ # Copyright 2018 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """ Program to convert sweetberry config to servod config template. diff --git a/extra/usb_power/convert_servo_ina.py b/extra/usb_power/convert_servo_ina.py index 1dae2393a8..1c70f31aeb 100755 --- a/extra/usb_power/convert_servo_ina.py +++ b/extra/usb_power/convert_servo_ina.py @@ -2,6 +2,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Program to convert power logging config from a servo_ina device to a sweetberry config. diff --git a/extra/usb_power/powerlog.py b/extra/usb_power/powerlog.py index c7fe7477a7..82cce3daed 100755 --- a/extra/usb_power/powerlog.py +++ b/extra/usb_power/powerlog.py @@ -2,6 +2,10 @@ # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Program to fetch power logging data from a sweetberry device or other usb device that exports a USB power logging interface. diff --git a/extra/usb_power/powerlog_unittest.py b/extra/usb_power/powerlog_unittest.py index 7058c57aa7..1d0718530e 100644 --- a/extra/usb_power/powerlog_unittest.py +++ b/extra/usb_power/powerlog_unittest.py @@ -1,6 +1,11 @@ # Copyright 2018 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes + """Unit tests for powerlog.""" import os diff --git a/extra/usb_power/stats_manager.py b/extra/usb_power/stats_manager.py index 9a4f4751fb..0f8c3fcb15 100644 --- a/extra/usb_power/stats_manager.py +++ b/extra/usb_power/stats_manager.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Calculates statistics for lists of data and pretty print them.""" diff --git a/extra/usb_power/stats_manager_unittest.py b/extra/usb_power/stats_manager_unittest.py index f9e5e35c84..beb9984b93 100644 --- a/extra/usb_power/stats_manager_unittest.py +++ b/extra/usb_power/stats_manager_unittest.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Unit tests for StatsManager.""" diff --git a/extra/usb_serial/console.py b/extra/usb_serial/console.py index bd1fbaacc6..7b3bacd903 100755 --- a/extra/usb_serial/console.py +++ b/extra/usb_serial/console.py @@ -2,6 +2,10 @@ # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Allow creation of uart/console interface via usb google serial endpoint.""" diff --git a/extra/usb_updater/fw_update.py b/extra/usb_updater/fw_update.py index ebc7623ac2..0d7a570fc3 100755 --- a/extra/usb_updater/fw_update.py +++ b/extra/usb_updater/fw_update.py @@ -2,6 +2,10 @@ # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # Upload firmware over USB # Note: This is a py2/3 compatible file. diff --git a/extra/usb_updater/servo_updater.py b/extra/usb_updater/servo_updater.py index 20ef51803c..82b15c3250 100755 --- a/extra/usb_updater/servo_updater.py +++ b/extra/usb_updater/servo_updater.py @@ -2,6 +2,10 @@ # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # Note: This is a py2/3 compatible file. diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000000..9ec7f3c61a --- /dev/null +++ b/pylintrc @@ -0,0 +1,358 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# This file is copied Chromium OS platform2, as seen in the following link: +# https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/pylintrc +# Please keep in sync. + +# NB: This is a fork of chromite/pylintrc with indent set to 4. +# Everything else is kept the same. + +[MASTER] + +# Add files or directories matching the regex patterns to the ignore list. +# The regex matches against base names, not paths. +ignore-patterns= + .*_pb2\.py$, + .*third_party\/.*.py$ + + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + chromite.cli.cros.lint, + pylint.extensions.bad_builtin, + pylint.extensions.docstyle, + pylint.extensions.redefined_variable_type, + pylint.extensions.overlapping_exceptions, + +# Configure quote preferences. +string-quote = single-avoid-escape +triple-quote = double +docstring-quote = double + + +[MESSAGES CONTROL] + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple times. +# eq-without-hash: We omit this as we don't require all objects be hashable. +# We'll wait for unittest coverage to detect missing __hash__ on objects. +# no-absolute-import: We don't seem to rely on this behavior, so don't enforce +# using this future import everywhere. +# round-builtin: We omit this as all our usage of round() is OK with either +# Python 2 or 3 behavior (and probably leans towards 3 anyways). +enable= + apply-builtin, + backtick, + bad-python3-import, + basestring-builtin, + buffer-builtin, + cmp-builtin, + cmp-method, + coerce-builtin, + coerce-method, + delslice-method, + deprecated-itertools-function, + deprecated-str-translate-call, + deprecated-string-function, + deprecated-types-field, + dict-items-not-iterating, + dict-iter-method, + dict-keys-not-iterating, + dict-values-not-iterating, + dict-view-method, + div-method, + exception-message-attribute, + execfile-builtin, + file-builtin, + filter-builtin-not-iterating, + getslice-method, + hex-method, + idiv-method, + import-star-module-level, + indexing-exception, + intern-builtin, + invalid-str-codec, + long-builtin, + long-suffix, + map-builtin-not-iterating, + metaclass-assignment, + next-method-called, + next-method-defined, + nonzero-method, + oct-method, + old-ne-operator, + old-octal-literal, + old-raise-syntax, + parameter-unpacking, + print-statement, + raising-string, + range-builtin-not-iterating, + raw_input-builtin, + rdiv-method, + reduce-builtin, + reload-builtin, + setslice-method, + standarderror-builtin, + sys-max-int, + unichr-builtin, + unicode-builtin, + unpacking-in-except, + using-cmp-argument, + xrange-builtin, + zip-builtin-not-iterating, + + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +# We leave many of the style warnings to judgement/peer review. +# TODO: We need to re-enable broad-except, but requires cleaning up our code. +# TODO: Re-enable redefined-variable-type. +# TODO: Re-enable inconsistent-return-statements. +# TODO: Re-enable keyword-arg-before-vararg once we're on Python 3-only. +# TODO: Re-enable useless-object-inheritance once we're on Python 3-only and +# we update the style guide. +# TODO: Re-enable import-outside-toplevel. +# TODO: Re-enable unnecessary-comprehension. +# TODO: Re-enable consider-using-dict-comprehension. +# TODO: Re-enable consider-using-set-comprehension. +# TODO: Re-enable consider-using-in. +# TODO: Re-enable try-except-raise. +# TODO: Re-enable chained-comparison. +disable= + broad-except, + chained-comparison, + consider-iterating-dictionary, + consider-using-dict-comprehension, + consider-using-in, + consider-using-set-comprehension, + fixme, + file-ignored, + keyword-arg-before-vararg, + import-outside-toplevel, + inconsistent-return-statements, + invalid-name, + locally-disabled, + locally-enabled, + missing-docstring, + no-member, + no-else-break, + no-else-continue, + no-else-raise, + no-else-return, + no-self-use, + raise-missing-from, + redefined-variable-type, + relative-import, + super-with-arguments, + too-few-public-methods, + too-many-arguments, + too-many-boolean-expressions, + too-many-branches, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-nested-blocks, + too-many-public-methods, + too-many-return-statements, + too-many-statements, + try-except-raise, + unnecessary-comprehension, + useless-object-inheritance, + + +[REPORTS] + +# Tells whether to display a full report or only the messages +# CHANGE: No report. +reports=no + +# Activate the evaluation score. +score=no + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=80 + +# Disable line length enforcement for import statements or comment lines +# containing URLs. +ignore-long-lines=(^(import|from))|(^\s*(# )?<?https?://\S+>?$) + +# Maximum number of lines in a module +#max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + + +[TYPECHECK] + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes=hashlib,numpy + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. +# CHANGE: Added tempdir for @osutils.TempDirDecorator. +generated-members=REQUEST,acl_users,aq_parent,tempdir + +# List of modules for which member attributes should not be checked. +# Modules listed here will not trigger import errors even if the linter can't +# import them. +# +# pytest: Made available by our testing virtualenv and can be assumed exists. +ignored-modules=pytest + +[BASIC] + +# List of builtins function names that should not be used, separated by a comma. +# exit & quit are for the interactive interpreter shell only. +# https://docs.python.org/3/library/constants.html#constants-added-by-the-site-module +bad-functions= + apply, + exit, + filter, + map, + quit, + reduce, + +# Regular expression which should only match correct function names +# +# CHANGE: The ChromiumOS standard is different than PEP-8, so we need to +# redefine this. +# +# Common exceptions to ChromiumOS standard: +# - main: Standard for main function +function-rgx=([A-Z_][a-zA-Z0-9]{2,30}|main)$ + +# Regular expression which should only match correct method names +# +# CHANGE: The ChromiumOS standard is different than PEP-8, so we need to +# redefine this. Here's what we allow: +# - CamelCaps, starting with a capital letter. No underscores in function +# names. Can also have a "_" prefix (private method) or a "test" prefix +# (unit test). +# - Methods that look like __xyz__, which are used to do things like +# __init__, __del__, etc. +# - setUp, tearDown: For unit tests. +method-rgx=((_|test)?[A-Z][a-zA-Z0-9]{2,30}|__[a-z]+__|setUp|tearDown)$ + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=20 + + +[VARIABLES] + +# A regular expression matching the beginning of the name of dummy variables +# (i.e. not used). +dummy-variables-rgx=_|unused_ + + +[DESIGN] + +# Maximum number of parents for a class (see R0901). +max-parents=10 + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma. +# __builtin__: Use the 'six.moves.builtins' module instead +# (or 'builtins' in Python 3). +# apiclient: Use the 'googleapiclient' module instead. +# Bastion: Dropped in Python 3. +# ConfigParser: Use the 'six.moves.configparser' module instead +# (or 'configparser' in Python 3). +# cookielib: Use the 'six.moves.http_cookiejar' module instead +# (or 'http.cookiejar' in Python 3). +# cPickle: Use the 'pickle' module instead. +# cStringIO: Use 'io.StringIO' or 'io.BytesIO' instead. +# exceptions: Dropped in Python 3. +# HTMLParser: Use the 'six.moves.html_parser' module instead +# (or 'html.parser' in Python 3). +# httplib: Use the 'six.moves.http_client' module instead +# (or 'http.client' in Python 3). +# md5: Use the 'hashlib' module instead. +# mox: Use the 'mock' module instead. +# optparse: Use the 'argparse' module instead. +# Queue: Use the 'six.moves.queue' module instead (or 'queue' in Python 3). +# regsub: Use the 're' module instead. +# rexec: Dropped in Python 3. +# StringIO: Use 'io.StringIO' or 'io.BytesIO' instead. +# TERMIOS: Use the 'termios' module instead. +# urllib2: Use the 'six.moves.urllib' module instead +# (or 'urllib.request' in Python 3). +# urlparse: Use the 'six.moves.urllib' module instead +# (or 'urllib.parse' in Python 3). +deprecated-modules= + __builtin__, + apiclient, + Bastion, + ConfigParser, + cookielib, + cPickle, + cStringIO, + exceptions, + HTMLParser, + httplib, + md5, + mock, + mox, + optparse, + Queue, + regsub, + rexec, + StringIO, + TERMIOS, + urllib2, + urlparse, + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party= + _emerge, + apiclient, + elftools, + gcloud, + google, + googleapiclient, + httplib2, + jinja2, + jsonschema, + lddtree, + magic, + mock, + oauth2client, + portage, + pylint, + pytest, + requests, + six, + sqlalchemy, + yaml, + + +[LOGGING] + +# Apply logging string format checks to calls on these modules. +logging-modules= + logging, diff --git a/util/config_option_check.py b/util/config_option_check.py index 6b6d3c0bc9..29e8fb8611 100755 --- a/util/config_option_check.py +++ b/util/config_option_check.py @@ -2,6 +2,11 @@ # Copyright 2015 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes + """Configuration Option Checker. Script to ensure that all configuration options for the Chrome EC are defined diff --git a/util/run_ects.py b/util/run_ects.py index a633430113..9178328e5f 100644 --- a/util/run_ects.py +++ b/util/run_ects.py @@ -1,6 +1,10 @@ # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """Run all eCTS tests and publish results.""" diff --git a/util/uart_stress_tester.py b/util/uart_stress_tester.py index c71826da25..b3db60060e 100755 --- a/util/uart_stress_tester.py +++ b/util/uart_stress_tester.py @@ -3,6 +3,10 @@ # Copyright 2019 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes """ChromeOS Uart Stress Test diff --git a/util/unpack_ftb.py b/util/unpack_ftb.py index 62f5161a4a..03127a7089 100755 --- a/util/unpack_ftb.py +++ b/util/unpack_ftb.py @@ -2,6 +2,10 @@ # Copyright 2018 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Ignore indention messages, since legacy scripts use 2 spaces instead of 4. +# pylint: disable=bad-indentation,docstring-section-indent +# pylint: disable=docstring-trailing-quotes # Note: This is a py2/3 compatible file. |