Skip to content

Commit d43dce3

Browse files
mplough-kobolddanielhoherd
authored andcommitted
1 parent 3e3e05a commit d43dce3

File tree

6 files changed

+50
-70
lines changed

6 files changed

+50
-70
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
---
1+
# Don't use this config for your own repositories. See "Installation" in README.md.
22
repos:
3-
- repo: [email protected]:danielhoherd/pre-commit-circleci.git
4-
rev: v0.0.3
5-
hooks:
6-
- id: circleci-validate
73
- repo: https://github.com/adrienverge/yamllint.git
84
rev: v1.15.0
95
hooks:

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ The MIT License (MIT)
22

33
Copyright (c) 2016 detailyang
44

5+
Copyright (c) 2020 KoBold Metals
6+
57
Permission is hereby granted, free of charge, to any person obtaining a copy
68
of this software and associated documentation files (the "Software"), to deal
79
in the Software without restriction, including without limitation the rights

README.md

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,54 @@
11
[![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/circleci/local-cli/master/LICENSE)
22

3-
# DEPRECATION NOTICE and call for further development
4-
5-
This repo is no longer being maintained since I no longer use Circle-CI.
6-
7-
[The upstream project that pre-commit hook relies on](https://github.com/circleci/local-cli) has also been deprecated and replaced with <https://github.com/CircleCI-Public/circleci-cli>.
8-
9-
If you use Circle-CI and find this project useful, please consider forking this project and making it work with the new circleci-cli. If you do so, open a ticket here and I will link to your project.
10-
113
# pre-commit-circleci
124

13-
pre-commit-circleci is a [pre-commit](https://github.com/pre-commit/pre-commit) component, which wraps [circleci](https://github.com/circleci/local-cli) to check CircleCI config yaml files.
14-
15-
Table of Contents
16-
-----------------
5+
`pre-commit-circleci` is a
6+
[pre-commit](https://github.com/pre-commit/pre-commit) component that checks
7+
CircleCI configuration YAML files in Git repositories. It wraps
8+
[circleci-cli](https://github.com/CircleCI-Public/circleci-cli) in a hook that
9+
pre-commit can use.
1710

18-
* [Requirements](#requirements)
19-
* [Install](#install)
20-
* [Contributing](#contributing)
21-
* [License](#license)
22-
* [Author](#author)
2311

24-
Requirements
25-
------------
26-
pre-commit-circleci requires the following to run:
12+
## Requirements
2713

28-
* [pre-commit](http://pre-commit.com)
29-
* [circleci local-cli](https://github.com/circleci/local-cli)
30-
* [docker](https://www.docker.com/) is a prerequisite for circleci local-cli
14+
`pre-commit-circleci` requires the following to run:
3115

16+
* [pre-commit](http://pre-commit.com)
17+
* [circleci-cli](https://github.com/CircleCI-Public/circleci-cli)
3218

33-
Install
34-
---------
3519

36-
1. create .pre-commit-config.yaml in you git project
37-
2. pre-commit install
38-
3. enjoy it
20+
## Installation
3921

40-
example .pre-commit-config.yaml as following:
22+
1. [Install pre-commit](https://pre-commit.com/#install).
23+
1. [Install circlei-cli](https://github.com/CircleCI-Public/circleci-cli).
24+
1. Create a `.pre-commit-config.yaml` file in your repository. Set up CircleCI
25+
validation as follows:
26+
```yaml
27+
repos:
28+
- repo: http://github.com/KoBoldMetals/pre-commit-circleci
29+
rev: v0.0.4
30+
hooks:
31+
- id: circleci-validate
32+
```
33+
1. Run `pre-commit install` to install the hook.
4134

42-
```yaml
43-
- repo: http://github.com/danielhoherd/pre-commit-circleci
44-
rev: v0.0.1
45-
hooks:
46-
- id: circleci-validate
47-
```
4835

49-
Contributing
50-
------------
36+
## Contributing
5137

52-
To contribute to pre-commit-circleci, clone this repo locally and commit your code on a separate branch.
38+
To contribute to `pre-commit-circleci`, clone this repository locally and
39+
commit your code on a separate branch, then submit a pull request.
5340

5441

55-
Author
56-
------
42+
## Authors
5743

58-
- GitHub [@danielhoherd](https://github.com/danielhoherd)
59-
- GitHub [@detailyang](https://github.com/detailyang) - [pre-commit shell-lint](https://github.com/detailyang/pre-commit-shell) was used as a template for pre-commit circleci-validate.
44+
- GitHub [@mplough](https://github.com/mplough)
45+
- GitHub [@danielhoherd](https://github.com/danielhoherd) - forked from his
46+
original [pre-commit-circle-ci](https://github.com/danielhoherd/pre-commit-circleci) tool.
47+
- GitHub [@detailyang](https://github.com/detailyang) - [pre-commit
48+
shell-lint](https://github.com/detailyang/pre-commit-shell) was used as a
49+
template for the validation hook.
6050

6151

62-
License
63-
-------
52+
## License
6453

65-
pre-commit-circleci is licensed under the [MIT](https://github.com/danielhoherd/pre-commit-circleci/blob/master/LICENSE) license.
54+
pre-commit-circleci is licensed under the [MIT](https://github.com/KoBoldMetals/pre-commit-circleci/blob/master/LICENSE) license.

pre_commit_hooks/circleci-validate.sh

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
#!/usr/bin/env bash
22

3-
echo "This pre-commit hook is DEPRECATED. Please see https://github.com/danielhoherd/pre-commit-circleci for more info."
4-
5-
set -o errexit
6-
set -o pipefail
7-
set -o nounset
8-
9-
DEBUG=${DEBUG:=0}
10-
[[ $DEBUG -eq 1 ]] && set -o xtrace
3+
set -eu -o pipefail
114

125
exec < /dev/tty
136

14-
echo 'Begin circleci config validation'
7+
echo 'Validating CircleCI configuration ...'
158

169
if ! command -v circleci &>/dev/null; then
17-
>&2 echo 'circleci command not found. See https://circleci.com/docs/2.0/local-cli/ for installation instructions.'
10+
>&2 echo 'circleci command not found. See https://github.com/CircleCI-Public/circleci-cli for installation instructions.'
11+
>&2 echo 'See https://github.com/CircleCI-Public/circleci-cli for installation instructions.'
1812
exit 1
1913
fi
2014

test/example-good-1.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ jobs:
2121

2222
working_directory: ~/my-project
2323

24-
branches:
25-
ignore:
26-
- develop
27-
- /feature-.*/
28-
2924
steps:
3025
- checkout
3126

test/run_tests.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /bin/bash
22

3+
set -x
4+
35
command -v circleci &> /dev/null || {
46
echo "are you sure you have installed circleci?"
57
exit 1
@@ -10,16 +12,18 @@ tempdir="${HOME}/temp/circleci-validate-$(date +%s)"
1012
mkdir -p "${tempdir}" || exit 1
1113
cp -r . "${tempdir}"
1214
cd "${tempdir}" || exit 1
13-
git add .
14-
git commit -m "Test commit"
1515

1616
cat << EOS > .pre-commit-config.yaml
17-
- repo: $(pwd)
18-
sha: $(git rev-parse HEAD)
17+
repos:
18+
- repo: $(pwd)
19+
rev: $(git rev-parse HEAD)
1920
hooks:
20-
- id: circleci-validate
21+
- id: circleci-validate
2122
EOS
2223

24+
git add .
25+
git commit -m "Test commit"
26+
2327
[ -d .circleci ] && rm -rf .circleci
2428
mkdir -p .circleci
2529

0 commit comments

Comments
 (0)