Skip to content

Commit

Permalink
Fixed pre-commit hook for CI
Browse files Browse the repository at this point in the history
Testing Done:
ci.sh checks not only changed files

Bugs closed: 2128

Reviewed at https://rbcommons.com/s/twitter/r/2758/
  • Loading branch information
fkorotkov authored and fkorotkov committed Sep 3, 2015
1 parent fb595b6 commit 7d9cd61
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build-support/bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fi
if [[ "${skip_pre_commit_checks:-false}" == "false" ]]; then
banner "Running pre-commit checks"

./build-support/bin/pre-commit.sh || exit 1
FULL_CHECK=1 ./build-support/bin/pre-commit.sh || exit 1
fi

# TODO(John sirois): Re-plumb build such that it grabs constraints from the built python_binary
Expand Down
7 changes: 6 additions & 1 deletion build-support/bin/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

source build-support/common.sh

if [[ -z $FULL_CHECK ]]
then
export GIT_HOOK=1
fi

echo "Checking packages" && ./build-support/bin/check_packages.sh || exit 1
echo "Checking imports" && GIT_HOOK=1 ./build-support/bin/isort.sh || \
echo "Checking imports" && ./build-support/bin/isort.sh || \
die "To fix import sort order, run \`build-support/bin/isort.sh -f\`"
echo "Checking headers" && ./build-support/bin/check_header.sh || exit 1
echo "Success"
Expand Down
4 changes: 3 additions & 1 deletion src/python/pants/backend/core/wrapped_globs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def files_calculator():
return result

buildroot = get_buildroot()
rel_root = os.path.relpath(root, buildroot) if root != buildroot else ''
rel_root = os.path.relpath(root, buildroot)
if rel_root == '.':
rel_root = ''
filespec = self.to_filespec(args, root=rel_root, excludes=excludes)
return FilesetWithSpec(rel_root, filespec, files_calculator)

Expand Down
2 changes: 1 addition & 1 deletion tests/python/pants_test/tasks/test_what_changed.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pants.backend.core.from_target import FromTarget
from pants.backend.core.targets.resources import Resources
from pants.backend.core.tasks.what_changed import WhatChanged
from pants.backend.core.wrapped_globs import RGlobs, Globs
from pants.backend.core.wrapped_globs import Globs, RGlobs
from pants.backend.jvm.targets.jar_dependency import JarDependency
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.backend.jvm.targets.java_library import JavaLibrary
Expand Down

0 comments on commit 7d9cd61

Please sign in to comment.