0.0.1 • Published 8 months ago

@caldwell619/todo-checker v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

TODO Checker

CLI for tacking the status of your outstanding TODO comments.

Took the of inspiration from Shopify's smart todo, but this is language agnostic (geared towards JS).

Demo

Install

yarn add @caldwell619/todo-checker
# or
npm install --save @caldwell619/todo-checker

Usage

This tool is available in 3 forms.

Code DIY

import { check } from '@caldwell619/todo-checker'

const result = await check({
  pathToSource: './demo/example-source',
})

CLI

None of the arguments are required. They all have default values.

NameDescriptionDefault
--pathToSource - -psRelative path to directory to check.
--glob - -gGlob Expression to check if a file should be checked**
--ignorePatterns - -ignFile patterns checker will ignore. Provide array like string, parsable by JSON.parse['node_modules/**', '.git/**']
--cutoffDate - -codCutoff date for a todo passing. Defaults to todays dateNow
--logLevel - -llLog level of conversionquiet
--maxNumberOfOverdue - -moMaximum number of overdue todos you consider successful0
--allowMalformedTodo - -alAllow a non-standard todo to be present and still passfalse
npx @caldwell619/todo-checker \
  -ps ./demo/example-source

GitHub Action

This tool is also available as a GH action

None of the arguments are required. They all have default values.

NameDescriptionDefault
path-to-sourceRelative path to directory to check.
globGlob Expression to check if a file should be checked**
ignore-patternsFile patterns checker will ignore. Provide array like string, parsable by JSON.parse['node_modules/**', '.git/**']
cutoff-dateCutoff date for a todo passing. Defaults to todays dateNow
log-levelLog level of conversionquiet
max-overdue - -moMaximum number of overdue todos you consider successful0
allow-malformed - -alAllow a non-standard todo to be present and still passfalse
jobs:
  todo-check:
    runs-on: ubuntu-latest
    name: Check the validity of my TODOs
    steps:
      - name: Check me
        id: checker
        uses: christopher-caldwell/todo-checker
        with:
          # All of the values shown below are the defaults. None are required
          path-to-source: '.'
          file-glob: '**'
          ignore-patterns: '["node_modules", ".git"]'
          cutoff-date: '2023-10-11'
          log-level: 'quiet'
          max-overdue: 0
          allow-malformed: false
        outputs:
          num-passed:
            description: 'Number of files with TODOs that passed'
          num-failed:
            description: 'Number of files with TODOs that failed'
          num-files-checked:
            description: 'Number of files in total checked'
      # Use the output from the `hello` step
      - name: Show the total number of files passed
        run: echo "Number of files that passed ${{ steps.checker.outputs.num-passed }}"
      - name: Show the total number of files failed
        run: echo "Number of files that failed ${{ steps.checker.outputs.num-failed }}"
      - name: Show the total number of files checked
        run: echo "Number of files that failed ${{ steps.checker.outputs.num-files-checked }}"

License

MIT © christopher-caldwell