Skip to content

A precommit-hook app for webapps using python as backend and vue.js as front end

License

Notifications You must be signed in to change notification settings

ParisNeo/parisneo-precommit-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ParisNeo Pre-commit Hooks

A collection of pre-commit hooks used across ParisNeo projects.

Prerequisites

For JavaScript hooks:

npm install -g eslint prettier

For Python hooks:

pip install pre-commit

## Installation

1. Install pre-commit:
```bash
pip install pre-commit
  1. Add to your .pre-commit-config.yaml:
repos:
-   repo: https://github.com/ParisNeo/parisneo-precommit-hooks
    rev: v0.1.0
    hooks:
    -   id: parisneo-python-check  # For Python projects
    -   id: parisneo-js-check      # For JavaScript projects
  1. Install the pre-commit hooks:
pre-commit install

Available Hooks

parisneo-python-check

  • Runs black for code formatting
  • Runs isort for import sorting
  • Runs flake8 for style checking

parisneo-js-check

  • Runs prettier for code formatting
  • Runs eslint for style checking

Configuration (fully automated)

Create a setup.cfg in your project root:

[flake8]
max-line-length = 100
extend-ignore = E203
exclude = .git,__pycache__,build,dist

[isort]
profile = black
multi_line_output = 3
line_length = 100
  1. Create GitHub workflow file .github/workflows/test.yml:
name: Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    
    - uses: actions/setup-python@v2
      with:
        python-version: '3.10'
        
    - uses: actions/setup-node@v2
      with:
        node-version: '16'
        
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -e .
        pip install pytest
        npm install -g eslint prettier
        
    - name: Run tests
      run: pytest
        
    - name: Run hooks
      run: |
        pip install pre-commit
        pre-commit run --all-files

To use in your projects:

  1. Add to your project's .pre-commit-config.yaml:
repos:
-   repo: https://github.com/ParisNeo/parisneo-precommit-hooks
    rev: v0.1.0  # Use the latest version
    hooks:
    -   id: parisneo-python-check
    -   id: parisneo-js-check
  1. Initialize:
pre-commit install

Configuration (manual)

  1. Add to your project's .pre-commit-config.yaml:
repos:
-   repo: https://github.com/ParisNeo/parisneo-precommit-hooks
    rev: v0.1.0  # Use the latest version
    hooks:
    -   id: parisneo-python-check
    -   id: parisneo-js-check
  1. make sure pre-commit is installed

Run on all files

pre-commit run --all-files

Run specific hook

pre-commit run parisneo-python-check
pre-commit run parisneo-js-check

Run on specific files

pre-commit run --files path/to/file.py

About

A precommit-hook app for webapps using python as backend and vue.js as front end

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages