trailing newline .ftl check can happen at build time
Removes the need to build ripgrep for CI
This commit is contained in:
parent
b17d537a9e
commit
0cf964b16d
19
.github/scripts/trailing-newlines.sh
vendored
19
.github/scripts/trailing-newlines.sh
vendored
@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -eu -o pipefail ${SHELLFLAGS}
|
|
||||||
|
|
||||||
# Checking version to force it fail the build if rg is not installed.
|
|
||||||
# Because `set -e` does not work inside the subshell $()
|
|
||||||
if ! rg --version > /dev/null 2>&1;
|
|
||||||
then
|
|
||||||
echo "Error: ripgrep is not installed!";
|
|
||||||
exit 1;
|
|
||||||
fi;
|
|
||||||
|
|
||||||
files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json,sql}' || true)
|
|
||||||
|
|
||||||
if [ "$files" != "" ]; then
|
|
||||||
echo "the following files are missing a newline on the last line:"
|
|
||||||
echo $files
|
|
||||||
exit 1
|
|
||||||
fi
|
|
@ -88,6 +88,9 @@ fn get_ftl_data_from_provided_files(sources: String) -> FTLData {
|
|||||||
let path = Path::new("..").join(path);
|
let path = Path::new("..").join(path);
|
||||||
std::fs::read_to_string(path).unwrap()
|
std::fs::read_to_string(path).unwrap()
|
||||||
});
|
});
|
||||||
|
if !entry.ends_with("\n") {
|
||||||
|
panic!(".ftl file should end with a newline: {}", path);
|
||||||
|
}
|
||||||
match (first_parent, second_parent) {
|
match (first_parent, second_parent) {
|
||||||
// templates in the rslib translation repo are ignored, as their canonical
|
// templates in the rslib translation repo are ignored, as their canonical
|
||||||
// form is part of this source tree
|
// form is part of this source tree
|
||||||
|
@ -79,8 +79,7 @@ macro_rules! ftl_path {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the template/English resource text for the given group.
|
/// Get the template/English resource text.
|
||||||
/// These are embedded in the binary.
|
|
||||||
fn ftl_template_text() -> &'static str {
|
fn ftl_template_text() -> &'static str {
|
||||||
ftl_path!("template.ftl")
|
ftl_path!("template.ftl")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user