Skip to content

C++: Remove some unused legacy relations from the DB scheme #7982

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

Merged
merged 5 commits into from
Feb 14, 2022

Conversation

jketema
Copy link
Contributor

@jketema jketema commented Feb 11, 2022

Remove the following legacy relations:

  • externalData
  • snapshotDate
  • duplicateCode
  • similarCode
  • tokens

This is similar to the following C# change #7746

@jketema jketema requested a review from a team as a code owner February 11, 2022 15:43
@github-actions github-actions bot added the C++ label Feb 11, 2022
@MathiasVP
Copy link
Contributor

MathiasVP commented Feb 11, 2022

There are a couple of compile errors in CodeDuplication.qll now. For example:

ERROR: Could not resolve type @duplication_or_similarity (/home/runner/work/semmle-code/semmle-code/ql/cpp/ql/src/external/CodeDuplication.qll:14,20-46)

I think we should redefine the Copy class as:

private newtype TCopy = MkCopy() // Or whatever

/**
 * DEPRECATED: This class is no longer used.
 * 
 * A token block used for detection of duplicate and similar code.
 */
class Copy extends TCopy { ... }

and replace body of the predicates that refer to non-existing tables with none(). Hopefully, that means that existing code that uses these classes will still compile.

For CodeQL we have a 6 months deprecation notice. So 6 months from now we can finally delete this code for real!

How does that sound?

@jketema
Copy link
Contributor Author

jketema commented Feb 11, 2022

Sound like a plan.

@jketema jketema force-pushed the remove-legacy-relations branch from ebab996 to 5e59d99 Compare February 11, 2022 16:52
@MathiasVP
Copy link
Contributor

MathiasVP commented Feb 11, 2022

Almost LGTM! The QLDoc Check is complaining because we don't have QLDoc on:

  • The external/CodeDuplication.qll file, and
  • the CodeDuplication::SimilarBlock class.

I think we can ignore the file QLDoc requirement, but maybe we should add a QLDoc on the SimilarBlock class just saying DEPRECATED: This class is no longer used. or something similar.

And finally, we need to include a change note in https://github.com/github/codeql/tree/main/cpp/ql/src/change-notes.

@jketema
Copy link
Contributor Author

jketema commented Feb 11, 2022

I accidentally added an empty line between CodeDuplication::SimilarBlock and its documentation. That should be fixed now.

@MathiasVP
Copy link
Contributor

I accidentally added an empty line between CodeDuplication::SimilarBlock and its documentation. That should be fixed now.

Oh, perfect.

@jketema
Copy link
Contributor Author

jketema commented Feb 11, 2022

The change note should be about the deprecation of the classes?

Also ensure they no longer depend on the removed relations.
@MathiasVP
Copy link
Contributor

The change note should be about the deprecation of the classes?

Yeah, exactly.

@jketema jketema force-pushed the remove-legacy-relations branch from 380a2d6 to 7f4913d Compare February 11, 2022 17:15
MathiasVP
MathiasVP previously approved these changes Feb 11, 2022
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM!

MathiasVP
MathiasVP previously approved these changes Feb 11, 2022
@MathiasVP MathiasVP merged commit 2b6d57d into github:main Feb 14, 2022
MathiasVP added a commit to MathiasVP/ql that referenced this pull request Feb 14, 2022
…ations"

This reverts commit 2b6d57d, reversing
changes made to 9b4dbb9.
MathiasVP added a commit that referenced this pull request Feb 14, 2022
Revert "Merge pull request #7982 from jketema/remove-legacy-relations"
@jketema jketema deleted the remove-legacy-relations branch February 15, 2022 09:23
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.

2 participants