Clean up

From Nasqueron Agora
Revision as of 23:09, 26 October 2024 by Dereckson (talk | contribs) (→‎Style: UTF-U BOM, from freebsd-tips fortune)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Style

EOL at EOF

There is a need for a blank line at end of file.

You can add them with echo.

$ git ls-files | while read f; do tail -n1 $f | read -r _ || echo >> $f; done

UNIX lines

$ dos2unix

Encoding

$ iconv -f iso-8859-15 -t utf-8

Spaces

Git has a filter to be able to normalize with expand. See here.

UTF-8 BOM

Some old editors started a file by the sequence of bytes [0xEF, 0xBB, 0xBF] to allow the UTF-8 file encoding to be detected. This practice is discouraged nowadays and those should removed.

$ sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile