affiance
Version:
A configurable and extendable Git hook manager for node projects
325 lines (284 loc) • 9.52 kB
YAML
# Default configuration that all Affiance configurations inherit from.
#
# This is an opinionated list of which hooks are valuable to run and what their
# out-of-the-box settings should be.
#-------------------------------------------------------------------------------
# Where to store hook plugins specific to a repository. These are loaded in
# addition to the default hooks Affiance comes with. The location is relative
# to the root of the repository.
pluginDirectory: '.git-hooks'
# Number of hooks that can be run concurrently. Typically this won't need to be
# adjusted, but if you know that some of your hooks themselves use multiple
# processors you can lower this value accordingly. You can define
# single-operator mathematical expressions, e.g. '%{processors} * 2', or
# '%{processors} / 2'.
concurrency: '%{processors}'
# Whether to hide hook output by default. This results in completely silent hook
# runs except in the case of warning or failure.
quiet: false
# Whether to check if a hook plugin has changed since Affiance last ran it.
# This is a defense mechanism when working with repositories which can contain
# untrusted code (e.g. when you fetch a pull request from a third party).
# See https://github.com/l8on/affiance#security for more information.
verifySignatures: true
# This configuration changes the default location node modules are
# expected to be found. To enumerate the possible values and what they mean:
# * "local" - means all node modules will be installed locally and `npm bin`
# will be used to find the binary directory.
# * "global" - means all node modules will be install globally and the binaries
# are expected to be available in the $PATH of the current user.
# Defaults to "local"
nodeModuleMode: 'local'
# Hooks that are run against every commit message after a user has written it.
# These hooks are useful for enforcing policies on commit messages written for a
# project.
CommitMsg:
ALL:
requiresFiles: false
quiet: false
CapitalizedSubject:
enabled: true
description: 'Check subject capitalization'
EmptyMessage:
enabled: true
description: 'Check for empty commit message'
quiet: true
# Hooks that are run after `git commit` is executed, before the commit message
# editor is displayed. These hooks are ideal for syntax checkers, linters, and
# other checks that you want to run before you allow a commit object to be
# created.
PreCommit:
ALL:
problemOnUnmodifiedLine: report
requiresFiles: true
required: false
quiet: false
CoffeeLint:
enabled: false
description: 'Analyze with coffeelint'
requiredExecutable: './node_modules/.bin/coffeelint'
globalRequiredExecutable: 'coffeelint'
flags: ['--reporter=csv']
installCommand: 'npm install coffeelint'
globalInstallCommand: 'npm install -g coffeelint'
include: '**/*.coffee'
EsLint:
enabled: false
description: 'Analyze with ESLint'
requiredExecutable: './node_modules/.bin/eslint'
globalRequiredExecutable: 'eslint'
flags: ['--format=compact']
installCommand: 'npm install eslint'
globalInstallCommand: 'npm install -g eslint'
include: '**/*.js'
exclude: '*.yml'
NspCheck:
enabled: false
description: 'Check for module vulnerabilities with nsp'
quiet: false
requiredExecutable: 'nsp'
globalRequiredExecutable: 'nsp'
flags: ['check']
installCommand: 'npm install -g nsp'
globalInstallCommand: 'npm install -g nsp'
MergeConflicts:
enabled: true
description: 'Check for merge conflicts'
quiet: true
requiredExecutable: 'grep'
flags: ['-IHn', '^<<<<<<<[ \t]']
MochaOnly:
enabled: false
description: 'Check for .only in mocha tests'
quiet: true
requiredExecutable: 'grep'
flags: ['-EIHn', '(it|describe)\.only']
include: 'test/**/*.js'
Spectral:
enabled: false
description: 'Analyze with Spectral'
requiredExecutable: './node_modules/.bin/spectral'
globalRequiredExecutable: 'spectral'
flags: ['lint', '--quiet', '--ignore-unknown-format', '--format', 'text']
installCommand: 'npm install @stoplight/spectral-cli'
globalInstallCommand: 'npm install -g @stoplight/spectral-cli'
include:
- '**/*.json'
- '**/*.yml'
- '**/*.yaml'
exclude: 'package.json'
StylusLint:
enabled: false
description: "Analyze with stylus linter"
quiet: false
requiredExecutable: './node_modules/.bin/stylint'
globalRequiredExecutable: 'stylint'
requiredLibrary: 'stylint-json-reporter'
flags: ['--reporter', 'stylint-json-reporter']
installCommand: 'npm install stylint stylint-json-reporter'
globalInstallCommand: 'npm install -g stylint stylint-json-reporter'
include: '**/*.styl'
TsLint:
enabled: false
description: 'Analyze with TsLint'
requiredExecutable: './node_modules/.bin/tslint'
globalRequiredExecutable: 'tslint'
flags: ['--format', 'prose']
installCommand: 'npm install tslint'
globalInstallCommand: 'npm install -g tslint'
include: '**/*.ts'
exclude: '*.yml'
# Hooks that run after HEAD changes or a file is explicitly checked out.
PostCheckout:
ALL:
required: false
quiet: false
skipFileCheckout: true
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requiresFiles: true
requiredExecutable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
NpmOutdated:
enabled: false
description: 'Check if installed NPM dependencies are out of date'
requiresFiles: false
requiredExecutable: 'npm'
flags: ['outdated']
NspCheck:
enabled: false
description: 'Check for module vulnerabilities with nsp'
quiet: false
requiredExecutable: 'nsp'
globalRequiredExecutable: 'nsp'
flags: ['check']
installCommand: 'npm install -g nsp'
globalInstallCommand: 'npm install -g nsp'
# Hooks that run after a commit is created.
PostCommit:
ALL:
requiresFiles: false
required: false
quiet: false
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requiresFiles: true
requiredExecutable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
NpmOutdated:
enabled: false
description: 'Check if installed NPM dependencies are out of date'
requiresFiles: false
requiredExecutable: 'npm'
flags: ['outdated']
NspCheck:
enabled: false
description: 'Check for module vulnerabilities with nsp'
quiet: false
requiredExecutable: 'nsp'
globalRequiredExecutable: 'nsp'
flags: ['check']
installCommand: 'npm install -g nsp'
globalInstallCommand: 'npm install -g nsp'
# Hooks that run after `git merge` executes successfully (no merge conflicts).
PostMerge:
ALL:
requiresFiles: false
quiet: false
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requiresFiles: true
requiredExecutable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
NpmOutdated:
enabled: false
description: 'Check if installed NPM dependencies are out of date'
requiresFiles: false
requiredExecutable: 'npm'
flags: ['outdated']
NspCheck:
enabled: false
description: 'Check for module vulnerabilities with nsp'
quiet: false
requiredExecutable: 'nsp'
globalRequiredExecutable: 'nsp'
flags: ['check']
installCommand: 'npm install -g nsp'
globalInstallCommand: 'npm install -g nsp'
# Hooks that run after a commit is modified by an amend or rebase.
PostRewrite:
ALL:
requiresFiles: false
quiet: false
NpmInstall:
enabled: false
description: 'Install NPM dependencies'
requiresFiles: true
requiredExecutable: 'npm'
flags: ['install']
include:
- 'package.json'
- 'npm-shrinkwrap.json'
NpmOutdated:
enabled: false
description: 'Check if installed NPM dependencies are out of date'
requiresFiles: false
requiredExecutable: 'npm'
flags: ['outdated']
NspCheck:
enabled: false
description: 'Check for module vulnerabilities with nsp'
quiet: false
requiredExecutable: 'nsp'
globalRequiredExecutable: 'nsp'
flags: ['check']
installCommand: 'npm install -g nsp'
globalInstallCommand: 'npm install -g nsp'
# Hooks that run during `git push`, after remote refs have been updated but
# before any objects have been transferred.
PrePush:
ALL:
requiresFiles: false
required: false
quiet: false
NspCheck:
enabled: false
description: 'Check for module vulnerabilities with nsp'
quiet: false
requiredExecutable: 'nsp'
globalRequiredExecutable: 'nsp'
flags: ['check']
installCommand: 'npm install -g nsp'
globalInstallCommand: 'npm install -g nsp'
Mocha:
enabled: false
description: 'Run Mocha test suite'
requiredExecutable: './node_modules/.bin/mocha'
ProtectedBranches:
enabled: false
description: 'Check for illegal pushes to protected branches'
destructiveOnly: true
branches: ['master']
# Hooks that run during `git rebase`, before any commits are rebased.
# If a hook fails, the rebase is aborted.
PreRebase:
ALL:
requiresFiles: false
required: false
quiet: false
MergedCommits:
enabled: false
description: 'Check for commits that have already been merged'
branches: ['master']