https://github.com/danielde/bang-auditor
https://github.com/danielde/bang-auditor
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/danielde/bang-auditor
- Owner: DanielDe
- Created: 2020-03-16T17:37:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T20:26:13.000Z (over 6 years ago)
- Last Synced: 2025-02-15T18:49:36.313Z (over 1 year ago)
- Language: Swift
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bang-auditor
Identifies and prints out all uses of `!` in your Swift codebase.
Options to ignore specific lines or entire blocks.
## Example
```swift
// test-file.swift
func main() {
let notOkay = maybeSomething()!
let inlineOkay = maybeSomething()! // bang-auditor:ignore
// bang-auditor:disable
let blockOkay = maybeSomething()!
let anotherBlockOkay = maybeSomething() as! User
// bang-auditor:enable
let anotherNotOkay = maybeSomething() as! Employee
}
```
```
⌘ bang-auditor ./test-file.swift
./test-file.swift
line 3
let notOkay = maybeSomething()!
line 12
let anotherNotOkay = maybeSomething() as! Employee
```
## Usage
Accepts one or more file or directory paths.
If a directory path is specified, `bang-auditor` runs on all `.swift` files it finds in that directory.
## Ignore and disable
To ignore bangs on a single line, add a `// bang-auditor:ignore` comment to the end of the line:
```swift
let inlineOkay = maybeSomething()! // bang-auditor:ignore
```
To ignore bangs on multiple lines, surround those lines with a pair of `// bang-auditor:disable` and `// bang-auditor:enable` comments:
```swift
// bang-auditor:disable
let blockOkay = maybeSomething()!
let anotherBlockOkay = maybeSomething() as! User
// bang-auditor:enable
```