Skip to content

Conversation

@jamesreprise
Copy link
Member

@jamesreprise jamesreprise commented Jun 26, 2024

The POSIX definition of a line requires that it is terminated with a newline. https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206

A new function spit-file has been added to rules-clojure.fs which wraps spit, adding a new line the content spat into files if it lacks one.

We use this function whenever want to write files to disk.

@jamesreprise jamesreprise self-assigned this Jun 26, 2024
@SevereOverfl0w
Copy link
Contributor

Why would content not end in a newline already?

@jamesreprise
Copy link
Member Author

spit doesn't automatically suffix with a newline when creating a file. Git's native diff and GitHub confirm this problem:

 filegroup(name = "__clj_files",
        srcs = ["....clj"],
-       data = ["..."])
\ No newline at end of file
+       data = ["..."])

image
Note the red symbol at the bottom of the file signifying a lack of a newline.

In an 'offline' discussion we discussed alternate approaches involving changes to emit-bazel to ensure that Bazel DSL always ends in a newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants