code: function checkCommitMessage (commitMessage, settings) {
    const {
      summaryMaxLength,
      lineMaxLength,
      patterns = {},
      examples = {}
    } = settings
  
    const isSummaryValid = commitMessage
      ? commitMessage.split('\n')[0].length <= summaryMaxLength
      : true
    const linesExceedingMaxLength = commitMessage
      .split('\n')
      .slice(1) // skip the summary line
      .reduce((a, l, k) => {
        return l.length > lineMaxLength
          ? a.concat({ n: k + 2, text: l })
          : a
      }, [])
    const isLineLengthValid = linesExceedingMaxLength.length === 0
    const isPatternValid = Object.keys(patterns || {}).some(key => {
      return patterns[key].test(commitMessage)
    })
  
    let errors = []
  
    if (!isSummaryValid) {
      errors = errors.concat(
        Object.assign(new Error(`Summary is more than ${summaryMaxLength} characters.`), {
          code: 'ESUMRY'
        })
      )
    }
  
    if (!isLineLengthValid) {
      errors = errors.concat(
        Object.assign(new Error([
          `The following lines have more than ${lineMaxLength} characters :`,
          `${linesExceedingMaxLength.map(l => 'line ' + l.n + ' : ' + l.text).join('\n')}`
        ].join('\n')), { code: 'ELINES', lines: linesExceedingMaxLength })
      )
    }
  
    if (!isPatternValid) {
      errors = errors.concat(
        Object.assign(new Error([
          'Commit message doesn\'t follow any message pattern.'
        ].concat(
          Object.keys(examples || {})
            .map(key => ['', `${key}:`].concat(examples[key]))
            .reduce((a, b) => a.concat(b), [])
        ).join('\n')), { code: 'EFRMT' })
      )
    }
  
    return {
      isSummaryValid,
      isLineLengthValid,
      linesExceedingMaxLength,
      isPatternValid,
      isValid: isSummaryValid && isLineLengthValid && isPatternValid,
      errors
    }
  }
docs: checkCommitMessage (commitMessage: string, settings: Settings): { isValid:boolean, errors: Error[] }