Skip to content

Commit dba1bc3

Browse files
committedJan 30, 2023
build: no need for check_eol, pylint does most of it
1 parent eb3536d commit dba1bc3

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed
 

‎igor.py

-72
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import contextlib
1212
import datetime
13-
import fnmatch
1413
import glob
1514
import inspect
1615
import os
@@ -277,77 +276,6 @@ def do_zip_mods():
277276
zf.write("coverage/__main__.py", "__main__.py")
278277

279278

280-
def do_check_eol():
281-
"""Check files for incorrect newlines and trailing white space."""
282-
283-
ignore_dirs = [
284-
'.svn', '.hg', '.git',
285-
'.tox*',
286-
'*.egg-info',
287-
'_build',
288-
'_spell',
289-
'tmp',
290-
'help',
291-
]
292-
checked = set()
293-
294-
def check_file(fname, crlf=True, trail_white=True):
295-
"""Check a single file for white space abuse."""
296-
fname = os.path.relpath(fname)
297-
if fname in checked:
298-
return
299-
checked.add(fname)
300-
301-
line = None
302-
with open(fname, "rb") as f:
303-
for n, line in enumerate(f, start=1):
304-
if crlf:
305-
if b"\r" in line:
306-
print(f"{fname}@{n}: CR found")
307-
return
308-
if trail_white:
309-
line = line[:-1]
310-
if not crlf:
311-
line = line.rstrip(b'\r')
312-
if line.rstrip() != line:
313-
print(f"{fname}@{n}: trailing white space found")
314-
return
315-
316-
if line is not None and not line.strip():
317-
print(f"{fname}: final blank line")
318-
319-
def check_files(root, patterns, **kwargs):
320-
"""Check a number of files for white space abuse."""
321-
for where, dirs, files in os.walk(root):
322-
for f in files:
323-
fname = os.path.join(where, f)
324-
for p in patterns:
325-
if fnmatch.fnmatch(fname, p):
326-
check_file(fname, **kwargs)
327-
break
328-
for ignore_dir in ignore_dirs:
329-
ignored = []
330-
for dir_name in dirs:
331-
if fnmatch.fnmatch(dir_name, ignore_dir):
332-
ignored.append(dir_name)
333-
for dir_name in ignored:
334-
dirs.remove(dir_name)
335-
336-
check_files("coverage", ["*.py"])
337-
check_files("coverage/ctracer", ["*.c", "*.h"])
338-
check_files("coverage/htmlfiles", ["*.html", "*.scss", "*.css", "*.js"])
339-
check_files("tests", ["*.py"])
340-
check_files("tests", ["*,cover"], trail_white=False)
341-
check_files("tests/js", ["*.js", "*.html"])
342-
check_file("setup.py")
343-
check_file("igor.py")
344-
check_file("Makefile")
345-
check_files(".", ["*.rst", "*.txt"])
346-
check_files(".", ["*.pip"])
347-
check_files(".github", ["*"])
348-
check_files("ci", ["*"])
349-
350-
351279
def print_banner(label):
352280
"""Print the version of Python."""
353281
try:

‎tox.ini

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ setenv =
7777

7878
commands =
7979
python -m tabnanny {env:LINTABLE}
80-
python igor.py check_eol
8180
# If this command fails, see the comment at the top of doc/cmd.rst
8281
python -m cogapp -cP --check --verbosity=1 doc/*.rst
8382
python -m cogapp -cP --check --verbosity=1 .github/workflows/*.yml

0 commit comments

Comments
 (0)
Please sign in to comment.