mirror of
https://github.com/IgorKha/wireguard-mikrotik.git
synced 2025-08-19 00:58:25 +02:00
misc: Add pre-commit
hook configuration
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
This commit is contained in:
parent
78f19eb04d
commit
4338a68a01
10 changed files with 267 additions and 3 deletions
9
.codespellrc
Normal file
9
.codespellrc
Normal file
|
@ -0,0 +1,9 @@
|
|||
[codespell]
|
||||
builtin = clear,rare,names,code,en-GB_to_en-US
|
||||
check-filenames =
|
||||
context = 2
|
||||
enable-colors = true
|
||||
quiet-level = 3
|
||||
# TODO Add _false positives_ to the ignore list below
|
||||
# ignore-words-list =
|
||||
skip = .extras,.git,.password-store,.venv,build,Pipfile
|
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.yaml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
# kate: hl ini;
|
5
.github/CODEOWNERS
vendored
Normal file
5
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Lines starting with '#' are comments.
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
|
||||
# TODO Provide GitHub names here...
|
||||
# * @username1 @username2 ...
|
32
.github/commit-message.template
vendored
Normal file
32
.github/commit-message.template
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
#---------------------------------------------------------------------
|
||||
# Format for the commit title (the very first line) is the following:
|
||||
#
|
||||
# <type>: (If applied, this commit will...) <subject> (max 72 chars)
|
||||
#
|
||||
# Where `<type>` is one of the following:
|
||||
# - build = Changes to the build system
|
||||
# - ci = CI related changes (GH actions, hooks, ...)
|
||||
# - docs = Changes to the documentation/manuals
|
||||
# - feat = The commit introduces a new feature
|
||||
# - fix = The commit fixes a bug/regression/typo
|
||||
# - impr = The commit bring some improvements
|
||||
# - misc = Other actions
|
||||
# - package = Changes to the package produced
|
||||
# - refactor = The commit performs a refactoring
|
||||
# - release = The commit prepares a repo for release
|
||||
# - style = The commit fixes formatting
|
||||
# - testing = Changes to the tests or testing process
|
||||
# - wip = Work In Progress
|
||||
#
|
||||
# About conventional commits: https://www.conventionalcommits.org
|
||||
#---------------------------------------------------------------------
|
||||
# NOTE: Leave the next line empty to separate title from the body
|
||||
|
||||
# Explain why this change is being made below... (max 120 chars per line)
|
||||
|
||||
|
||||
# Optionally provide links or keys to any relevant tickets, articles or other resources.
|
||||
# See also: https://confluence.atlassian.com/fisheye/using-smart-commits-960155400.html
|
||||
|
||||
#---[Git inserted text goes blow]-------------------------------------
|
9
.github/pull_request_template.md
vendored
Normal file
9
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
## Changes in this PR
|
||||
|
||||
<!-- Describe your changes here -->
|
||||
|
||||
<!--
|
||||
Thanks for your interest in contributing to this repository!
|
||||
Please see the *How to Contribute* section in the `README.md`
|
||||
file for the contribution instructions.
|
||||
-->
|
29
.github/workflows/pre-commit-check.yaml
vendored
Normal file
29
.github/workflows/pre-commit-check.yaml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
name: Checking `pre-commit` hooks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
pr-checks:
|
||||
name: Checking `pre-commit` hooks
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check the `pre-commit` hook configuration presence
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@v1
|
||||
with:
|
||||
files: .pre-commit-config.yaml
|
||||
|
||||
- name: Checking configured hooks
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: pre-commit/action@v2.0.3
|
32
.github/workflows/pre-commit-update.yaml
vendored
Normal file
32
.github/workflows/pre-commit-update.yaml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Pre-commit auto-update
|
||||
|
||||
on:
|
||||
# every Sunday at midnight
|
||||
schedule:
|
||||
- cron: "0 0 * * 0"
|
||||
# on demand
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
auto-update:
|
||||
name: Checking `pre-commit` hooks updates
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare Python Environment
|
||||
uses: actions/setup-python@v2
|
||||
|
||||
- name: Pre-installing requirements
|
||||
uses: browniebroke/pre-commit-autoupdate-action@main
|
||||
|
||||
- name: Create PR to Update configs
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: update/pre-commit-hooks
|
||||
title: 'misc: Version bump `pre-commit` hook plugins'
|
||||
commit-message: 'misc: Version bump `pre-commit` hook plugins'
|
||||
body: Update plugins of `pre-commit` hooks to latest version.
|
90
.gitlint
Normal file
90
.gitlint
Normal file
|
@ -0,0 +1,90 @@
|
|||
# All these sections are optional, edit this file as you like.
|
||||
[general]
|
||||
# Ignore certain rules, you can reference them by their id or by their full name
|
||||
ignore=B6,T5
|
||||
|
||||
# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this
|
||||
verbosity = 2
|
||||
|
||||
# By default gitlint will ignore merge commits. Set to 'false' to disable.
|
||||
# ignore-merge-commits=true
|
||||
|
||||
# By default gitlint will ignore fixup commits. Set to 'false' to disable.
|
||||
# ignore-fixup-commits=true
|
||||
|
||||
# By default gitlint will ignore squash commits. Set to 'false' to disable.
|
||||
# ignore-squash-commits=true
|
||||
|
||||
# Enable debug mode (prints more output). Disabled by default.
|
||||
# debug=true
|
||||
|
||||
# Set the extra-path where gitlint will search for user defined rules
|
||||
# See http://jorisroovers.github.io/gitlint/user_defined_rules for details
|
||||
# extra-path=examples/
|
||||
|
||||
# NOTE Enable https://www.conventionalcommits.org/en/v1.0.0/ specification
|
||||
contrib=contrib-title-conventional-commits
|
||||
|
||||
[title-max-length]
|
||||
line-length=72
|
||||
|
||||
# [title-must-not-contain-word]
|
||||
# Comma-separated list of words that should not occur in the title. Matching is case
|
||||
# insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING"
|
||||
# will not cause a violation, but "WIP: my title" will.
|
||||
# words=wip
|
||||
|
||||
# [title-match-regex]
|
||||
# python like regex (https://docs.python.org/2/library/re.html) that the
|
||||
# commit-msg title must be matched to.
|
||||
# Note that the regex can contradict with other rules if not used correctly
|
||||
# (e.g. title-must-not-contain-word).
|
||||
#regex=^(\[[A-Z0-9]+-[0-9]+\]|(Build|Documentation|Feature|Fix|Improvement|Misc|Package|Refactor|Release|Style|Testing|WIP):) .*$
|
||||
|
||||
[B1]
|
||||
# B1 = body-max-line-length
|
||||
line-length=120
|
||||
|
||||
[body-min-length]
|
||||
min-length=0
|
||||
|
||||
# [body-is-missing]
|
||||
# Whether to ignore this rule on merge commits (which typically only have a title)
|
||||
# default = False
|
||||
# gnore-merge-commits=false
|
||||
|
||||
# [body-changed-file-mention]
|
||||
# List of files that need to be explicitly mentioned in the body when they are changed
|
||||
# This is useful for when developers often erroneously edit certain files or git submodules.
|
||||
# By specifying this rule, developers can only change the file when they explicitly reference
|
||||
# it in the commit message.
|
||||
# files=gitlint/rules.py,README.md
|
||||
|
||||
# [author-valid-email]
|
||||
# python like regex (https://docs.python.org/2/library/re.html) that the
|
||||
# commit author email address should be matched to
|
||||
# For example, use the following regex if you only want to allow email addresses from foo.com
|
||||
# regex=[^@]+@foo.com
|
||||
|
||||
# [ignore-by-title]
|
||||
# Ignore certain rules for commits of which the title matches a regex
|
||||
# E.g. Match commit titles that start with "Release"
|
||||
# regex=^Release(.*)
|
||||
#
|
||||
# Ignore certain rules, you can reference them by their id or by their full name
|
||||
# Use 'all' to ignore all rules
|
||||
# ignore=T1,body-min-length
|
||||
|
||||
# [ignore-by-body]
|
||||
# Ignore certain rules for commits of which the body has a line that matches a regex
|
||||
# E.g. Match bodies that have a line that that contain "release"
|
||||
# regex=(.*)release(.*)
|
||||
#
|
||||
# Ignore certain rules, you can reference them by their id or by their full name
|
||||
# Use 'all' to ignore all rules
|
||||
# ignore=T1,body-min-length
|
||||
|
||||
[contrib-title-conventional-commits]
|
||||
types=build,ci,docs,feat,fix,impr,misc,refactor,release,style,testing,wip
|
||||
|
||||
# kate: hl ini;
|
45
.pre-commit-config.yaml
Normal file
45
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
# Read the docs here: https://pre-commit.com and http://jorisroovers.github.io/gitlint/
|
||||
# Install hooks to your clone:
|
||||
# $ pre-commit install --install-hooks
|
||||
# and
|
||||
# $ pre-commit install --install-hooks -t commit-msg
|
||||
|
||||
default_stages: [commit]
|
||||
fail_fast: false
|
||||
repos:
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: check-hooks-apply
|
||||
- id: check-useless-excludes
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: check-case-conflict
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
|
||||
- repo: https://github.com/jorisroovers/gitlint
|
||||
rev: v0.17.0
|
||||
hooks:
|
||||
- id: gitlint
|
||||
name: Commit message check
|
||||
language: python
|
||||
entry: gitlint --msg-filename
|
||||
stages: [commit-msg]
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.2
|
||||
hooks:
|
||||
- id: codespell
|
||||
|
||||
- repo: https://github.com/koalaman/shellcheck-precommit
|
||||
rev: v0.8.0
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
args: ['--shell=bash', '--color=always']
|
||||
files: '\.sh$'
|
||||
types: ['file', 'text']
|
||||
|
||||
# kate: indent-width 2; tab-width 2;
|
Loading…
Add table
Add a link
Reference in a new issue