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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
