Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Created August 28, 2020 17:45
Show Gist options
  • Save coryodaniel/470bfcef8ea72a44b23e1119af894ec5 to your computer and use it in GitHub Desktop.
Save coryodaniel/470bfcef8ea72a44b23e1119af894ec5 to your computer and use it in GitHub Desktop.
Shell script to find "no match of right hand side" in elixir
#! /usr/bin/env bash
# This uses the silver searcher (ag)
TMP_FILE=$(mktemp)
# find :ok tuples w/ no error match
ag "^\s{0,}\{:ok.*\s=" --ignore 'test' -G '.ex$' . > ${TMP_FILE}
# find :ok left side matches w/ no error handling
ag "^\s{0,}:ok.*=" --ignore 'test' -G '.ex$' . >> ${TMP_FILE}
# Scrub matches in list expressions and cases
cat ${TMP_FILE} | grep -ve '->' | grep -ve '<-'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment