commit a9711e48c1bad42d69a5e03265643111af60d898
parent ea9b3d0e85c19ca974cecbf064180b4298527d6e
Author: Ember Sawady <ecs@d2evs.net>
Date: Sun, 3 Mar 2024 20:28:52 +0000
get rid of trailing empty lines
and add a check for this to the linter script
Signed-off-by: Ember Sawady <ecs@d2evs.net>
Diffstat:
25 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/cmd/genoiddb/main.ha b/cmd/genoiddb/main.ha
@@ -206,4 +206,3 @@ fn write_varname(h: io::handle, name: str) (void | io::error) = {
};
};
};
-
diff --git a/crypto/aes/+x86_64/ni.ha b/crypto/aes/+x86_64/ni.ha
@@ -80,4 +80,3 @@ fn x86ni_decrypt(b: *cipher::block, dest: []u8, src: []u8) void = {
fn x86ni_keyexp(key: []u8, enc_rk: []u8, dec_rk: []u8) u8;
fn x86ni_asencrypt(key_exp: []u8, dest: []u8, src: []u8) void;
fn x86ni_asdecrypt(key_exp: []u8, dest: []u8, src: []u8) void;
-
diff --git a/crypto/aes/aes+x86_64.ha b/crypto/aes/aes+x86_64.ha
@@ -16,4 +16,3 @@ let initfuncptr: *initfunc = &ct64_init;
initfuncptr = &x86ni_init;
};
};
-
diff --git a/crypto/aes/aes_ct64.ha b/crypto/aes/aes_ct64.ha
@@ -700,4 +700,3 @@ fn br_aes_ct64_bitslice_decrypt(
br_aes_ct64_bitslice_invSbox(q);
add_round_key(q, skey);
};
-
diff --git a/crypto/aes/block.ha b/crypto/aes/block.ha
@@ -47,4 +47,3 @@ fn block_finish(b: *cipher::block) void = {
let b = b: *block;
bytes::zero(b.expkey);
};
-
diff --git a/crypto/bigint/util.ha b/crypto/bigint/util.ha
@@ -45,4 +45,3 @@ export fn iszero(x: []word) u32 = {
fn isodd(x: []word) bool = {
return x[1] & 1 == 1;
};
-
diff --git a/crypto/cipher/ghash.ha b/crypto/cipher/ghash.ha
@@ -124,4 +124,3 @@ fn ghash_ctmul64(y: []u8, h: const []u8, data: const []u8) void = {
beputu64(y, y1);
beputu64(y[8..], y0);
};
-
diff --git a/crypto/cipher/stream.ha b/crypto/cipher/stream.ha
@@ -104,4 +104,3 @@ fn xor_closer(s: *io::stream) (void | io::error) = {
let s = s: *xorstream;
s.finish(s);
};
-
diff --git a/crypto/curve25519/curve25519.ha b/crypto/curve25519/curve25519.ha
@@ -228,4 +228,3 @@ fn pack25519(out: []u8, a: const *elem) void = {
out[2 * i + 1] = (t[i] >> 8) : u8;
};
};
-
diff --git a/crypto/hmac/+test.ha b/crypto/hmac/+test.ha
@@ -147,4 +147,3 @@ fn assert_hmac_sha1(keystr: str, vectors: [](str, [20]u8)) void = {
assert(bytes::equal(expected, sum));
};
-
diff --git a/crypto/rsa/keys.ha b/crypto/rsa/keys.ha
@@ -327,4 +327,3 @@ export fn privkey_nbitlen(privkey: []u8) size = {
export fn privkey_nsize(privkey: []u8) size = {
return (privkey_nbitlen(privkey) + 7) / 8;
};
-
diff --git a/debug/image/open.ha b/debug/image/open.ha
@@ -57,4 +57,3 @@ export fn close(image: *image) void = {
io::munmap(&image.data[0], len(image.data))!;
io::close(image.fd)!;
};
-
diff --git a/encoding/asn1/+test/encoder_test.ha b/encoding/asn1/+test/encoder_test.ha
@@ -146,4 +146,3 @@ use types;
assert(bytes::equal(memio::buffer(&dest), [0x02, 0x03, 0x00, 0x8f, 0x01]));
};
-
diff --git a/encoding/asn1/charset+test.ha b/encoding/asn1/charset+test.ha
@@ -151,4 +151,3 @@ const t61_test_table: [_]u8 = [
0xc4, 0xbe, 0xc5, 0x88, 0xc5, 0x99, 0xc5, 0xa1, 0xc5, 0xa5, 0xc5, 0xbe,
0x0a,
];
-
diff --git a/encoding/asn1/oid.ha b/encoding/asn1/oid.ha
@@ -134,4 +134,3 @@ export fn strrawoid(der: []u8) (str | io::error) = {
defer free(s);
assert(s == "1.2.840.113549.1.1.1");
};
-
diff --git a/encoding/asn1/strings.ha b/encoding/asn1/strings.ha
@@ -359,4 +359,3 @@ export fn read_utf8str(d: *decoder, buf: []u8) (str | error) = {
return strings::fromutf8(buf[..n])!;
};
-
diff --git a/encoding/asn1/t61.ha b/encoding/asn1/t61.ha
@@ -531,4 +531,3 @@ fn t61_combine(in: []u8) (rune | invalid) = {
return invalid;
};
};
-
diff --git a/hare/module/deps.ha b/hare/module/deps.ha
@@ -206,4 +206,3 @@ export fn free_slice(mods: []module) void = {
};
free(mods);
};
-
diff --git a/hash/siphash/siphash.ha b/hash/siphash/siphash.ha
@@ -133,4 +133,3 @@ fn close(h: *io::stream) (void | io::error) = {
h.ln = 0;
h.x_len = 0;
};
-
diff --git a/log/silent.ha b/log/silent.ha
@@ -13,4 +13,3 @@ let _silent: logger = logger {
fn silent_println(l: *logger, fields: fmt::formattable...) void = return;
fn silent_printfln(l: *logger, fmt: str, fields: fmt::field...) void = return;
-
diff --git a/math/trig.ha b/math/trig.ha
@@ -895,4 +895,3 @@ export fn hypotf64(a: f64, b: f64) f64 = {
b = b / a;
return a * sqrtf64(1f64 + b * b);
};
-
diff --git a/net/unix/socketpair.ha b/net/unix/socketpair.ha
@@ -23,4 +23,3 @@ export fn socketpair(flags: net::sockflag...) ((net::socket, net::socket) | net:
return (io::fdopen(sv[0]), io::fdopen(sv[1]));
};
};
-
diff --git a/os/environ.ha b/os/environ.ha
@@ -65,4 +65,3 @@ export fn unsetenv(name: const str) (void | errors::invalid) = {
};
};
};
-
diff --git a/os/exec/types.ha b/os/exec/types.ha
@@ -38,4 +38,3 @@ export fn strerror(err: error) const str = {
return fs::strerror(err);
};
};
-
diff --git a/scripts/lint.sh b/scripts/lint.sh
@@ -4,6 +4,8 @@
# find -exec doesn't propagate the exit status
find . -name '*.ha' | while read -r f; do
awk 'BEGIN { state = "start" }
+ /./ { empty = 0 }
+ /^$/ { empty = 1 }
/[ \t]$/ {
print "trailing whitespace in " FILENAME
exit 1
@@ -38,5 +40,15 @@ find . -name '*.ha' | while read -r f; do
exit 1
}
state = "body"
+ }
+ END {
+ if (state != "body") {
+ print "incomplete copyright header in " FILENAME
+ exit 1
+ }
+ if (empty) {
+ print "trailing empty line in " FILENAME
+ exit 1
+ }
}' "$f"
done