Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lox committed Sep 5, 2017
0 parents commit f1b0a10
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
steps:
- label: "🤡 :hammer:"
plugins:
docker-compose#v1.3.1:
run: tests
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2017 Buildkite

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Clown Detection Buildkite Plugin

A [Buildkite](https://buildkite.com/) plugin for detecting whether your code has any clowns in it.

## Example

```yml
steps:
- plugins:
detect-clowns#v1.0.0
```
## License
MIT (see [LICENSE](LICENSE))
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '2'
services:
tests:
image: buildkite/plugin-tester
volumes:
- ".:/plugin:ro"
11 changes: 11 additions & 0 deletions hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail

echo "--- Searching for Clowns 🤡"
echo "$BUILDKITE_BUILD_CHECKOUT_PATH"

if grep -inIEr --color=ALWAYS -C1 "🤡" . ; then
echo "^^^ +++"
echo "+++ :warning: Detected clowns! 🔪"
exit 1
fi
6 changes: 6 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "detect-clowns ",
"description": "Detects clown emojis in your codebase",
"author": "@buildkite",
"public": true
}
19 changes: 19 additions & 0 deletions tests/command.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bats

load '/usr/local/lib/bats/load.bash'

@test "Post-checkout filters clowns" {
tmp_dir=$(mktemp -d -t clowns-checkout)
hook_path="$PWD/hooks/post-checkout"

cd "$tmp_dir"
echo "Beware the clowns! 🤡" > clowns.txt

export BUILDKITE_BUILD_CHECKOUT_PATH=$tmp_dir
run $hook_path

assert_failure
assert_output --partial "Detected clowns!"

rm -rf "$tmp_dir"
}

0 comments on commit f1b0a10

Please sign in to comment.