Skip to content

Commit 9d18b20

Browse files
authored
Prepare release 2.19.0
2 parents 8260946 + 9467219 commit 9d18b20

18 files changed

+1675
-49
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ toolbox/utils/text-generator/_templates/new-GitHub-repository-contributors.fr.te
55
toolbox/utils/third-party-generator/components.csv.result
66
toolbox/utils/third-party-generator/THIRD-PARTY.md.result
77
toolbox/utils/third-party-generator/__pycache__
8+
toolbox/utils/_/__pycache__/
9+
toolbox/utils/reuse/.reuse/
810
toolbox/LicensesInventory/.pytest_cache
911
toolbox/LicensesInventory/sources/__pycache__
1012
toolbox/LicensesInventory/sources/*/__pycache__

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased](https://github.com/Orange-OpenSource/floss-toolbox/compare/2.18.0..dev)
8+
## [Unreleased](https://github.com/Orange-OpenSource/floss-toolbox/compare/2.19.0..dev)
9+
10+
## [2.19.0](https://github.com/Orange-OpenSource/floss-toolbox/compare/2.19.0..2.18.0) - 2024-04-03
11+
12+
### Added
13+
14+
- [Diver] Generate CONTRIBUTORS file using Git history ([#148](https://github.com/Orange-OpenSource/floss-toolbox/issues/148))
15+
- [Utils] Apply SPDX headers to sources with REUSE tool ([#146](https://github.com/Orange-OpenSource/floss-toolbox/issues/146))
16+
- [Diver] Check headers of sources files ([#101](https://github.com/Orange-OpenSource/floss-toolbox/issues/101))
917

1018
## [2.18.0](https://github.com/Orange-OpenSource/floss-toolbox/compare/2.18.0..2.17.0) - 2024-03-25
1119

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ keywords:
3939
- audits
4040
- history
4141
license: Apache-2.0
42-
version: v2.18.0
43-
date-released: '2024-03-25'
42+
version: v2.19.0
43+
date-released: '2024-04-03'

LICENSES/GPL-3.0.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

THIRD-PARTY.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,14 @@ Copyright (c) 2012 Martin Blech and individual contributors.
7373

7474
*xmltodict* is distributed under the terms and conditions of the [MIT License](https://opensource.org/license/MIT).
7575
You may download the source code on the [following website](https://github.com/martinblech/xmltodict).
76+
77+
## For "reuse" bucket
78+
79+
### reuse-tool
80+
81+
Version 3.0.1
82+
83+
Copyright (c) Free Software Foundation Europe
84+
85+
*reuse-tool* is distributed under the terms and conditions of the [GNU General Public License version 3 or later](https://opensource.org/license/gpl-3-0).
86+
You may download the source code on the [following website](https://github.com/fsfe/reuse-tool).

toolbox/diver/README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Table of Contents
1515
* [List conributors from Git history](#list-contributors-from-git-history)
1616
* [Extract email adress from Git history](#extract-email-address-from-git-history)
1717
* [Count lines of code in a directory](#count-lines-of-code-in-a-directory)
18+
* [Check if sources have headers](#check-if-sources-have-headers)
1819

1920
# The "diver" of source code and commits
2021

@@ -212,4 +213,155 @@ bash lines-count.sh --folder "absolute/path/to/target"
212213

213214
# To compute metrics for a remote repository to clone at given URL
214215
bash lines-count.sh --url "HTTP-or-SSH-URL-of-Git-repository"
216+
```
217+
218+
### Check if headers exist in sources using templates
219+
220+
_Keywords: #headers #sources #SPDX_
221+
222+
It is possible to run a scan in a project to check wether or not the source files contain (in fact start by) some header text.
223+
For example it is a good practice or mandatory to have headers in sources files with legal mentions, and sometimes some headers can be missing.
224+
The *check-sources-headers.rb* script will take a raw text file (without useless new lines or whitespaces), and generate some templates using comments symbols. If will look for source files in the project, and check if files start by the decorated version of the text, i.e. the template.
225+
226+
```shell
227+
# Run the script to scan the given folder and using the given raw text template
228+
ruby check-sources-headers.rb --folder data/project --template data/template.txt
229+
230+
# Or also display more debug traces
231+
ruby check-sources-headers.rb --folder data/project --template data/template.txt --debug
232+
233+
# Or keep the previous generated templates (i.e. decorated raw header files)
234+
ruby check-sources-headers.rb --folder data/project --template data/template.txt --keep
235+
236+
# Or exclude from scans a directory (e.g. generated files, docs, etc)
237+
ruby check-sources-headers.rb --folder data/project --template data/template.txt --exclude data/project/directory/to/exclude
238+
239+
# Or use all these parameters!
240+
ruby check-sources-headers.rb --folder data/ods-ios --template data/template-ods_ios.txt --debug --keep --exclude data/project/directory/to/exclude
241+
```
242+
243+
The *check_source_headers.rb* script will generate as much templates as managed programming languages rules.
244+
For example, if there are rules about CSS, it will create a template for the specific rules for CSS. But if there are several rules for CSS, the template will be overriden each time.
245+
The generated template is named using the basic file name, e.g. if you give to the script a "template.txt" file, for CSS the script will build a "template.txt.CSS" file. For Swift, it will be "template.txt.SWIFT" (always extension uppercased).
246+
Thus, supposing some previous file with that name exist, the script will ask you if you want to keep it or not.
247+
You may want to get rid of it because it was for a previous run. But you may want to keep it because you saw some rules for a specific programming language are not really fulfilled (specially with whitespaces), so you would like to use your own custom template file.
248+
249+
**In a nutshell, if it failed the first time, use your custom template file (--keep) instead of using rules with comment symbols defined in the script.**
250+
251+
For example, for a template file name *template-ods_ios.txt* with the content bellow:
252+
```text
253+
Software Name: Orange Design System
254+
SPDX-FileCopyrightText: Copyright (c) Orange SA
255+
SPDX-License-Identifier: MIT
256+
257+
This software is distributed under the MIT license,
258+
the text of which is available at https://opensource.org/license/MIT/
259+
or see the "LICENSE" file for more details.
260+
261+
Authors: See CONTRIBUTORS.txt
262+
Software description: A SwiftUI components library with code examples for Orange Design System
263+
```
264+
265+
And in the Ruby script the following rule for Ruby programming language:
266+
```ruby
267+
check_for_sources($arguments[:folder], $arguments[:template], $arguments[:exclude], conform_files, not_conform_files, ".rb", "#", "# ", "#")
268+
```
269+
270+
The Ruby template checked at the beginning of files is:
271+
272+
```text
273+
#
274+
# Software Name: Orange Design System
275+
# SPDX-FileCopyrightText: Copyright (c) Orange SA
276+
# SPDX-License-Identifier: MIT
277+
#
278+
# This software is distributed under the MIT license,
279+
# the text of which is available at https://opensource.org/license/MIT/
280+
# or see the "LICENSE" file for more details.
281+
#
282+
# Authors: See CONTRIBUTORS.txt
283+
# Software description: A SwiftUI components library with code examples for Orange Design System
284+
#
285+
```
286+
287+
But with the following rule without special symbols to open and close the header, the tempalte will be a bit different:
288+
289+
```ruby
290+
check_for_sources($arguments[:folder], $arguments[:template], $arguments[:exclude], conform_files, not_conform_files, ".rb", "", "# ", "")
291+
```
292+
293+
```text
294+
# Software Name: Orange Design System
295+
# SPDX-FileCopyrightText: Copyright (c) Orange SA
296+
# SPDX-License-Identifier: MIT
297+
#
298+
# This software is distributed under the MIT license,
299+
# the text of which is available at https://opensource.org/license/MIT/
300+
# or see the "LICENSE" file for more details.
301+
#
302+
# Authors: See CONTRIBUTORS.txt
303+
# Software description: A SwiftUI components library with code examples for Orange Design System
304+
```
305+
306+
This case is more interesting if you use the same symbol for first, last and intermediate lines (or if you use only monoline comment symbol).
307+
308+
### Generate a CONTRIBUTORS file
309+
310+
We may want to have a CONTRIBUTORS.txt or AUTHORS.txt files containing all the people names who worked or still work on the project.
311+
To do so, we can use the VCS history as a source of truh ; e.g. Git as SCM.
312+
The *generate-contributors-file.py* Python script will use Git commands to get logs, and build a CONTRIBUTORS file in the project with some notice
313+
and the list of all entities (first name, uppercased lastname, email).
314+
However, the user will have to deal namesakes and only might want to remove some bots accounts.
315+
316+
To run it:
317+
318+
```shell
319+
python3.8 generate-contributors-file.py --target /path/to/myt/git/based/project
320+
```
321+
322+
For example it will output a file with such content:
323+
324+
```text
325+
# This is the official list of people have contributed code to
326+
# this repository.
327+
#
328+
# Names should be added to this file like so:
329+
# Individual's name <submission email address>
330+
# Individual's name <submission email address> <email2> <emailN>
331+
#
332+
# An entry with multiple email addresses specifies that the
333+
# first address should be used in the submit logs and
334+
# that the other addresses should be recognized as the
335+
# same person.
336+
337+
# Please keep the list sorted.
338+
339+
renovate[bot] <29139666+renovate[bot]@users.noreply.github.com>
340+
BarryAllen <barry.allen@star.labs>
341+
Lex LUTHOR <100863844+lluthor@users.noreply.github.com>
342+
Bruce WAYNE <batman@gmail.com>
343+
Bruce WAYNE <bruce.waybe@wayneenterprise.com>
344+
```
345+
346+
In the example above, we can see that the Renovate bot commit has been processed (maybe a line to remove), *BarryAllen* failed to configure his Git environment (because he types to fast on his keyboard we can suppose), the commit from GitHub Web UI of *Lex Luthor* has been picked and *Bruce WAYNE* used two addresses.
347+
348+
Maybe a better file after fixes could be (after manual cleaning):
349+
350+
```text
351+
# This is the official list of people have contributed code to
352+
# this repository.
353+
#
354+
# Names should be added to this file like so:
355+
# Individual's name <submission email address>
356+
# Individual's name <submission email address> <email2> <emailN>
357+
#
358+
# An entry with multiple email addresses specifies that the
359+
# first address should be used in the submit logs and
360+
# that the other addresses should be recognized as the
361+
# same person.
362+
363+
# Please keep the list sorted.
364+
Barry ALLEN <barry.allen@star.labs>
365+
Lex LUTHOR <lex.luthor@lex.corp>
366+
Bruce WAYNE <bruce.wayne@wayneenterprise.com> <batman@gmail.com>
215367
```

0 commit comments

Comments
 (0)