Skip to content

Commit

Permalink
Skip compressed files
Browse files Browse the repository at this point in the history
This prevents spurious UnicodeDecodeErrors in Python 3.

Adding handling for compressed files would not be hard (using gzip, bz2,
and optionally lzma libraries), but there's probably little benefit,
since compressed files in a project tree are likely either from an
upstream source or have an uncompressed version available for testing.
  • Loading branch information
joshkel committed Aug 23, 2015
1 parent f8f9436 commit 6282992
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dodgy/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def run_checks(directory, ignore_paths=None):
mimetype = mimetypes.guess_type(filepath)
if mimetype[0] is None or not mimetype[0].startswith('text/'):
continue
# Also skip anything with an encoding (e.g., a gzipped CSS).
if mimetype[1]:
continue

for msg_parts in check_file(filepath):
warnings.append({
Expand Down

0 comments on commit 6282992

Please sign in to comment.