<commit_before># Coveralls::Cobertura

Convert [Cobertura](https://github.com/cobertura/cobertura) XML to
[Coveralls](https://coveralls.io/) source files payload.
<commit_msg>Specify installation and usage in the README<commit_after># Coveralls::Cobertura

Convert [Cobertura](https://github.com/cobertura/cobertura) XML to
[Coveralls](https://coveralls.io/) source files payload.


## Installation
If you're using `bundler`, place the following in your Gemfile:
```ruby
gem 'coveralls-cobertura', '~> 1.0.0'
```
Otherwise, just install the gem:
```shell
gem install coveralls-cobertura
```

## Usage
```ruby
# Leverage the coveralls
require 'coveralls'
require 'coveralls-cobertura'
JOBS_ENDPOINT = 'jobs'
# Assumes you already have a payload
existing_source_files = payload[:source_files]
# Cobertura XML file
filename = 'path/to/cobertura.xml'
# Create a Converter instance
converter = Coveralls::Cobertura::Converter.new(filename)
# Convert to Coveralls
cobertura_source_files = converter.convert
# Merge in the Cobertura generated source files
payload[:source_files] = existing_source_files.merge(cobertura_source_files)
Coveralls::API.post_json(JOBS_ENDPOINT, payload)
```

{'fraction_non_alphanumeric': 0.11789652247667515, 'fraction_numerical': 0.002544529262086514, 'mean_word_length': 6.7631578947368425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4381207', 'n_tokens_mistral': 397, 'n_tokens_neox': 375, 'n_words': 96}