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

fix: ajustes sonar e code smells. #11

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<surefire-plugin.version>3.2.5</surefire-plugin.version>
<sonar.organization>renatolopescaixa</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.coverage.jacoco.xmlReportPaths>src/test/jacoco-report/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.jacoco.xmlReportPaths>target/jacoco-report/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/br/gov/caixa/teia/resource/DesafioResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,27 @@
@Path("/manipulacao-string")
public class DesafioResource {

@Inject
Logger log;
private final Logger log;
private final DesafioService service;

@Inject
DesafioService service;
public DesafioResource(DesafioService service, Logger log) {
this.service = service;
this.log = log;
}

@POST
@RunOnVirtualThread
@CacheResult(cacheName = "desafio-cache")
@CacheResult(cacheName = "desafio-cache")
@Operation(summary = "Manipular String", description = "Verifica se a string é um palíndromo e conta o número de ocorrências de cada caractere.")
@APIResponse(responseCode = "200", description = "Operação bem-sucedida", content = @Content(mediaType = "application/json", schema = @Schema(implementation = DesafioResponseDto.class)))
@APIResponse(responseCode = "400", description = "Solicitação inválida")
@APIResponse(responseCode = "500", description = "Erro interno do servidor")
public RestResponse<DesafioResponseDto> manipularString(@RequestBody(required = true) DesafioRequestDto request) {
String texto = request.getTexto();
log.info("Recebida solicitação para manipular a string: " + texto);
//Verifica se a string foi passada no Request body

// Verifica se a string foi passada no Request body
service.validaBody(texto);

// Verifica se a string é um palíndromo
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/br/gov/caixa/teia/service/DesafioService.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
@ApplicationScoped
public class DesafioService {

private final Logger log;

@Inject
Logger log;
public DesafioService(Logger log) {
this.log = log;
}

public void validaBody(String texto) {
if (texto == null) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ quarkus:
info-contact-url: https://github.com/renatoLopesCaixa
info-license-name: MIT License
info-license-url: https://www.mit.edu/~amini/LICENSE.md

jacoco:
report-location: src/test/jacoco-report

#para o desafio deixei o swagger-ui habilitado em prod
swagger-ui:
Expand Down
6 changes: 0 additions & 6 deletions src/test/jacoco-report/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion src/test/jacoco-report/jacoco.xml

This file was deleted.

Loading