Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make checks DRY #12

rafalchmiel opened this Issue Jul 7, 2014 · 2 comments


None yet
2 participants

rafalchmiel commented Jul 7, 2014

I was browsing through Flint's source code and thought that there must be a better DRY-er way of implementing the checks. I thought I'd learn some Go and try DRY up the flint/flint.go file. Here is what I came up with:

func (l *Lint) Check(file, message, fixme string) {
    if !l.findFile(file) {
        l.Errors = append(l.Errors, &lintError{2, message})
        l.Errors = append(l.Errors, &lintError{0, fixme})

func (l *Lint) CheckReadme() {
        "[ERROR] README not found",
        "[FIXME] Every project begins with a README. http://bit.ly/1dqUYQF")

// etc.
=== RUN TestCheckReadme
--- PASS: TestCheckReadme (0.00 seconds)

I thought I'd ask you whether you'd merge a Pull Request before I actually made one. I think this is a good idea because I've ported Flint to Ruby some time ago (making Friction) and this is more or less the way I implemented it there.

Apologies for my Go code, I literally got started with it 3 hours ago. I've ran go fmt on it so it should be alright style-wise.


pengwynn commented Jul 8, 2014

I could be persuaded. No need to apologize. Send over a PR and we can kick the idea around. 👞💥💡


rafalchmiel commented Jul 8, 2014

See #13.

@rafalchmiel rafalchmiel closed this Jul 8, 2014

pengwynn added a commit that referenced this issue Jul 10, 2014

Merge pull request #13 from rafalchmiel/master
Make checks DRY (as discussed in #12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment