[go: up one dir, main page]

Skip to content

Janet language formatting is now wrong with bad suggestions

We have been using astyle to format Janet's source code for a long while now, and in recent releases, there has been regressions in styling with bad suggestions.

Source code repository: https://github.com/janet-lang/janet.git

We use make format to invoke astyle on all of our C source code with the following flags:

STYLEOPTS="--style=attach --indent-switches --convert-tabs \
		  --align-pointer=name --pad-header --pad-oper --unpad-paren --indent-labels --formatted"

and get formatting diffs like so:

@@ -79,7 +79,7 @@ void janet_array_ensure(JanetArray *array, int32_t capacity, int32_t growth) {
     int64_t new_capacity = ((int64_t) capacity) * growth;
     if (new_capacity > INT32_MAX) new_capacity = INT32_MAX;
     capacity = (int32_t) new_capacity;
-    newData = janet_realloc(old, capacity * sizeof(Janet));
+    newData = janet_realloc(old, capacity *sizeof(Janet));
     if (NULL == newData) {
         JANET_OUT_OF_MEMORY;
     }
@@ -368,7 +368,7 @@

removing the space after some binary operators.

I wonder if there is some non-semantic parsing of source code, or a bias away from C to C++.