├── .gitignore ├── .pre-commit-config.yaml ├── README.md ├── assets ├── js │ └── example.js └── scss │ └── example.scss ├── img ├── demo_all_files.png └── demo_commit.png ├── main.py ├── main.rb └── tests ├── __init__.py └── test_is_something_i_dont_end_in.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .pydevproject 3 | .pre-commit-files 4 | .project 5 | .coverage 6 | /py_env 7 | *.db 8 | .idea 9 | build 10 | dist 11 | *.egg-info 12 | *.iml 13 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v5.0.0 4 | hooks: 5 | - id: end-of-file-fixer 6 | - id: trailing-whitespace 7 | - id: name-tests-test 8 | - repo: https://github.com/pycqa/flake8 9 | rev: 7.1.1 10 | hooks: 11 | - id: flake8 12 | - repo: https://github.com/pre-commit/mirrors-scss-lint 13 | rev: v0.60.0 14 | hooks: 15 | - id: scss-lint 16 | - repo: https://github.com/pre-commit/mirrors-ruby-lint 17 | rev: v2.3.1-1 18 | hooks: 19 | - id: ruby-lint 20 | - repo: https://github.com/pre-commit/mirrors-jshint 21 | rev: v2.13.6 22 | hooks: 23 | - id: jshint 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | demo-repo 2 | ========= 3 | 4 | This is a demo repo to demonstrate pre-commit hooks. 5 | 6 | pre-commit: https://github.com/pre-commit/pre-commit 7 | 8 | Simple instructions to see this repo in action. 9 | 10 | $ virtualenv venv 11 | $ . venv/bin/activate 12 | $ pip install pre-commit 13 | $ pre-commit install 14 | $ pre-commit run --all-files 15 | 16 | # Should show some output with some passing and some failing hooks 17 | 18 | 19 | ## Some Screenshots 20 | 21 | ### Example hook failures 22 | 23 | ![Example failures](https://raw.githubusercontent.com/pre-commit/demo-repo/main/img/demo_all_files.png) 24 | 25 | ### Successful commit 26 | 27 | ![Example failures](https://raw.githubusercontent.com/pre-commit/demo-repo/main/img/demo_commit.png) 28 | -------------------------------------------------------------------------------- /assets/js/example.js: -------------------------------------------------------------------------------- 1 | 2 | var x = function() { 3 | console.log('foo'); 4 | } 5 | 6 | 7 | var y = function(a, b) { 8 | return a == null; 9 | }; 10 | 11 | -------------------------------------------------------------------------------- /assets/scss/example.scss: -------------------------------------------------------------------------------- 1 | .foo { 2 | display:blcok; 3 | } 4 | 5 | .bar{ 6 | background: url(http://yelp.com); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /img/demo_all_files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pre-commit/demo-repo/f9dd493e65ec07bc8c836531129eda708ce02d6f/img/demo_all_files.png -------------------------------------------------------------------------------- /img/demo_commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pre-commit/demo-repo/f9dd493e65ec07bc8c836531129eda708ce02d6f/img/demo_commit.png -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | 3 | def main(foo): 4 | x = 10 5 | -------------------------------------------------------------------------------- /main.rb: -------------------------------------------------------------------------------- 1 | class Person 2 | def initialize(name) 3 | # oops, not setting @name 4 | end 5 | 6 | def greet 7 | return "Hello, #{@name}" 8 | end 9 | end 10 | 11 | user = Person.new('Alice') 12 | greeting = user.greet 13 | 14 | user.greet(:foo) 15 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pre-commit/demo-repo/f9dd493e65ec07bc8c836531129eda708ce02d6f/tests/__init__.py -------------------------------------------------------------------------------- /tests/test_is_something_i_dont_end_in.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pre-commit/demo-repo/f9dd493e65ec07bc8c836531129eda708ce02d6f/tests/test_is_something_i_dont_end_in.py --------------------------------------------------------------------------------