Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 1.74 KB

README.md

File metadata and controls

46 lines (36 loc) · 1.74 KB

hoc-badge-action

Hits-of-Code Badge

GitHub action to generate Hits-of-Code badge with hoc calculated metric.

hoc - is a command line tool to calculate Hits-of-Code metric in a source code repository.

You can read more about Hits-of-Code metric in this blog post: Hits-of-Code Instead of SLoC.

hoc project page

To install action copy the workflow code into a .github/workflows/main.yml file in your repository

on: [push]

jobs:
  lines_counter_job:
    runs-on: ubuntu-latest
    name: A job to count hits of code
    steps:
      - uses: actions/checkout@v4
      - id: badge-generator
        uses: ./                     # Write the action name instead.
        with:
          since: 2000-01-01          # Default value: '2000-01-01'.
          before: 2024-03-03'        # Default value: now day.
          dir: .                     # Default value: include all files in the current directory.
          # For exclude option we can use multiline strings if we want to pass multiple values.
          # In this case it's an important detail that we used '|' or '|-' in the YAML. 
          # There is no default value for exclude option. 
          exclude: |                 
           dir1/**                   
           dir2/**/*                 
           dir3/file.txt             
          output_dir: ./output       # Default value: './output'.
          filename: hoc-badge.svg    # Default value: 'hoc-badge.svg'.

The badge will be generated into the file ./output/hoc-badge.svg by default.

Use whatever tool you prefer to upload it somewhere.