Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Created August 28, 2020 17:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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