Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pre-commit checks #272

Merged
merged 8 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/conda_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ defaults:

jobs:

lint:
name: Code style
runs-on: ubuntu-latest
# lint:
# name: Code style
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
# steps:
# - uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.11'
# - uses: actions/setup-python@v4
# with:
# python-version: '3.11'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
# - name: Install Dependencies
# run: |
# python -m pip install --upgrade pip
# pip install flake8

- name: Run flake8
run: |
flake8
# - name: Run flake8
# run: |
# flake8

- name: Run black
uses: rickstaa/action-black@v1
with:
black_args: ". --check"
# - name: Run black
# uses: rickstaa/action-black@v1
# with:
# black_args: ". --check"

build:
testing:

runs-on: ubuntu-latest
needs: lint
# needs: lint
strategy:
matrix:
python-version:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: pre-commit

# from: https://github.com/NSLS-II/scientific-python-cookiecutter/ ... /.github/workflows/pre-commit.yml

on:
pull_request:
push:
workflow_dispatch:

jobs:
pre-commit:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
with:
extra_args: --all-files
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

ci:
default_language_version: python3.11

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-json
- id: debug-statements
- id: check-executables-have-shebangs
- id: mixed-line-ending
# - id: end-of-file-fixer
# - id: trailing-whitespace

# - repo: https://github.com/pycqa/flake8
# rev: 4.0.1
# hooks:
# - id: flake8

# - repo: https://github.com/timothycrosley/isort
# rev: 5.12.0
# hooks:
# - id: isort

# - repo: https://github.com/psf/black
# rev: 22.8.0
# hooks:
# - id: black
Comment on lines +24 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did those commented-out checks fail?

Loading