Skip to content

Commit

Permalink
Merge pull request #1 from ElectronicCats/pre-commit
Browse files Browse the repository at this point in the history
Pre commit
  • Loading branch information
sabas1080 authored Aug 6, 2024
2 parents 6ba2f66 + 7866c9e commit aa091e7
Show file tree
Hide file tree
Showing 5 changed files with 1,149 additions and 1,033 deletions.
16 changes: 16 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# options: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: chromium
IndentWidth: 2
# Must be 80 characters or less!
# ColumnLimit: 80
# does (int) x instead of (int)x
SpaceAfterCStyleCast: true
# spaces, not tabs!
UseTab: Never
#
AlignTrailingComments: true
# #define SHORT_NAME 42
# #define LONGER_NAME 0x007f # does nice spacing for macros
AlignConsecutiveMacros: Consecutive
IndentPPDirectives: BeforeHash
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 Electronic Cats
#
# SPDX-License-Identifier: MIT

name: pre-commit

on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- name: Set up repository
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: no-commit-to-branch # This hook prevents direct commits to main branch
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.2 # Use the sha / tag you want to point at
hooks:
- id: clang-format
types_or: [c++, c]
args: ['--style=file']
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
Loading

0 comments on commit aa091e7

Please sign in to comment.