Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Utils
source-formatters
Commits
30489ab0
Commit
30489ab0
authored
Feb 06, 2018
by
Ben Boeckel
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
line-at-eof: add a formatter which adds newlines to the end of files
parent
d342a814
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
29 additions
and
0 deletions
+29
-0
src/CMakeLists.txt
src/CMakeLists.txt
+1
-0
src/generic/CMakeLists.txt
src/generic/CMakeLists.txt
+1
-0
src/generic/format.line-at-eof
src/generic/format.line-at-eof
+15
-0
src/generic/line-at-eof.yaml.in
src/generic/line-at-eof.yaml.in
+3
-0
test/line-at-eof/CMakeLists.txt
test/line-at-eof/CMakeLists.txt
+3
-0
test/line-at-eof/empty/empty
test/line-at-eof/empty/empty
+0
-0
test/line-at-eof/empty/empty.clean
test/line-at-eof/empty/empty.clean
+0
-0
test/line-at-eof/empty/empty.expect
test/line-at-eof/empty/empty.expect
+0
-0
test/line-at-eof/have-eof/have-eof
test/line-at-eof/have-eof/have-eof
+1
-0
test/line-at-eof/have-eof/have-eof.clean
test/line-at-eof/have-eof/have-eof.clean
+1
-0
test/line-at-eof/have-eof/have-eof.expect
test/line-at-eof/have-eof/have-eof.expect
+1
-0
test/line-at-eof/missing-eof/missing-eof
test/line-at-eof/missing-eof/missing-eof
+1
-0
test/line-at-eof/missing-eof/missing-eof.clean
test/line-at-eof/missing-eof/missing-eof.clean
+1
-0
test/line-at-eof/missing-eof/missing-eof.expect
test/line-at-eof/missing-eof/missing-eof.expect
+1
-0
No files found.
src/CMakeLists.txt
View file @
30489ab0
...
...
@@ -56,6 +56,7 @@ function (install_formatter name)
endfunction
()
add_subdirectory
(
c
)
add_subdirectory
(
generic
)
add_subdirectory
(
python
)
add_subdirectory
(
rust
)
...
...
src/generic/CMakeLists.txt
0 → 100644
View file @
30489ab0
add_formatter
(
line-at-eof reformat
)
src/generic/format.line-at-eof
0 → 100755
View file @
30489ab0
#!/bin/sh
# This formatter ensures that non-empty files have a newline at the end of the
# file.
set
-e
readonly
path
=
"
$1
"
shift
if
!
[
-f
"
$path
"
]
;
then
echo
>
&2
'error: could not find file to format: '
"
$path
"
exit
4
fi
exec sed
-i
-e
'$a\'
"
$path
"
src/generic/line-at-eof.yaml.in
0 → 100644
View file @
30489ab0
formatter_line-at-eof:
kind: "line-at-eof"
script: "@CMAKE_INSTALL_PREFIX@/bin/format.line-at-eof"
test/line-at-eof/CMakeLists.txt
0 → 100644
View file @
30489ab0
add_formatter_test
(
line-at-eof missing-eof missing-eof format
)
add_formatter_test
(
line-at-eof have-eof have-eof pass
)
add_formatter_test
(
line-at-eof empty empty pass
)
test/line-at-eof/empty/empty
0 → 100644
View file @
30489ab0
test/line-at-eof/empty/empty.clean
0 → 100644
View file @
30489ab0
test/line-at-eof/empty/empty.expect
0 → 100644
View file @
30489ab0
test/line-at-eof/have-eof/have-eof
0 → 100644
View file @
30489ab0
This line has an EOL at the EOL.
test/line-at-eof/have-eof/have-eof.clean
0 → 100644
View file @
30489ab0
This line has an EOL at the EOL.
test/line-at-eof/have-eof/have-eof.expect
0 → 100644
View file @
30489ab0
This line has an EOL at the EOL.
test/line-at-eof/missing-eof/missing-eof
0 → 100644
View file @
30489ab0
This line is missing an EOL at the EOL.
\ No newline at end of file
test/line-at-eof/missing-eof/missing-eof.clean
0 → 100644
View file @
30489ab0
This line is missing an EOL at the EOL.
\ No newline at end of file
test/line-at-eof/missing-eof/missing-eof.expect
0 → 100644
View file @
30489ab0
This line is missing an EOL at the EOL.
Brad King
@brad.king
mentioned in commit
a3a0f318
·
Feb 06, 2018
mentioned in commit
a3a0f318
mentioned in commit a3a0f3180cbeb2d082a4ae771616a954f8868ed9
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment