Visitar URL original
GH-109408: Move the C file whitespace check from patchcheck to pre-commit by AA-Turner · Pull Request #109890 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove the now-redundant --ci option
  • Loading branch information
AA-Turner committed Oct 10, 2023
commit b15ef27d019295abb3fd560730d993bb3669efa2
31 changes: 3 additions & 28 deletions Tools/patchcheck/patchcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ def changed_files(base_branch=None):
else:
sys.exit('need a git checkout to get modified files')

# Normalize the path to be able to match using .startswith()
filenames2 = list(map(os.path.normpath, filenames))
return filenames2
# Normalize the path to be able to match using str.startswith()
return list(map(os.path.normpath, filenames))


def report_modified_files(file_paths):
Expand Down Expand Up @@ -201,22 +200,6 @@ def regenerated_pyconfig_h_in(file_paths):
return "not needed"


def ci(pull_request):
if pull_request == 'false':
print('Not a pull request; skipping')
return
base_branch = get_base_branch()
file_paths = changed_files(base_branch)
fixed = []
if not fixed:
print('No whitespace issues found')
else:
count = len(fixed)
print(f'Please fix the {n_files_str(count)} with whitespace issues')
print('(on Unix you can run `make patchcheck` to make the fixes)')
sys.exit(1)


def main():
base_branch = get_base_branch()
file_paths = changed_files(base_branch)
Expand Down Expand Up @@ -245,12 +228,4 @@ def main():


if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--ci',
help='Perform pass/fail checks')
args = parser.parse_args()
if args.ci:
ci(args.ci)
else:
main()
main()