Skip to content

JS: refactor get predicates with no return #18187

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Napalys
Copy link
Contributor

@Napalys Napalys commented Dec 3, 2024

This small PR fixes an issue in the JavaScript side of QL where predicates starting with get or as don't have a return type.
The query introduced from #18164 helped identify these predicates.

@github-actions github-actions bot added the JS label Dec 3, 2024
/** Holds if this package depends on version 'version' of package 'pkg'. */
predicate getADependency(string pkg, string version) { version = this.getPropStringValue(pkg) }
/** Returns the version of the specified package that this package depends on. */
string getADependency(string pkg) { result = this.getPropStringValue(pkg) }
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is in draft PR state, but I a peek anyway.

We have to be wary of breaking changes in predicates that are part of the public API. To change the signature of this predicate, we'd have to rename it and leave behind a deprecated version of the original predicate.

Apart from that, I think I'd prefer to rename it to hasDependency instead, and not add a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And if we rename it to hasDependency, we would still need to keep the original predicate getADependency marked as deprecated and in the comment refer that people now should use hasDependency, correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, that's right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants