https://github.com/jlyonsmith/xcpretty-warning-counter
A formatter for XCPretty that counts warnings
https://github.com/jlyonsmith/xcpretty-warning-counter
Last synced: about 1 year ago
JSON representation
A formatter for XCPretty that counts warnings
- Host: GitHub
- URL: https://github.com/jlyonsmith/xcpretty-warning-counter
- Owner: jlyonsmith
- License: mit
- Created: 2016-03-11T02:29:28.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-15T21:24:08.000Z (almost 10 years ago)
- Last Synced: 2025-04-06T19:53:26.500Z (about 1 year ago)
- Language: Ruby
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# XCPretty Warning Counter
A custom formatter for [xcpretty](https://github.com/supermarin/xcpretty) that counts warnings and outputs them in JSON and YAML format in files named `warning-counts.json` and `warning-counts.yaml` respectively
## Installation
This formatter is distributed via RubyGems, and depends on a version of `xcpretty` >= 0.0.7 (when custom formatters were introduced). Run:
gem install xcpretty-warning-counter
## Usage
Specify `xcpretty-warning-counter` as a custom formatter to `xcpretty`:
```bash
#!/bin/bash
xcodebuild | xcpretty -f `xcpretty-warning-counter`
```
## How it works
The `--formatter` option takes a file path as an argument, so the `xcpretty-warning-counter` script returns the location of the installed Ruby formatter class. It must be evaluated before the xcpretty arguments are evaluated, hence the backtick wrapping. The Ruby script must return a Ruby class that is a subclass of `XCPretty::Formatter`. This then receives `formatter_*` method invocations as the build output is parsed.
I use the start of the tests as the indicator for when to write the warning file, so this formatter only works for with the `tests` argument of `xcodebuild`.