Skip to content

Commit

Permalink
fix(encoding): prevent rubocop from crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenrixon committed Feb 5, 2024
1 parent e67eda0 commit 9827e3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ AllCops:
- "examples/**/*.rb"
- "*.rb"
Exclude:
- "*.erb"
- "*.lua"
- "**/*.erb"
- "**/.DS_Store"
- "**/*.lua"
- "assets/**/*"
- "bin/**/*"
- "doc/**/*"
- "docs/**/*"
- "lib/tasks/**/*"
- "lib/sidekiq_unique_jobs/lua/**/*"
- "lib/sidekiq_unique_jobs/web/views/**/*"
- "lib/tasks/**/*"
- "myapp/**/*"
- "Sidekiq/**/*"
- "vendor/**/*"
Expand Down
14 changes: 14 additions & 0 deletions testutf8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Loop through all files in the repository
find ./lib -type f | while read file; do
# if ! rubocop $file > /dev/null 2>&1; then
# echo "Invalid UTF-8 in file: $file"
# fi

# Attempt to convert the file encoding from UTF-8 to UTF-8, checking for invalid sequences
if ! iconv -f UTF-8 -t UTF-8 "$file" > /dev/null 2>&1; then
# If iconv exits with a non-zero status, the file contains invalid UTF-8 sequences
echo "Invalid UTF-8 in file: $file"
fi
done

0 comments on commit 9827e3a

Please sign in to comment.