Skip to content
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

Update embedded CFamily analyzer from 6.29.0.41127 to 6.31.0.44497 #2874

Closed
wants to merge 28 commits into from

Conversation

AbbasNS
Copy link
Contributor

@AbbasNS AbbasNS commented Feb 20, 2022

fixes #2873 depends on #2661 (PR #2872)

@AbbasNS AbbasNS changed the base branch from master to as/UseNewMode February 20, 2022 20:44
@AbbasNS AbbasNS changed the base branch from as/UseNewMode to branch-vcxproj February 21, 2022 14:53
@AbbasNS AbbasNS changed the title Update embedded CFamily analyzer to v6.30.0.42324 Update embedded CFamily analyzer from 6.29.0.41127 to 6.31.0.44497 Mar 11, 2022
@AbbasNS AbbasNS changed the title Update embedded CFamily analyzer from 6.29.0.41127 to 6.31.0.44497 Update embedded CFamily analyzer from 6.29.0.41127 to 6.32.0.44918 Mar 18, 2022
@duncanp-sonar
Copy link
Contributor

Hi @abbas-sabra-sonarsource. It looks like v6.32 may contain breaking changes around the legacy key changes so we'll need to do some more investigation before we merge it (see #2956).

Can you think of anything that might cause a breaking change in v6.31? I can't see anything that looks problematic in the release notes.

Assuming v6.31 doesn't require any more work on our side it's likely that we'll release that first and v6.32 later.

@AbbasNS
Copy link
Contributor Author

AbbasNS commented Mar 28, 2022

Hello @duncanp-sonar, I confirm there are no breaking changes in 6.31. It makes sense to release 6.31 first and take the necessary time to do the investigation around legacy keys before 6.32

@AbbasNS AbbasNS changed the title Update embedded CFamily analyzer from 6.29.0.41127 to 6.32.0.44918 Update embedded CFamily analyzer from 6.29.0.41127 to 6.31.0.44497 Mar 28, 2022
@AbbasNS
Copy link
Contributor Author

AbbasNS commented Mar 28, 2022

@duncanp-sonar I changed the ticket and branch to target 6.31 and created a separate issue(#2958) for 6.32

@rita-gorokhod rita-gorokhod changed the base branch from branch-vcxproj to branch-hardening March 30, 2022 05:53
@rita-gorokhod rita-gorokhod self-assigned this Apr 1, 2022
// Use PCH in header files if project PCH is configured and not enforced through force include
// In normal code, it should be self to assume this since PCH should be used on every CPP file
if (string.IsNullOrEmpty(forcedIncludeFiles) && precompiledHeader == "Use")
// in case ClCompilerPath is not available on VS2017
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abbas-sabra-sonarsource we've dropped support for VS 2017, so this code would only run in VS 2019+. Does this have any implications on the code below? Can it be simplified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though we dropped support to VS 2017, its toolchain can still be used with newer vs. So better to keep it. maybe we can improve the comment to say VS2017 toolchains

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the comment, toolchains helps to understand the problem much better 👍


namespace SonarLint.VisualStudio.Integration.Vsix.CFamily.VcxProject
{
internal class CmdBuilder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abbas-sabra-sonarsource is this the same logic that exists on the java side? it could be useful to link to it, so we could diff changes more easily.

Copy link
Contributor Author

@AbbasNS AbbasNS Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This file is loading options from the UI and is specific to VS. the idea was that CFamily java side change on every release. It is really hard to synchronize especially after a lot of refactoring on the java side that has no impact on SonarLint. We had a lot of bugs because it is hard to synchronize. Now we only have this code that is specific to the CFamily compilation options. It is localized and isolated. The idea is to be able to update the CFamily analyzer without any changes on the SonarLint side. Like the update to 6.30, 6.31..
Later, we can even drop the entire file if we find a way to load All option UI (as mentioned in #2661)

Of course CmdBuilder.cs need to be maintained to handle two things: discovering bugs and VS adding new compiler options in their UI(which doesn't happen that often). I'm happy to maintain CmdBuilder.cs which should be low effort. It should be the only place that contains CFamily specific code that supposes to evolve with new VS releases

case "internal.fileDependency": // not currently handled. See https://github.com/SonarSource/sonarlint-visualstudio/issues/2611
// Rules that start with internal shouldn't be treated as issues.
// Some of them should be handled like `internal.fileDependency`. See: https://github.com/SonarSource/sonarlint-visualstudio/issues/2611
// Others should can simply ignored like `internal.z3RefutationRate`, which is used to log in the scanner how many issues are rejected by the Z3 solver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a bug fix? is this something that we already accidently report to the user?

Copy link
Contributor Author

@AbbasNS AbbasNS Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a bug, but before it wasn't since most of the internal messages has invalid loc (line number 0..) which is ignored. but that is not a contract that we maintain.
I added this here because it is the right behavior and this code impacted the integration test after fixing the bug about Z3 (#2875) in the "Use the subprocess SonarLint mode" branch.

By the way, you are reviewing the #2661 code in the update of analyzer PR. even though they dependents on each other might be better to separate the review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out, this branch contained everything, hence I missed the other PR.
I've changed the base of this branch to point to the other branch, and it makes it much simpler now.

@rita-gorokhod rita-gorokhod changed the base branch from branch-hardening to as/UseNewMode April 1, 2022 11:37
Base automatically changed from as/UseNewMode to branch-hardening April 4, 2022 11:17
@sonarcloud
Copy link

sonarcloud bot commented Apr 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@rita-gorokhod rita-gorokhod added this to the 6.1 milestone Apr 6, 2022
@rita-gorokhod rita-gorokhod removed this from the 6.1 milestone Apr 6, 2022
@duncanp-sonar duncanp-sonar deleted the as/cpp-analyzer branch December 6, 2022 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update embedded CFamily analyzer from 6.29.0.41127 to 6.31.0.44497
4 participants