Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about new empty line in header starting in 1.08 #8

Open
mbarbin opened this issue Jul 22, 2024 · 4 comments
Open

Question about new empty line in header starting in 1.08 #8

mbarbin opened this issue Jul 22, 2024 · 4 comments

Comments

@mbarbin
Copy link

mbarbin commented Jul 22, 2024

Hello,

Thanks for headache! I've mentioned your project in the acknowledgment section of https://github.com/mbarbin/vcs but I take this opportunity to thank you directly for this tool!

I tried re-running headache in my project after upgrading to headache.1.08 and noticed the tool now wants me to add a blank line at the end of all headers. For example, see : https://github.com/mbarbin/vcs/blob/main/lib/vcs/src/author.ml

  (*******************************************************************************)
  (*  Vcs - a versatile OCaml library for Git interaction                        *)
  (*  Copyright (C) 2024 Mathieu Barbin <mathieu.barbin@gmail.com>               *)
  (*                                                                             *)
  (*  This file is part of Vcs.                                                  *)
  (*                                                                             *)
  (*  Vcs is free software; you can redistribute it and/or modify it under       *)
  (*  the terms of the GNU Lesser General Public License as published by the     *)
  (*  Free Software Foundation either version 3 of the License, or any later     *)
  (*  version, with the LGPL-3.0 Linking Exception.                              *)
  (*                                                                             *)
  (*  Vcs is distributed in the hope that it will be useful, but WITHOUT ANY     *)
  (*  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  *)
  (*  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License and    *)
  (*  the file `NOTICE.md` at the root of this repository for more details.      *)
  (*                                                                             *)
  (*  You should have received a copy of the GNU Lesser General Public License   *)
  (*  and the LGPL-3.0 Linking Exception along with this library. If not, see    *)
  (*  <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively.       *)
+ (*                                                                             *)
  (*******************************************************************************)

Is this intended? I don't feel strongly, if you think this is better practice, I'm OK to adopt the new format, I was just curious. From the perspective of a user like me, this changes feels surprising.

Thanks!

@maroneze
Copy link
Member

Hello,

Indeed, this is surprising, but I'm afraid this behavior is intentional, at least partially: 49bac32

The issue we had was that, since modern code editors tend to remove extraneous empty lines at the end of a file without warning, when updating the copyright year, some colleagues inadvertently ended up removing the extra line. To prevent that from happening, we added the "mandatory empty last line".

In the Frama-C header files, for "aesthetic reasons", I believe, we almost always have an empty line before the first one, so the empty line after the last one improves symmetry (even if there are a few exceptions, such as this one).

If that behavior is problematic to you, I'll see what might be the simplest way to support the previous behavior; we'd like to avoid adding command-line options if possible, they tend to add much complexity and require extra testing...

(I said the behavior was at least partially intended because we simply did not consider the case of a header file not starting with an empty line.)

@mbarbin
Copy link
Author

mbarbin commented Jul 23, 2024

Thank you! I don't want to be needlessly difficult, I'm not sure what to think.

(I said the behavior was at least partially intended because we simply did not consider the case of a header file not starting with an empty line.)

Would you be opposed to restrict the automatic addition of an extra blank line at the end, by conditioning it to the presence of a first leading blank line? (trying to find a common ground that allows no behavior change for me).

@maroneze
Copy link
Member

That's precisely what I intended to do, and it would only impact a single file in Frama-C. But I'm waiting for my colleague to check if he foresees other problems; if you're not in a hurry, next week we should have a reply and possibly a patch.

@mbarbin
Copy link
Author

mbarbin commented Jul 23, 2024

I'll be using 1.07 for now - no time pressure from me. Thanks a lot!

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

No branches or pull requests

2 participants