Skip to content

Commit

Permalink
Fix code smells discovered by sonarlint
Browse files Browse the repository at this point in the history
- Use the constructor dep. injection
- return value withou assigning it to a variable
  • Loading branch information
forus committed Oct 28, 2024
1 parent 1adca8c commit 7c394bb
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/org/cbioportal/web/SessionServiceController.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
Expand Down Expand Up @@ -74,15 +73,20 @@ public class SessionServiceController {
private static final String QUERY_OPERATOR_SIZE = "$size";
private static final String QUERY_OPERATOR_AND = "$and";

@Autowired
SessionServiceRequestHandler sessionServiceRequestHandler;

@Autowired
private ObjectMapper sessionServiceObjectMapper;

@Autowired
private StudyViewFilterApplier studyViewFilterApplier;

public SessionServiceController(SessionServiceRequestHandler sessionServiceRequestHandler,
ObjectMapper sessionServiceObjectMapper,
StudyViewFilterApplier studyViewFilterApplier) {
this.sessionServiceRequestHandler = sessionServiceRequestHandler;
this.sessionServiceObjectMapper = sessionServiceObjectMapper;
this.studyViewFilterApplier = studyViewFilterApplier;
}

@Value("${session.service.url:}")
private String sessionServiceURL;

Expand Down Expand Up @@ -275,13 +279,12 @@ private Set<VirtualStudySamples> extractVirtualStudySamples(List<SampleIdentifie
* @param sampleIdentifiers
*/
private Map<String, Set<String>> groupSampleIdsByStudyId(List<SampleIdentifier> sampleIdentifiers) {
Map<String, Set<String>> sampleIdsByStudyId = sampleIdentifiers
return sampleIdentifiers
.stream()
.collect(
Collectors.groupingBy(
SampleIdentifier::getStudyId,
Collectors.mapping(SampleIdentifier::getSampleId, Collectors.toSet())));
return sampleIdsByStudyId;
}

@RequestMapping(value = "/virtual_study", method = RequestMethod.GET)
Expand Down

0 comments on commit 7c394bb

Please sign in to comment.