Sha256: 7fadbeeebedc83bd6e490c28d770ed2ceb3cd847f07fa6e80a64d14280939a42

Contents?: true

Size: 844 Bytes

Versions: 10

Compression:

Stored size: 844 Bytes

Contents

module Peppermint
  class GwenGPT
    def self.lint(subj, body)
      if subj.match?(/[[:punct:]]$/)
        [false, "cannot end with punctuation"]
      elsif subj.match?(/^[a-z]/)
        [false, "cannot start with lowercase letter"]
      elsif subj.length > 120
        [false, "subject too long"]
      elsif subj.match?(/^[[:digit:]]*$/)
        [false, "no fastgit"]
      elsif body.count("\n") > 4
        [false, "large body"]
      else
        [true, "fine"]
      end
    end
  end
end

desc "lint your git hist"
task :gwenGPT do
  gitlog_raw = `git log --pretty=format:"%h~%s~%b~" --date=short main..`
  gitlog_raw.split("~", -1)
    .each_slice(3) { |row|
    if row.length == 3
      _, msg = Peppermint::GwenGPT.lint(row[1], row[2])
      print "%-10s%-60s%-30s\n" % ([row[0], row[1], msg].map { |s| s.strip })
    end
  }
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
peppermint-0.1.19 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.18 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.17 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.16 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.15 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.14 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.13 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.12 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.11 lib/peppermint/rake/gwenGPT.rb
peppermint-0.1.10 lib/peppermint/rake/gwenGPT.rb