Page MenuHomeDevCentral

Add missing files headers
Needs ReviewPublic

Authored by dereckson on Sun, Apr 5, 19:32.

Details

Reviewers
yousra
Summary

Most of the files have clear headers to indicate the file is provisioned
by this repository. This change adds them everywhere, excepted INI and JSON,
two formats not supporting comments directly.

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Passed
Unit
No Test Coverage
Branch
normalize-universal-headers
Build Status
Buildable 6575
Build 6859: arc lint + arc unit

Event Timeline

dereckson created this revision.

Generated with Claude Cowork using Opus 4.6.

After headers have been added, we need to manually tweak every file:

$EDITOR $(git status | grep modified | awk '{print $2}')

So this procedure can't really be automated in the future.

Claude Cowork prompt

As a non-technical task, Claude Cowork can be useful here.

For reference, here the prompt used, but it must be improved to fix some issues:

  • XML files: Opus 4.6 added headers where already present, because not in the format it searched (we can ask simply to leave JSON and XML alone)
  • Jinja templates: {# ... #} won't help: Jinja comments will be ignored in rendered template, so will never reach provisioned server.
  • Shell scripts: it added two blank lines after the header block instead of just one ; most of the time one was missing to between shebang and header block
  • RC services: syntax needs to be described: shebang, provide/require block, header

In those files/ subfolders, we've another problem: ensure each file has a proper header.

Expected proper header follows that pattern:

#   -------------------------------------------------------------
#   <here a title of the file, like a very brief description>
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#   Project:        Nasqueron
#   License:        Trivial work, not eligible to copyright
#   Source file:    <path relative to repository root>
#   -------------------------------------------------------------
#
#   <auto-generated>
#       This file is managed by our rOPS SaltStack repository.
#
#       Changes to this file may cause incorrect behavior
#       and will be lost if the state is redeployed.
#   </auto-generated>

The source field allows us to find the file in this repository when published on a server.
Normally, it should be something like roles/.../.../files/...

There are some gotcha:

  • Some languages don't allow comments starting with #, in that case we adapt a little bit like using ; or a /* */ pattern.
  • Shebang should be before that header

Add headers where missing.