<commit_before>#!/bin/bash

# Should we ignore linter failures?
IGNORE_FAILURES=0
# Did all of the linters pass?
RET_SUCCESS=0

while getopts ":i" OPT; do
  case $OPT in
    i)
      IGNORE_FAILURES=1
      ;;
    \?)
      echo "Unknown option: -$OPTARG" >&2
      ;;
  esac
done

# Check and install dependencies
for GEM in ruby-lint; do
  gem list | grep $GEM 2>&1 >/dev/null 
  if [ $? -ne 0 ]; then
    gem install $GEM
  fi
done

# Lint the Serverspec files
printf "***\nChecking Serverspec...\n***\n"
rubocop spec
if [ $? -ne 0 ]; then
  RET_SUCCESS=1
fi

if [ $RET_SUCCESS -ne 0 ]; then
  printf "***\nSERVERSPEC CHECKS FAILED\n***\n"
fi

# If the caller is ignoring failures, make sure we always return successfully
if [[ $IGNORE_FAILURES -eq 1 && $RET_SUCCESS -ne 0 ]]; then<commit_msg>Make Rubcop display the cop name<commit_after>#!/bin/bash

# Should we ignore linter failures?
IGNORE_FAILURES=0
# Did all of the linters pass?
RET_SUCCESS=0

while getopts ":i" OPT; do
  case $OPT in
    i)
      IGNORE_FAILURES=1
      ;;
    \?)
      echo "Unknown option: -$OPTARG" >&2
      ;;
  esac
done

# Check and install dependencies
for GEM in ruby-lint; do
  gem list | grep $GEM 2>&1 >/dev/null 
  if [ $? -ne 0 ]; then
    gem install $GEM
  fi
done

# Lint the Serverspec files
printf "***\nChecking Serverspec...\n***\n"
rubocop -d spec
if [ $? -ne 0 ]; then
  RET_SUCCESS=1
fi

if [ $RET_SUCCESS -ne 0 ]; then
  printf "***\nSERVERSPEC CHECKS FAILED\n***\n"
fi

# If the caller is ignoring failures, make sure we always return successfully
if [[ $IGNORE_FAILURES -eq 1 && $RET_SUCCESS -ne 0 ]]; then
{'fraction_non_alphanumeric': 0.12701363073110286, 'fraction_numerical': 0.01486988847583643, 'mean_word_length': 3.017412935323383, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3148693', 'n_tokens_mistral': 625, 'n_tokens_neox': 588, 'n_words': 205}