Skip to content

CCDC File Checks

Actions
Check changed files for compliance
v6
Latest
Star (0)

This repository contains files that can be used as a github action and local git hooks.

It does a few checks on source code to ensure compliance with some general CCDC coding standard.

The commit will be flagged if it includes certain text files with:

  • File name that can cause errors on Windows
  • CRLF line endings
  • NO NOT MERGE or DO NOT COMMIT
  • Tabs
  • Missing terminating newline for certain files
  • Certain C++ #include patterns and std::exception

The commit will also be flagged if the commit message does not include a Jira ID (unless marked with NO_JIRA), or if the size of new or modiffied files exceeds a threshold.

Github action

Usage

- uses: ccdc-opensource/commit-hooks@v6
  with:
    commitMessage: 'The commit message'

Scenarios

Check files in pull request for merge to main

name: Check pull request files
on:
  pull_request
    branches: [ main ]
jobs:
  Pull-request-files-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.head_ref }}
          fetch-depth: 0
      - uses: actions/setup-python@v4
        with:
          python-version: "3.7"
      - name: Get the commit message
        run: |
          echo "commit_message=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_ENV
        shell: bash
      - uses: ccdc-opensource/commit-hooks@v6
        with:
          commitMessage: ${{ env.commit_message }}

commit-hooks

You can use this as git hooks for local repositories.

A set of hooks include:

  • commit-msg
  • pre-commit
  • pre-merge-commit

Setting up

  1. Clone this repo
  2. git config --global core.hooksPath <this repo location>/main

Recommended settings

To ensure the line endings are correctly converted:

  1. On Windows: git config --global core.autocrlf true
  2. On other platforms (including WSL): git config --global core.autocrlf input

CCDC File Checks is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Check changed files for compliance
v6
Latest

CCDC File Checks is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.