Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TitleAuditor.scala « auditing « rorschach « getbootstrap « com « scala « main « src - github.com/twbs/rorschach.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f863778aee02315857397df3f2212dbab801ab33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.getbootstrap.rorschach.auditing

import com.getbootstrap.rorschach.util._

object TitleAuditor {
  private val message =
    """[The title of this pull request strongly suggests that you were using Bootstrap to test out Git or GitHub, rather than proposing a legitimate change.](https://github.com/twbs/rorschach/blob/master/docs/title.md)
      |If that's accurate, please **DON'T** do that again!
      |Instead, [use *your own personal repositories*](https://guides.github.com/activities/hello-world/) to experiment with [how to use Git or GitHub](https://help.github.com/articles/good-resources-for-learning-git-and-github/).
      |Using the repos of public projects (such as Bootstrap) for such experiments wastes the time of those projects' maintainers
      |and is thus considered rude.""".stripMargin.replaceAllLiterally("\n", " ")

  def audit(title: String): Seq[String] = {
    val cleanedTitle = title.trim.asciiLowerCased
    if (
      title.startsWith("Merge pull request #1 from ")
      || title.startsWith("Create ")
      || cleanedTitle == "master"
      || cleanedTitle == "test"
    ) {
      Seq(message)
    }
    else {
      Nil
    }
  }
}