mirror of https://github.com/rwf2/Rocket.git
Ensure no files have trailing whitespace.
This commit is contained in:
parent
ca30e5e901
commit
7139941e04
|
@ -32,8 +32,8 @@ lazy_static! {
|
|||
|
||||
#[get("/people/<id>")]
|
||||
fn people(id: UUID) -> Result<String, String> {
|
||||
// Because UUID implements the Deref trait, we use Deref coercion to
|
||||
// convert rocket_contrib::UUID to uuid::Uuid.
|
||||
// Because UUID implements the Deref trait, we use Deref coercion to convert
|
||||
// rocket_contrib::UUID to uuid::Uuid.
|
||||
Ok(PEOPLE.get(&id)
|
||||
.map(|person| format!("We found: {}", person))
|
||||
.ok_or(format!("Person not found for UUID: {}", id))?)
|
||||
|
|
|
@ -28,7 +28,7 @@ function check_versions_match() {
|
|||
done
|
||||
}
|
||||
|
||||
# Ensures there are not tabs in any file in the directories $@.
|
||||
# Ensures there are no tabs in any file.
|
||||
function ensure_tab_free() {
|
||||
local tab=$(printf '\t')
|
||||
local matches=$(grep -I -R "${tab}" $ROOT_DIR | egrep -v '/target|/.git|LICENSE')
|
||||
|
@ -39,6 +39,16 @@ function ensure_tab_free() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Ensures there are no files with trailing whitespace.
|
||||
function ensure_trailing_whitespace_free() {
|
||||
local matches=$(egrep -I -R " +$" $ROOT_DIR | egrep -v "/target|/.git")
|
||||
if ! [ -z "${matches}" ]; then
|
||||
echo "Trailing whitespace was found in the following:"
|
||||
echo "${matches}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function bootstrap_examples() {
|
||||
for file in ${EXAMPLES_DIR}/*; do
|
||||
if [ -d "${file}" ]; then
|
||||
|
@ -65,6 +75,9 @@ check_versions_match "${LIB_DIR}" "${CODEGEN_DIR}" "${CONTRIB_DIR}"
|
|||
echo ":: Checking for tabs..."
|
||||
ensure_tab_free
|
||||
|
||||
echo ":: Checking for trailing whitespace..."
|
||||
ensure_trailing_whitespace_free
|
||||
|
||||
echo ":: Updating dependencies..."
|
||||
cargo update
|
||||
|
||||
|
|
Loading…
Reference in New Issue