You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "paulirwin (via GitHub)" <gi...@apache.org> on 2025/03/08 23:47:01 UTC
[PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
paulirwin opened a new pull request, #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2
NOTE: This requires #1 to be merged first, as it is a stacked PR on top of that one, so it shows all changes from that PR as well. I will rebase it against main once #1 is merged.
This adds a diagnostic and code fix for detecting public types in the Lucene.Net.Support namespace.
Fixes https://github.com/apache/lucenenet/issues/1100
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2384475314
##########
.globalconfig:
##########
@@ -0,0 +1,2 @@
+roslyn_correctness.assembly_reference_validation = relaxed
Review Comment:
Just curious what is this setting for? I did a couple of searches, but couldn't locate anything on the subject. Can you provide link to a document about it?
##########
src/Lucene.Net.CodeAnalysis.Dev/LuceneDev1xxx/LuceneDev1005_LuceneNetSupportPublicTypesCSCodeAnalyzer.cs:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Diagnostics;
+using System.Collections.Immutable;
+using Lucene.Net.CodeAnalysis.Dev.Utility;
+
+namespace Lucene.Net.CodeAnalysis.Dev
+{
+ [DiagnosticAnalyzer(LanguageNames.CSharp)]
+ public class LuceneDev1005_LuceneNetSupportPublicTypesCSCodeAnalyzer : DiagnosticAnalyzer
Review Comment:
I asked ChatGPT for an analysis about the analyzer and code fix, and it suggested there are a few gaps in the implementation (https://chatgpt.com/share/68d8b9f5-b990-8005-b7e3-0d8a857230d1). I think the only one to be concerned about is with partial classes.
##########
src/Lucene.Net.CodeAnalysis.Dev.CodeFixes/LuceneDev1xxx/LuceneDev1005_LuceneNetSupportPublicTypesCsCodeFixProvider.cs:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Collections.Immutable;
+using System.Composition;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Lucene.Net.CodeAnalysis.Dev.CodeFixes;
+using Lucene.Net.CodeAnalysis.Dev.CodeFixes.Utility;
+using Lucene.Net.CodeAnalysis.Dev.Utility;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CodeFixes;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using SyntaxFactory = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
+using SyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind;
+
+namespace Lucene.Net.CodeAnalysis.Dev;
+
+[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(LuceneDev1005_LuceneNetSupportPublicTypesCsCodeFixProvider)), Shared]
+public class LuceneDev1005_LuceneNetSupportPublicTypesCsCodeFixProvider : CodeFixProvider
Review Comment:
Minor quibble. The "Cs" is cased differently than the "CS" on other types.
Although, maybe we should consider naming the rules similarly to how Xunit did it. For example, `SupportNamespaceShouldNotHavePublicTypes` which explains what it is for much better than `LuceneNetSupportPublicTypes`. I could go either way on whether to prepend `LuceneDev1005_`, since the descriptor should include that bit (and we may need analyzers that support multiple rules). But prepending it does make them sort nicely in order. Also, I could go either way on whether to suffix with `CSCodeFixProvider` or `CSCodeAnalyzer`, since the library it belongs to and the fact that it is in a `LuceneDevxxxx` folder determines that.
##########
src/Lucene.Net.CodeAnalysis.Dev/Utility/Category.cs:
##########
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
Review Comment:
This is the way that license headers come out of the RAT tool.
We could address that by running a Powershell command after the tool is finished to:
1. Get a list of all files that currently have changes in the Git working directory.
2. Loop though those files and strip any trailing whitespace characters.
This should prevent IDE differences from making our PRs noisy by checking them in without the trailing whitespace in the first place.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2386308062
##########
.globalconfig:
##########
@@ -0,0 +1,2 @@
+roslyn_correctness.assembly_reference_validation = relaxed
Review Comment:
Here are the docs for this setting, it was to suppress some Roslyn meta-analyzer, but honestly I don't remember at this time as it was so long ago. I'll have to try removing it and see what happens. https://github.com/dotnet/roslyn/blob/main/docs/roslyn-analyzers/rules/RS1022.md
It also seems to be related to this RS1038 warning: https://github.com/dotnet/roslyn-analyzers/issues/7438
This might be a non-issue now that the code fixes are split into a separate assembly, possibly?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2392164434
##########
rat.ps1:
##########
@@ -30,7 +30,7 @@
directory as this script) as the target directory.
.PARAMETER Version
- The version of Apache RAT to use (default: 0.13).
+ The version of Apache RAT to use (default: 0.16.1).
Review Comment:
Yes it is, see docs/images/release-build-outcomes.md - that was done by RAT after I made the exclusion more specific to just the analyzer markdown files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#issuecomment-3368537777
Fixed issue with leading/trailing trivia including added unit test coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2391952641
##########
rat.ps1:
##########
@@ -30,7 +30,7 @@
directory as this script) as the target directory.
.PARAMETER Version
- The version of Apache RAT to use (default: 0.13).
+ The version of Apache RAT to use (default: 0.16.1).
Review Comment:
In what way did it not respect the `.rat-excludes` file for you? It worked fine for me, including all of our existing rules and the new md one I added. Perhaps it wasn't working because of the incorrect quotes in the path string that I fixed? There's no need to add quotes around i.e. spaces in paths, because it's already in a string that gets effectively quoted. I tested this on paths with spaces btw.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2389798475
##########
src/Lucene.Net.CodeAnalysis.Dev/LuceneDev1xxx/LuceneDev1005_LuceneNetSupportPublicTypesCSCodeAnalyzer.cs:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Diagnostics;
+using System.Collections.Immutable;
+using Lucene.Net.CodeAnalysis.Dev.Utility;
+
+namespace Lucene.Net.CodeAnalysis.Dev
+{
+ [DiagnosticAnalyzer(LanguageNames.CSharp)]
+ public class LuceneDev1005_LuceneNetSupportPublicTypesCSCodeAnalyzer : DiagnosticAnalyzer
Review Comment:
Resolved the partial class code fix. It worked fine with the default test behavior which does a "Fix All" but ChatGPT was correct that when done as a single fix it did not update the other partial class file(s). FYI that you can pass `CodeFixTestBehaviors = CodeFixTestBehaviors.FixOne` to InjectableCodeFixTest to make it only do a single fix to test this behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2389808622
##########
rat.ps1:
##########
@@ -30,7 +30,7 @@
directory as this script) as the target directory.
.PARAMETER Version
- The version of Apache RAT to use (default: 0.13).
+ The version of Apache RAT to use (default: 0.16.1).
Review Comment:
When I tried RAT 0.16, it didn't seem to be respecting the `.rat-excludes` that we have configured. According to ChatGPT, they changed the way it processes the file so some of the older config settings may no longer function. I ended up just reverting back to 0.13 to avoid the extra effort of fixing the `.rat-excludes` file.
It's fine to upgrade, but make sure the `.rat-excludes` settings and comments are updated about how to format the lines.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2386301271
##########
src/Lucene.Net.CodeAnalysis.Dev/Utility/Category.cs:
##########
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
Review Comment:
Yeah, Rider was doing this automatically (which I like). Good idea about doing that via the powershell script. FWIW, the rat.ps1 file wasn't working on my machine (maybe macOS related) but I haven't had time to dig into that yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2387943000
##########
.globalconfig:
##########
@@ -0,0 +1,2 @@
+roslyn_correctness.assembly_reference_validation = relaxed
Review Comment:
Yeah that seems to have been it. Now that the projects are separate, the CodeFixes project can reference workspaces which is allowed, while the analyzers one doesn't. Removed this file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2392042296
##########
rat.ps1:
##########
@@ -30,7 +30,7 @@
directory as this script) as the target directory.
.PARAMETER Version
- The version of Apache RAT to use (default: 0.13).
+ The version of Apache RAT to use (default: 0.16.1).
Review Comment:
Updating the `.rat-excludes` file for the Markdown excludes still works, so I'm going to mark this resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#issuecomment-3353240707
I gave it a try to see if it works in Lucene.NET using the latest build from CI. It didn't update automatically until I restarted Visual Studio to reload the cache. Most likely because we didn't bump to 1.1 yet.
The analyzer seems to be working well, but when I try the code fix, it strips the license header from the file.
<img width="1058" height="563" alt="image" src="https://github.com/user-attachments/assets/16e002dc-4c9c-4883-9476-3ec666a19553" />
-----------------------------
The comments are stored in the `LeadingTrivia` of the code element (which returns a `SyntaxTriviaList`). That list needs to be carried over into the updated node unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#issuecomment-3353250889
Come to think of it, there is also a `TrailingTrivia` element. But, I have no idea what the effect of removing it would be or even if changing the modifiers of a class would remove it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2389825392
##########
.rat-excludes:
##########
@@ -20,3 +20,6 @@ _site/*
release-build-outcomes\.svg
release-workflow\.svg
+
+# Exclude markdown files
+.*\.md
Review Comment:
We probably should add licenses to our documentation files. But we need to exclude `AnalyzerReleases.Unshipped.md` and `AnalyzerReleases.Shipped.md` to avoid the warnings about the format.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin merged PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2389798475
##########
src/Lucene.Net.CodeAnalysis.Dev/LuceneDev1xxx/LuceneDev1005_LuceneNetSupportPublicTypesCSCodeAnalyzer.cs:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Diagnostics;
+using System.Collections.Immutable;
+using Lucene.Net.CodeAnalysis.Dev.Utility;
+
+namespace Lucene.Net.CodeAnalysis.Dev
+{
+ [DiagnosticAnalyzer(LanguageNames.CSharp)]
+ public class LuceneDev1005_LuceneNetSupportPublicTypesCSCodeAnalyzer : DiagnosticAnalyzer
Review Comment:
Resolved the partial class code fix. It worked fine with the default behavior which does a "Fix All" but ChatGPT was correct that when done as a single fix it did not update the other partial class file(s). FYI that you can pass `CodeFixTestBehaviors = CodeFixTestBehaviors.FixOne` to InjectableCodeFixTest to make it only do a single fix to test this behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2389802256
##########
src/Lucene.Net.CodeAnalysis.Dev/Utility/Category.cs:
##########
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
Review Comment:
FYI - RAT was adding the license header to the shipped/unshipped markdown files. I'm excluding md files from RAT for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2392104354
##########
rat.ps1:
##########
@@ -30,7 +30,7 @@
directory as this script) as the target directory.
.PARAMETER Version
- The version of Apache RAT to use (default: 0.13).
+ The version of Apache RAT to use (default: 0.16.1).
Review Comment:
Okay, I couldn't recall so I went back to check. The issue I was having was that the RAT tool would hang and not finish. I am guessing that had to do with the escaping issues that you have already fixed.
Here is what ChatGPT had to say about 0.16:
> That makes sense — RAT 0.13 and RAT 0.16 behave differently:
>
>* **0.13** has the `--addLicense` and `--force` options (which auto-inserts missing license headers).
>* **0.16** dropped those options and focuses purely on **auditing/reporting**, not modifying source files. So when you ran with 0.16, it hung waiting for input because those flags weren’t valid anymore.
>
>That explains why your exclusions format still worked (the syntax hasn’t changed much), but the run never finished under 0.16.
>
>So your options are:
>
>1. **Stick with 0.13 for release prep** (since it gives you auto-insert).
>2. **Use 0.16** if you only want auditing, but then you’ll need a separate process to add headers (for example, Apache Yetus’s `addlicense` or manual templates).
>
>Given this is ASF release prep, using **0.13 just for release managers** is fine, as long as you document the requirement in your `rat.ps1` header comments.
>
>👉 Do you want me to update your script’s **header doc block** to explicitly call out that it’s pinned to RAT 0.13 because newer versions removed auto-insert? That’ll save future contributors from getting confused.
But, either ChatGPT is wrong or the [RAT command-line docs](https://creadur.apache.org/rat/apache-rat/index.html) are wrong, because it still shows `--addLicense` and `--force` as options.
Is it adding the licenses to the files with the new version? If not, I would say let's stick with 0.13. But it is fine to upgrade to 0.16.1 if that still works.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add analyzer and code fix for public types in Lucene.Net.Support, #1100 [lucenenet-codeanalysis-dev]
Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on code in PR #2:
URL: https://github.com/apache/lucenenet-codeanalysis-dev/pull/2#discussion_r2389759985
##########
src/Lucene.Net.CodeAnalysis.Dev.CodeFixes/LuceneDev1xxx/LuceneDev1005_LuceneNetSupportPublicTypesCsCodeFixProvider.cs:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Collections.Immutable;
+using System.Composition;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Lucene.Net.CodeAnalysis.Dev.CodeFixes;
+using Lucene.Net.CodeAnalysis.Dev.CodeFixes.Utility;
+using Lucene.Net.CodeAnalysis.Dev.Utility;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CodeFixes;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using SyntaxFactory = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
+using SyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind;
+
+namespace Lucene.Net.CodeAnalysis.Dev;
+
+[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(LuceneDev1005_LuceneNetSupportPublicTypesCsCodeFixProvider)), Shared]
+public class LuceneDev1005_LuceneNetSupportPublicTypesCsCodeFixProvider : CodeFixProvider
Review Comment:
For now, I'm not going to remove the prefix or suffix. I'm fine with it as it is, and we can evolve it over time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org