Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Java: add integration test for query suite contents #19229

Merged
merged 2 commits into from
Apr 8, 2025

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Apr 7, 2025

This PR adds an integration test that explicitly checks which Java queries are included in which query suite.

@github-actions github-actions bot added the Java label Apr 7, 2025
@tamasvajk tamasvajk force-pushed the test/java-query-suite branch from 5bd0c39 to d17d441 Compare April 7, 2025 10:49
@tamasvajk tamasvajk marked this pull request as ready for review April 7, 2025 11:15
@Copilot Copilot bot review requested due to automatic review settings April 7, 2025 11:15
@tamasvajk tamasvajk requested a review from a team as a code owner April 7, 2025 11:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an integration test to verify the query suite contents for Java.

  • Adds a new integration test file that iterates over defined query suites and compares expected query files with actual output.
Files not reviewed (4)
  • java/ql/integration-tests/java/query-suite/java-code-quality.qls.expected: Language not supported
  • java/ql/integration-tests/java/query-suite/java-code-scanning.qls.expected: Language not supported
  • java/ql/integration-tests/java/query-suite/java-security-and-quality.qls.expected: Language not supported
  • java/ql/integration-tests/java/query-suite/java-security-extended.qls.expected: Language not supported
Comments suppressed due to low confidence (1)

java/ql/integration-tests/java/query-suite/test.py:11

  • Consider validating that each line in the actual query output is at least as long as the semmle_code_dir prefix to avoid slicing errors.
index = len(str(semmle_code_dir))

Tip: Leave feedback on Copilot's review comments with the 👎 and 👍 buttons to help improve review quality. Learn more


for query_suite in query_suites:
actual = codeql.resolve.queries(query_suite, _capture=True).strip()
actual = sorted(actual.split('\n'))
Copy link
Contributor

Choose a reason for hiding this comment

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

here is not required as we're running this on Linux, but just so you know, actual.splitlines() will work across platforms (accounting for Windows \n\r line separation)

Co-authored-by: Paolo Tranquilli <redsun82@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
import pytest

@runs_on.linux
@pytest.mark.parametrize("query_suite", ['java-code-quality.qls', 'java-security-and-quality.qls', 'java-security-extended.qls', 'java-code-scanning.qls'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: consider making these in alphabetical order.

@tamasvajk tamasvajk merged commit f325f53 into github:main Apr 8, 2025
12 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants