Skip to content

Enable & fix inspection: Single character string argument in String.indexOf() call #2823

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 2 commits into from
Nov 4, 2021

Conversation

Bennett-Lynch
Copy link
Contributor

Reports single character strings being used as an argument in String.indexOf() and String.lastIndexOf() calls.

A quick-fix is suggested to replace such string literals with equivalent character literals, gaining some performance enhancement.

Example:

  return s.indexOf("x");

After the quick-fix is applied:

  return s.indexOf('x');

License

  • I confirm that this pull request can be released under the Apache 2 license

….indexOf()` call

Reports single character strings being used as an argument in String.indexOf() and String.lastIndexOf() calls.

A quick-fix is suggested to replace such string literals with equivalent character literals, gaining some performance enhancement.

Example:

```
  return s.indexOf("x");
```

After the quick-fix is applied:

```
  return s.indexOf('x');
```
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2021

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

66.7% 66.7% Coverage
13.3% 13.3% Duplication

@Bennett-Lynch Bennett-Lynch merged commit f413a8e into aws:master Nov 4, 2021
aws-sdk-java-automation added a commit that referenced this pull request Nov 30, 2023
…7c27940bb

Pull request: release <- staging/db6cd2ff-52c7-4150-abee-3147c27940bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants