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

SONARJAVA-5288 Create rule S7186: Methods returning "Page" or "Slice" must take "Pageable" as an input parameter #4620

Merged
merged 5 commits into from
Jan 28, 2025

Conversation

github-actions[bot]
Copy link
Contributor

You can preview this rule here (updated a few minutes after each push).

Review

A dedicated reviewer checked the rule description successfully for:

  • logical errors and incorrect information
  • information gaps and missing content
  • text style and tone
  • PR summary and labels follow the guidelines

@erwan-serandour erwan-serandour changed the title Create rule S7186 SONARJAVA-5288 Create rule S7186: Methods returning "Page" or "Slice" must take "Pageable" as an input parameter Jan 27, 2025
The conventional approach to paginating data in Spring is to use the `Pageable` interface to control pagination and to store the query results into a `Page` or `Slice`.
If a query method in a `Repository` returns a `Page` or `Slice` without taking a `Pageable` as an input, it raises a runtime exception.

This rule raises an issue on query methods that return a `Page` or `Slice` without taking a `Pageable` as an input.

Choose a reason for hiding this comment

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

By query methods you mean methods inside a class extending spring repository interfaces? Maybe we should be clearer on this

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link

Quality Gate passed Quality Gate passed for 'rspec-tools'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link

Quality Gate passed Quality Gate passed for 'rspec-frontend'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@erwan-serandour erwan-serandour merged commit d873f6b into master Jan 28, 2025
10 of 12 checks passed
@erwan-serandour erwan-serandour deleted the rule/add-RSPEC-S7186 branch January 28, 2025 15:36
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