DEFRA / os-map-ref

OsMapRef is a tool to help handle UK Ordnance Survey map references, in particular to convert them to other coordinate systems
Other
2 stars 5 forks source link

Use multiple rubocop formats in Travis build #35

Closed Cruikshanks closed 4 years ago

Cruikshanks commented 4 years ago

We initially used the default progress formatter when we first started building with Travis for our CI. When we then integrated with SonarCloud we switched the format to output a JSON file as that was what it needed. This meant if we got any rubocop issues it was no longer possible to see them in the build output. You would have to check SonarCloud.

Recently we have been getting a few projects fail because bundle exec rubocop --format=json --out=rubocop-result.json was returning exit code 1. As we couldn't immediately recreate the issue locally we assumed something might be broken with rubocop or our setup and chalked it up for further investigation. At the same time, we made sure our project defra-ruby-style was using the latest version of rubocop and pushed a new release. This triggered a number of broken builds across our projects which forced us to investigate the whole issue now.

What came to light was

On this basis, we're going through all our repos and updating the Travis config to use an updated rubocop command

bundle exec rubocop --format progress --format json --out rubocop-result.json

This will mean we'll not only provide what SonarCloud needs, but we'll see immediately if the failure is because rubocop thinks there has been a violation. Hopefully, this will stop us getting confused in future!