vlajos/misspell-fixer

View on GitHub
misspell-fixer

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash

export source_directory="${BASH_SOURCE[0]%misspell-fixer}"
if [[ "$source_directory" == "" ]]
then
    source_directory='./'
fi
if [ ! -f "${source_directory}/rules/safe.0.sed" ]
then
    source_directory="/usr/share/misspell-fixer/"
fi

export rules_directory="${source_directory}rules"

# shellcheck source=lib/initialisation_functions.sh shell=bash
source "${source_directory}/lib/initialisation_functions.sh"
# shellcheck source=lib/main_functions.sh shell=bash
source "${source_directory}/lib/main_functions.sh"

initialise_variables

process_command_arguments "$@"
retval=$?

if [[ $retval == 0 ]]
then
    handle_parameter_conflicts
    retval=$?
fi

if [[ $retval == 0 ]]
then
    handle_whitelist_configfile
    retval=$?
fi

if [[ $retval == 0 ]]
then
    if [[ $opt_debug = 1 ]]
    then
        set -x
    fi
    check_grep_version
    check_sed_arguments

    prepare_rules_for_prefiltering
    iterate_through_targets list_files_from_find 0 '' /dev/null
    retval=$?
    rm $tmpfile.prepared.grep.patterns $tmpfile.prepared.grep.patterns.word_limited $tmpfile.prepared.sed.all_rules $tmpfile.git.ignore
    if [[ $opt_debug = 1 ]]
    then
        set +x
    fi
fi

if [[ "$SHUNIT_VERSION" = "" ]]
then
    exit $retval
else
    return $retval
fi