robotdana / spellr

Spell check your source code
MIT License
34 stars 2 forks source link

How to integrate spellr with gitlab ci #74

Open khalilgharbaoui opened 3 years ago

khalilgharbaoui commented 3 years ago

I have been using pronto and pronto-spell in gitlab ci pipelines for spell checks/comments.

But I would very much like to use spellr instead. (or a pronto-spellr)

Point 8 says: It's easy to integrate with CI pipelines.

Are there some undocumented instructions of sorts somewhere for this?

Or is this only gonna be possible after the STDIN functionality has been added?

Also, how would one go about adding a custom output formatted?

Cheers, Khalil

robotdana commented 3 years ago

hi sorry i didn't see this as i was treating issues as notes to myself. i shouldn't do that.

by easy to set up on ci i mean i've never had difficulty getting it running on ci :D (maybe that's an unfair point)

i've run it in travis, GitHub actions, and buildkite.

example travis code: https://github.com/robotdana/spellr/blob/d549918e4cf20fe095359b627d0f6f8292d0d24d/.travis.yml and this Rakefile https://github.com/robotdana/spellr/blob/d549918e4cf20fe095359b627d0f6f8292d0d24d/Rakefile.yml

for GitHub actions, refer to: https://github.com/robotdana/spellr/blob/main/.github/workflows/ci.yml

it should be happy running on anything that already has either ruby, or docker set up.

--

in terms of custom output format, i don't have a particular system in mind. it could be interesting to develop a custom reporter. i'm not sure spellr is at the point where that would be a public documented interface, but if you want you could make a pr.

if you want to look at the various systems that can be swapped in as reporters then please do: https://github.com/robotdana/spellr/blob/main/lib/spellr/reporter.rb https://github.com/robotdana/spellr/blob/main/lib/spellr/base_reporter.rb https://github.com/robotdana/spellr/blob/main/lib/spellr/wordlist_reporter.rb https://github.com/robotdana/spellr/blob/main/lib/spellr/quiet_reporter.rb https://github.com/robotdana/spellr/blob/main/lib/spellr/interactive.rb

the basic interface for these is 3 methods: initialise(output = nil) output holds the stdin/stdout/stderr and a counts hash, and the exit code lib/spellr/base_reporter.rb call(token) token is a string with a filename and location. this is generally used to print each error. finish finish is called when everything is complete and is generally used to print the counts.