Giter Site home page Giter Site logo

trussworks / pre-commit-hooks Goto Github PK

View Code? Open in Web Editor NEW
6.0 9.0 2.0 28 KB

Common pre-commit hooks

Home Page: https://github.com/trussworks/pre-commit-hooks

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%
pre-commit markdown-toc mdspell circleci adr-log goreleaser

pre-commit-hooks's Introduction

Truss pre-commit hooks

circleci-validate

Validate CircleCI config yaml located in .circleci/config.yml. In order for this to run you will need to install the circleci CLI tool locally with:

brew install circleci

The script will not run the validation if the environment variable CI is set, which means you can safely run this on CircleCI and it will be a no-op.

gen-docs

Generate a Docs Index using adr-log. It will modify files with comments in it per the docs on that module.

By default it will only look in the docs/ directory of your repo. You can pass in different directories by using the args parameter like this: args: ["docs/adr", "docs/rfc"]

goreleaser-check

Validate goreleaser config yaml located at .goreleaser.yml. In order for this to run you will need to install the goreleaser CLI tool locally with:

brew install goreleaser

markdown-toc

Generate a Table of Contents using markdown-toc. It will modify files with comments in it per the docs on that module.

mdspell

Run spellcheck on markdown files using markdown-spellcheck. It will ignore words listed in a .spelling file in your repo.

spelling-sort

Run sort on the .spelling file used by the markdown-spellcheck tool. This keeps the file tidy as it is used.

hadolint

Run the hadolint Dockerfile linter

pre-commit-hooks's People

Contributors

ahobson avatar brainsik avatar esacteksab avatar monfresh avatar ralren avatar renovate[bot] avatar rpdelaney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pre-commit-hooks's Issues

markdown-toc error

Steps:

 git clone https://github.com/yelizariev/doodba.git
 cd doodba
 git checkout c754ab562b5fe05dacb4d8830b333d823e9a0f35
 pre-commit run --all --show-diff-on-failure

Result:

Generate a Table of Contents in Markdown files...........................Failed
- hook id: markdown-toc
- files were modified by this hook

`markdown-toc` installs but fails to run

Here is an output I get on my Windows machine when trying to run markdown-toc as a git hook:

> pre-commit run -a
[INFO] Initializing environment for https://github.com/trussworks/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/trussworks/pre-commit-hooks:markdown-toc.
[INFO] Installing environment for https://github.com/trussworks/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
isort....................................................................Passed
black....................................................................Passed
Generate a Table of Contents in Markdown files...........................Failed
- hook id: markdown-toc
- exit code: 127

/bin/bash: C:\Users\user\.cache\pre-commit\repo5rwwy8gq\node_env-default\Scripts\node_modules\pre-commit-hooks\pre-commit-markdown-toc: No such file or directory

The installation seems to have succeeded. The other hooks run just fine. I wonder what the problem could be?

My `.pre-commit-config.yml' entry:

  - repo: https://github.com/trussworks/pre-commit-hooks
    rev: v1.1.1
    hooks:
      - id: markdown-toc

gen-docs is not working with -i

With adr-log you can change a README with the hooks in it

adr-log -d ./doc/adr/ -i README.md

That doesn't seam to work with gen-docs hook

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • adr-log 2.2.0
  • markdown-spellcheck 1.3.1
  • markdown-toc 1.2.0
pre-commit
.pre-commit-config.yaml
  • pre-commit/pre-commit-hooks v4.4.0
  • executablebooks/mdformat 0.7.16
  • trussworks/pre-commit-hooks v1.1.1
  • shellcheck-py/shellcheck-py v0.9.0.2

  • Check this box to trigger a request for Renovate to run again on this repository

gen-docs hook fails to generate index

We have the gen-docs hook installed in https://github.com/CMSgov/easi-app; however, the pre-commit-gen-docs bash script fails when run. Running with pre-commit run --all-files --verbose (as of CMSgov/easi-app@c8837bd) shows the following error:

Generate a Docs Index....................................................Passed
- hook id: gen-docs
- duration: 0.4s

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/home/dylan/.cache/pre-commit/repobdz038eu/node_modules/.bin/adr-log'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v17.3.0

The pre-commit run passes (without --verbose, it doesn't show any errors), but doesn't run adr-log to update the ADR index.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.