Skip to content

Commit

Permalink
Docstringchecker fix. (#4)
Browse files Browse the repository at this point in the history
* docstringchecker update

* undoing unnecessary readme change

* again
  • Loading branch information
fernandalavalle authored and mtlynch committed Mar 2, 2018
1 parent e827afa commit cb77b83
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build
Expand Up @@ -28,4 +28,4 @@ pyflakes "${SOURCE_DIR}/" "${TEST_DIR}/"

# Check docstrings for style consistency.
PYTHONPATH=$PYTHONPATH:$(pwd)/third_party/docstringchecker \
pylint --reports=n "$SOURCE_DIR" "$TEST_DIR"
pylint --reports=n --rcfile=.pylintrc "$SOURCE_DIR" "$TEST_DIR"
6 changes: 5 additions & 1 deletion dev_requirements.txt
@@ -1,4 +1,8 @@
# pylint versions prior to 1.5.0 require this specific version of astroid.
astroid==1.3.8
mock
pyflakes==1.6.0
pylint==1.8.2
# We use pylint exclusively to run the DocStringChecker linter and that linter
# expects pre-1.5.0 pylint syntax.
pylint==1.4.4
yapf==0.20.1
2 changes: 1 addition & 1 deletion third_party/docstringchecker/lint.py
Expand Up @@ -147,7 +147,7 @@ def _docstring_indent(node):
if node.display_type() == 'Module':
return 0
else:
return node.col_offset + 2
return node.col_offset + 4

def _check_common(self, node, lines=None):
"""Common checks we enforce on all docstrings"""
Expand Down
5 changes: 4 additions & 1 deletion third_party/docstringchecker/update.sh 100755 → 100644
Expand Up @@ -6,7 +6,10 @@ set -x
OUTPUT_DIR=$(dirname "$0")
OUTPUT_FILE="${OUTPUT_DIR}/lint.py"

# Modify DocStringChecker to expect 4-space indents instead of 2 to match Google
# Python style guide.
wget \
https://chromium.googlesource.com/chromiumos/chromite/+/master/cli/cros/lint.py?format=TEXT \
-O - | \
base64 --decode > "$OUTPUT_FILE"
base64 --decode | sed "s/return node.col_offset + 2/return node.col_offset + 4/" \
> "$OUTPUT_FILE"

0 comments on commit cb77b83

Please sign in to comment.