Skip to content

Commit 5f7624f

Browse files
committed
Upgrade RAT to 0.16.1, clean up line endings after running
1 parent 2c17fe9 commit 5f7624f

7 files changed

Lines changed: 155 additions & 13 deletions

File tree

docs/images/release-build-outcomes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
120
This markup can be edited and converted to .svg or .png here:
221
https://www.mermaidchart.com/app/projects/95759d78-db93-499c-ad66-0e3f698ba88c/diagrams/31dbd6bc-7ec8-4583-a456-55e3fe3f6cfc/version/v0.1/edit
322

docs/images/release-workflow.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
120
This markup can be edited and converted to .svg or .png here:
221
https://www.mermaidchart.com/app/projects/95759d78-db93-499c-ad66-0e3f698ba88c/diagrams/35faa26e-5ccf-4433-962e-32f20496471c/version/v0.1/edit
322

rat.ps1

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
directory as this script) as the target directory.
3131
3232
.PARAMETER Version
33-
The version of Apache RAT to use (default: 0.13).
33+
The version of Apache RAT to use (default: 0.16.1).
3434
3535
.PARAMETER ExcludeFileName
3636
Name of an exclude file containing path patterns that RAT should ignore.
@@ -43,19 +43,19 @@
4343
.EXAMPLE
4444
pwsh ./rat.ps1
4545
46-
Runs Apache RAT (default version 0.13) with exclusions from `rat-exclude.txt`.
46+
Runs Apache RAT (default version 0.16.1) with exclusions from `rat-exclude.txt`.
4747
4848
.EXAMPLE
49-
pwsh ./rat.ps1 -Version 0.13 -ExcludeFileName custom-exclude.txt
49+
pwsh ./rat.ps1 -Version 0.16.1 -ExcludeFileName custom-exclude.txt
5050
51-
Runs Apache RAT version 0.13 using the specified exclude file.
51+
Runs Apache RAT version 0.16.1 using the specified exclude file.
5252
5353
.NOTES
5454
This script is intended for use by release managers when preparing official
5555
ASF releases. It is not normally required for day-to-day development.
5656
#>
5757
param(
58-
[string]$Version = "0.13",
58+
[string]$Version = "0.16.1",
5959
[string]$ExcludeFileName = ".rat-excludes"
6060
)
6161

@@ -90,13 +90,13 @@ if (-not (Test-Path $ratExcludeFile)) {
9090

9191
$argsList = @(
9292
"-jar", $ratJar,
93-
"--dir", "`"$scriptDir`"",
93+
"--dir", "$scriptDir",
9494
"--addLicense",
9595
"--force"
9696
)
9797

9898
if ($useExclude) {
99-
$argsList += @("--exclude-file", "`"$ratExcludeFile`"")
99+
$argsList += @("--exclude-file", "$ratExcludeFile")
100100
}
101101

102102
# Call java with argument list. Use & to invoke program.
@@ -105,3 +105,31 @@ if ($useExclude) {
105105
if ($LASTEXITCODE -ne 0) {
106106
throw "RAT exited with code $LASTEXITCODE"
107107
}
108+
109+
# Remove trailing whitespace from files modified by RAT
110+
Write-Host "Removing trailing whitespace from modified files..."
111+
112+
# Get list of modified files from git
113+
$modifiedFiles = git diff --name-only --diff-filter=M
114+
if ($LASTEXITCODE -ne 0) {
115+
Write-Host "Warning: Could not get modified files list from git."
116+
} else {
117+
foreach ($file in $modifiedFiles) {
118+
if ([string]::IsNullOrWhiteSpace($file)) { continue }
119+
120+
$filePath = Join-Path $scriptDir $file
121+
if (-not (Test-Path $filePath)) { continue }
122+
123+
try {
124+
# Read all lines, trim trailing whitespace, and write back
125+
$lines = Get-Content -Path $filePath
126+
if ($null -ne $lines) {
127+
$trimmedLines = $lines | ForEach-Object { $_.TrimEnd() }
128+
$trimmedLines | Set-Content -Path $filePath -NoNewline:$false
129+
Write-Host " Cleaned: $file"
130+
}
131+
} catch {
132+
Write-Host " Warning: Could not process $file : $_"
133+
}
134+
}
135+
}

src/Lucene.Net.CodeAnalysis.Dev.Sample/LuceneDev1005Sample_BlockScopedNamespace.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
120
namespace Lucene.Net.Support.BlockScoped
221
{
322
public class PublicClass

src/Lucene.Net.CodeAnalysis.Dev.Sample/LuceneDev1005Sample_FileScopedNamespace.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
120
namespace Lucene.Net.Support;
221

322
public class PublicClass
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
120
## Release 1.0.0-alpha.6
221

322
### New Rules
423

5-
Rule ID | Category | Severity | Notes
24+
Rule ID | Category | Severity | Notes
625
---------------|----------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------
7-
LuceneDev1000 | Design | Warning | Floating point types should not be compared for exact equality
8-
LuceneDev1001 | Design | Warning | Floating point types should be formatted with J2N methods
9-
LuceneDev1002 | Design | Warning | Floating point type arithmetic needs to be checked
10-
LuceneDev1003 | Design | Warning | Method parameters that accept array types should be analyzed to determine whether they are better suited to be ref or out parameters
11-
LuceneDev1004 | Design | Warning | Methods that return array types should be analyzed to determine whether they are better suited to be one or more out parameters or to return a ValueTuple
26+
LuceneDev1000 | Design | Warning | Floating point types should not be compared for exact equality
27+
LuceneDev1001 | Design | Warning | Floating point types should be formatted with J2N methods
28+
LuceneDev1002 | Design | Warning | Floating point type arithmetic needs to be checked
29+
LuceneDev1003 | Design | Warning | Method parameters that accept array types should be analyzed to determine whether they are better suited to be ref or out parameters
30+
LuceneDev1004 | Design | Warning | Methods that return array types should be analyzed to determine whether they are better suited to be one or more out parameters or to return a ValueTuple

src/Lucene.Net.CodeAnalysis.Dev/AnalyzerReleases.Unshipped.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
120
### New Rules
221

322
Rule ID | Category | Severity | Notes

0 commit comments

Comments
 (0)