Skip to content

Example for using pre-commit.com With Spectral pre-commit hooks

Notifications You must be signed in to change notification settings

roikeman/spectral-example-pre-commit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spectral Integration With pre-commit.com

In this example you'll see how to use Spectral with pre-commit, a generic Git commit hook manager.

Usage

We're going to be using the Spectral pre-commit hook that pulls a docker image and runs Spectral from a Spectral docker image.

First, create some file, e.g. touch foobar, and then:

$ git add .
$ pre-commit run

You should get something like:

spectral scanner.........................................................Failed
- hook id: spectral
- exit code: 1

/src/secret.txt
0:20 Error Visible AWS Key CLD001

✖ found 1 matches
  scanned 19940 bytes and 23 files in 65ms

We've just simulated a commit. If you integrate pre-commit, this should happen every time you try to commit a change.

About

Example for using pre-commit.com With Spectral pre-commit hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published