Ensure proper file executable permissions in CI. (#24214)

Summary:
Some files have inproper executable permissions (which git tracks). This
commit adds a test in CI to ensure that executable permissions are off
for files that shouldn't have such a permission. This also ensures fixes
such as https://github.com/pytorch/pytorch/issues/21305 are complied in the future.

 ---

Disclaimer: I'm the author of flake8-executable, and I've been using it
on my end for over a month and thus I think it should be stable enough.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/24214

Differential Revision: D16783437

Pulled By: ezyang

fbshipit-source-id: 018e55798f1411983c65444e6304a25c5763cd19
This commit is contained in:
Hong Xu 2019-08-16 06:08:30 -07:00 committed by Facebook Github Bot
parent 482607c16c
commit cef0443464
4 changed files with 13 additions and 1 deletions

View file

@ -5,6 +5,8 @@ max-line-length = 120
# E501 is not flexible enough, we're using B950 instead
ignore =
E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,
# EXE001 is skipped for now because some files use shebang to determine Python version.
EXE001,
# these ignores are from flake8-bugbear; please fix!
B007,B008,
# these ignores are from flake8-comprehensions; please fix!

0
aten/src/ATen/native/cuda/PersistentSoftmax.cuh Executable file → Normal file
View file

View file

@ -31,6 +31,16 @@ jobs:
versionSpec: "2.7"
- script: (! git grep -I -l $'\t' -- . ':(exclude)*.svg' ':(exclude)**Makefile' ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have tabs; please convert them to spaces"; false))
- job: ensure_not_executable
displayName: "Ensure C++ source files are not executable"
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "2.7"
- script: (! find . \( -path ./third_party -o -path ./.git -o -path ./torch/bin -o -path ./build \) -prune -o -type f -executable -regextype posix-egrep -not -regex '.+(\.(bash|sh|py|so)|git-pre-commit)$' -print | grep . || (echo 'The above files have executable permission; please remove their executable permission by using `chmod -x`'; false))
- job: python_27_lint
displayName: "Python 2.7 Lint"
pool:
@ -52,7 +62,7 @@ jobs:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.7"
- script: pip install flake8 flake8-bugbear flake8-mypy flake8-comprehensions flake8-pyi mccabe pycodestyle pyflakes
- script: pip install flake8 flake8-bugbear flake8-mypy flake8-comprehensions flake8-executable flake8-pyi mccabe pycodestyle pyflakes
- script: flake8 1>&2
- job: mypy_typecheck

0
binaries/convert_image_to_tensor.cc Executable file → Normal file
View file