-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which kinds of PR's would you like to get? #648
Comments
@nikcio , thank you so much for your efforts. we have many issues because we wanted to stay as close as possible to the java implementation. this is why sonar cloud is finding so many issues. |
Welcome. We are always looking to grow the LuceneNET developer community. It's interesting that you had a lot of challenges getting the project up and running in VS 2022. I started with LuceneNET on VS 2019 and later upgraded to VS 2022 and don't recall having much issue, although the solution configuration is certainly much more complex than any solution/project files I've worked with in the past. But maybe I did have some challenges and asked Shad for help and just forgot. At any rate, your recent experience is the best indicator of what it's like for a developer new to LuceneNET to try to pull it down and build it. I think creating an intro guide to setting up the project in VS 2022 would be a nice addition to the website. I'll let @NightOwl888 reply to most of your suggestions as his responses will be much more thought out then mine ;-) |
Wow, I just pulled down LuceneNET master and tried to build it in VS2022 for the first time in a few months. I totally get where you are coming from @nikcio Earlier this year it worked great for me in VS2022, but now it does not. I get this dialog: And if I say that I want to update the framework and click continue, the website solution still does not load. It's as though it doesn't really update the framework used by the project. This problem didn't use to Exist in VS 2022. Apparently it's still not an issue in VS 2019. But of course I want to use VS 2022. @nikcio How did you resolve the issue? |
@rclabo I think the dialog you're seeing is broken I saw it too and it doesn't seem to do anything. I think the issue is that VS 2022 has dropped support for the older versions of .NET v4 - 4.6.1 (I think). This leads me to the next issue. That VS 2022 has dropped support for older versions. Therefore, you can't use the VS installer to install the older versions on your system. Then to get the older versions you have to do a hacky workaround where you download the SDK from Nuget and move it into the correct folder. You can see this StackOverflow answer on how to: https://stackoverflow.com/questions/70022194/open-net-framework-4-5-project-in-vs-2022-is-there-any-workaround I found I needed to install:
To have the project running. |
@nikcio I think the VS2022 installer only installs .NET 4.8 by default when you choose workflows that require .NET, you need to select older SDK's if you require them under "Individual Components" in the installer. - There are SDK's down to 4.6.1. Considering that 4.6.1 and older (with 3.5 SP 1 as an exception) are all EOL, I guess it makes sense they don't make them available. |
@jeme It was the same conclusion I came to which lead me to the workaround above 😄 |
@nikcio Ahh, I read too fast and missed that you specified "older versions" as .NET v4 - 4.6.1 - Sorry. |
Under "Other ways to help" in: https://github.com/apache/lucenenet/blob/master/CONTRIBUTING.md There's written:
But I'm wondering does any form of document exist of files that has already been looked through? Or does files normally have a tell to show that they've been looked through? |
A little history. For quite a while we had a few failing tests that were difficult to track down. This is primarily because of the randomized testing that is used in the tests and the fact that we don't have a 1:1 port of the test framework. So, to expedite the process of finding these bugs, we requested help reviewing the code line-by-line, since at the time it was easier to find them that way. However, since then we have fixed the test framework so randomized tests can be repeated (thus debugged) in #547. This allowed us to finally track down several issues that were primarily hidden and caused intermittent test failures across several tests. As a result, at present there are no remaining test failures in the We have also made reviewing tests a priority for certain older projects in #259, since during the port there were often missing pieces when working on a given code file and sometimes the solution was to comment out parts of the file to get it to compile. Some of these commented lines may still exist, meaning we may be missing test conditions. If you are looking for a way to narrow this down, I would suggest reviewing the remaining test projects in #259. Do note that most of the projects under test that are not part of #259 were ported from 4.8.1 unless otherwise noted with a comment like |
I have added some issues from the scans above, although, there is a lot in there and I could use some help reviewing and creating issues. Of course, if it is a change that would cause us to diverge greatly from the Java source, we don't want to do it. Some things that I noticed that we definitely do not want to change:
Some things we can change, but are not that critical:
If you could adjust the scan to exclude the issues we don't want to change and the issues I have already opened so we can see what remains, that would be great. |
I'll have a look on excluding the cases above 😄 |
@NightOwl888 I've now excluded the rules causing detection on the things we don't want to change. All the issues you've created I've added linked some more filtered links and I've added a link to the GitHub issues on SonarCloud. I've also marked all issues "confirmed" that you have created issues for on GitHub. You can filter the remaining "open" issues like this: How to find filtered links to issues (Non-Roslyn reported)Press "Why is this an issue" this will show you a description. Then use the title here "Utility classes should not have public constructors" (This is the name of the rule). The rule can be used to filer by rule in the section shown above. How to find filtered links to issues (Roslyn reported)Same as before we need to find the rule name but here the rule name isn't the same as before. Therefore, we need to be on the "Issues" tab and press the filter button (The triangle) and then the rule name will be "Roslyn:CA1822" in this case. Here we can just click the text and the filter will be set. |
More issues we don't want to change:
More issues we can change:
|
I've now excluded the rules causing detection on the new things we don't want to change. Only The other can change points now have a linked issue with a link to SonarCloud of where to find the issues. |
I have added a rule to |
I've experienced some issues opening the Lucene project after updating VS 2022 to 17.3.6 but it seems from what I can gather that it's a bug in VS 2022 so I've reported it here: https://developercommunity.visualstudio.com/t/VS-2022-1736-Process-is-terminated-due/10173885?entry=problem Just if anybody else encounters the same problems 😄 |
@nikcio - Please leave a comment on any issues you are interested in tackling (or currently working on) so we don't duplicate efforts. We will assign them to you specifically (if I am not mistaken, assigning GitHub issues is only available for Apache Lucene.NET committers). |
Thank you! That was on my list to do this morning and to let you know that even though I had been using VS2022 for many months with LuceneNET without issue, when I opened the solution in VS2022 after your message a few days ago I realized it was blowing up with a |
@nikcio - Could we run the SonarCloud scan again? Several of the issues that were already addressed are still there. |
@NightOwl888 I've started a new scan now it takes about ~30 min to run. But I think if you see the value of SonarCloud it should maybe be setup on the main lucene.NET repository instead of only my fork? I can draft a PR which adds it but it of course requires that you have enough permission to set it up in SonarCloud. It would also help future development by annotating PR's and warning about possible problems with PR's. (SonarCloud is free for open source projects) |
@NightOwl888 A how to guide has been created at: #709 😄 |
Here is a puzzle to work out. The scan is telling us to use an immutable collection. The problem is, this is an immutable collection, just not one from
So we need to adjust the scan to ignore these, while picking up any others that we might have missed. Since there are only a few dozen, we could suppress them with an attribute, but since this isn't a Roslyn error, I am not sure how to suppress it conditionally. Thoughts? One other issue is the fact that J2N currently doesn't support |
I've looked a bit around and unfortunately it seems that you cannot customize the rules in SonarCloud. If you need to have this ability you need to host SonarQube yourself then it can be done. But I did find that it's possible to extend a rule description. So We could add the classes listed above to that description. I'm unsure if this affects everyone using the rule or is specific to a Quality profile. Therefore I think we should mark the current false positives as "Resolved as Won't fix" with a link to the description above. Although if you'd like to add SonarCloud to the main repository I would wait until then so we don't have to do it twice. There's also the possibility that Sonar themselves could fix the issue with the rule but I'm not sure how to make that request. |
As for the other issue I would properly also mark issues related to that with a "Resolved won't fix" because as long as you keep track of the issues with the TODO marker they won't be lost. If there's a specific rule in SonarCloud that triggers the issue it could be even easier because we can just deactivate the rule and reactivate it when it's time to make the change then there's no manual labor. |
Random thought Maybe by using SonarCloud on the J2N library it could tell us more about why it marks the collections as mutable. It's very possible that it's just a specific pattern and/or hardcoded list that Sonar uses in this rule and therefore marks them wrong so it's a long shot. As long as there's some source code or test code set up in a similar faction as where it registers the issue in the Lucenenet project we could see if the issue is also registered there. |
I guess it depends. What happens if you create a sample app that has an API that returns an instance (declared in a static readonly variable) of a readonly collection from That being said, the code analyzer infrastructure is flexible in that it allows you to define your own IDs to suppress with the same old |
I looked in the logs from the GitHub actions workflow and found the ID here (It's the
And also found this: https://stackoverflow.com/questions/63191169/is-there-a-possibility-to-suppress-warnings-of-sonarcloud-in-source-code Some issues can also be found directly in Visual Studio with SonarLint but as my VS 2022 installation is unusable at the moment I didn't try that 😄 But when VS doesn't crash SonarLint will show most of the current Sonar warning in the Errors tab for the files you have open. It's a little unclear what issues it doesn't show but I think the ones that won't should would take to much compute so they left them out to ensure a smooth experience. |
Just FYI, these warning numbers are also used in the URL, so can easily be used to filter the list and/or get the ID. https://sonarcloud.io/project/issues?resolved=false&rules=csharpsquid%3AS3887&id=nikcio_lucenenet Just ignore the |
To be fair, the design behind how If there is any rules that the project does not wish to use or if we wish to flag rules differently, a custom profile can be created and the project can be changed to that, to exclude rules from a profile you need to copy their profile and then modify it from there, unfortunately inheriting one will not allow one to exclude rules only include additional ones, (I did not keep up with the entire thread here so don't know if you have already been working on that) - (Rules from Roslyn have to be ignored there instead) I can see that allot of Apache projects already use SonarCloud, if the LuceneNET project wishes to use it as well maybe it's worth figuring out who and how to get it registeret there so a workflow can be added in the main project instead. However being a Java port, I think it should be considered very carefully, as mentioned again an again, certain decisions is made to stick close to Java which is likely to lead to more flags by tools such as Sonar. It is also possible to make sonar only report from a Delta, either by days, version, data etc. This can be really useful as you otherwise has this huge burden of thousands of red flags in old code which would take days to fix, instead with this feature it's possible to focus on only fixing these issues in new code or as old code changes. |
Guys you're doing a great job but I think we better put our efforts in a new version and align with the latest Java Lucene. Lucene is an awesome library, one of the best, however if today I would design it completely different with modern architecture, less allocations and much better performance in mind. We choose this path with the known issues because we wanted to stay as close as possible to the Java implementation. Without this constraints like I said, I would completely refactor many parts. I tried to write a tool that compares Java 4.8 to the latest, mark the .net files to be changed and what's the difference. I can estimate that in 2-3 months of hard work I can get to compiling latest aligned version. (Of course this is only the first part then fix the failing tests) If someone know a big company that will benefit from it and might have the funds, I'm willing to take this small project |
@eladmarg I believe this conversation is very similar to what's written here: #437 (comment) I found this issue when first looking into the project and I've come to agree that a great first step would be to make the 4.8.0 version stable (out of beta) before taking on too much of the new additions that have happened in the Lucene project and I think many of the issues we're solving currently are moving us closer to that target. I also would love to have Lucenenet be feature equivalent to the Lucene project but having a solid foundation will make the process more smooth. Also when I first came to the project a couple of weeks ago I didn't know very much about how the project functions and still don't now 99% of the project so I found it very difficult starting to look into the issues already opened. Therefore, I find the newly opened issues great because they give me a chance to help out and slowly get more familiar with the project. And about the funding element as I read in the different conversations in the issues it's a common problem that this project doesn't get the love it deserves. And therefore moves more slowly than it otherwise would be. Even though I've tried to help out in the past weeks @NightOwl888 have been doing like 90% of the real work that has been going into the project. So if we can come up with some kind of strategy to pull more attention to the project it would be great. And I'm sure very appreciated by the maintainers that have used countless hours on this project. |
@nikcio - I found what appears to be a bug in the scan: https://sonarcloud.io/project/issues?issues=AYPAuOCLhbfJOGLOoaG2&open=AYPAuOCLhbfJOGLOoaG2&id=nikcio_lucenenet The scan is recommending to convert from I double-checked, and indeed it is possible to inherit public class Foo : FieldCacheRangeFilter<double>
{
public Foo()
: base("foo", FieldCache.NUMERIC_UTILS_DOUBLE_PARSER, lowerVal: 444.444, upperVal: 555.555, includeLower: true, includeUpper: true)
{
}
public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
{
throw new NotImplementedException();
}
} Clearly the advice given by the scan is incorrect if we want this to remain a That being said, checking with the Lucene 4.8.0 source the constructor is actually declared
|
I guess I am also going to have to state that this bug is probably going to be helpful to find all of the protected APIs that were translated from Java to C# wrong. So, we should wait until #677 is closed before we report it to SonarCloud. |
@NightOwl888 I've just looked a bit on it and I don't think the rule is wrong. If you read the title it says it's because the class is marked abstract and therefore can't be instantiated: https://sonarcloud.io/organizations/nikcio/rules?open=csharpsquid%3AS3442&rule_key=csharpsquid%3AS3442 Therefore, in the example it would make most sense to change the modifier to Do note that the rule specifics that the modifier shouldn't be public/internal not that it should always be private.😉 |
As #709 has been merged and seems to be working I've updated the links in the open issues to link to the new sonar report: Mostly the link is the same with a change in the |
@NightOwl888 As I have no power to change the states of the issues on the official sonarcloud issues it would be great if you could mark these two issues as won't fix as was done in prior conversations. The issues viewed from my fork: https://sonarcloud.io/project/issues?resolutions=WONTFIX&id=nikcio_lucenenet |
Hi I'm new to this repository.
Therefore to avoid PR spamming I would like to hear what kinds of PR's you'd like to get on this repository. In my own fork I've tried implementing the following tools/fixes/updates that might be useful to have in the main repository:
Other fixes/updates I have in mind
Please let me know what you'd like PR's on.
@NightOwl888 @rclabo you guys seems to be some of the more active contributors 😄
The text was updated successfully, but these errors were encountered: