An open API service indexing awesome lists of open source software.

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

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`.