ament / ament/ament_lint

ament_copyright --add-missing does not work with empty files cpp files.

Aperta
#514 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
50
Fork
129
Merge medio
3g 10h
PR unite (30g)
3

Descrizione

I came across a small bug in ament_copyright. If you create an empty source file and then run `ament_copyright --add-missing` the program does not add any license information.

I am unsure if this behavior is intentional or if the behavior constitutes a bug. If it is the former we may want to document it.

Here is how to reproduce the bug
```
~/Code/src$ touch new_file.cpp
~/Code/src$ ament_copyright --verbose
new_file.cpp: file empty
test_position.cpp: copyright=Open Source Robotics Foundation, Inc. (2021), license=apache2
No problems found, checked 2 files
~/Code/src$ ament_copyright --add-missing KAT bsd2
~/Code/src$ ament_copyright --verbose
new_file.cpp: file empty
test_position.cpp: copyright=Open Source Robotics Foundation, Inc. (2021), license=apache2
No problems found, checked 2 files
~/Code/src$ emacs new_file.cpp < add void main{} >
~/Code/src$ ament_copyright --add-missing KAT bsd2
* new_file.cpp
~/Code/src$ ament_copyright --verbose
new_file.cpp: copyright=KAT (2024), license=bsd2
test_position.cpp: copyright=Open Source Robotics Foundation, Inc. (2021), license=apache2
No problems found, checked 2 files
~/Code/src$
```

Somewhat related the `--list-licenses` option is a bit vague. I read the help file information as "this option lists all licenses in the given directory." What the option does is provide a list of available licenses that can be added to unlicensed files. The help file should clarify what the option does a bit more clearly.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.