Skip to content

Instantly share code, notes, and snippets.

@eggplants
Last active June 4, 2024 05:42
Show Gist options
  • Save eggplants/245a0a157c5a4e6e7bf2534eded79802 to your computer and use it in GitHub Desktop.
Save eggplants/245a0a157c5a4e6e7bf2534eded79802 to your computer and use it in GitHub Desktop.
Write all errors once in disabled_rules in .swiftlint.yml / 既存プロジェクトにSwiftLintを導入するときに全てのエラーを一旦 .swiftlint.yml の disabled_rules に書く
#!/usr/bin/env bash
# In `Podfile`:
# ```
# # Linter / Formatter
# pod 'SwiftLint'
# ```
cat <<'A' > .swiftlint.yml
# Directory and file filters
excluded:
- Pods
# Enabled/disabled rules
analyzer_rules:
- unused_declaration
- unused_import
opt_in_rules:
- all
# TODO: ルールを有効化して修正する
disabled_rules:
A
./Pods/SwiftLint/swiftlint |
rev |
grep -oE '^)[^(]+' | cut -b2- |
rev |
sort | uniq -c | awk '$0=" - "$2" # "$1" violation(s)"' >> .swiftlint.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment