Giter Site home page Giter Site logo

fitbuddy's People

Contributors

05786k avatar allcontributors[bot] avatar cerrussell avatar dmitriydb avatar gaurav9777 avatar haseeb-xd avatar hrandhawa13 avatar keer-0 avatar mandalia-ravi avatar maximovincente avatar mepox avatar mtorres6739 avatar swethatamatam avatar ujwalkumar1995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fitbuddy's Issues

Return an empty collection instead of null in `ExerciseController`

Sonar issue link

Compliant solution: return Collections.emptyList();

@GetMapping
public List<ExerciseDto> readAll() {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
AppUserDto appUserDto = appUserCrudService.readByName(auth.getName());
if (appUserDto != null && appUserDto.getId() != null) {
List<ExerciseDto> dtos = exerciseCrudService.readMany(appUserDto.getId());
logger.info("Sending a list of exercises.");
return dtos;
}
return null;
}

Remove auth null checks in `HistoryController` methods

Auth null check is unnecessary as the @PreAuthorize("authenticated") annotation should make sure the methods cannot be called by anonymous users.

Remove auth != null from all these:

Remove these 'public' modifiers in `RegisterControllerTest`

Sonar issue link

public void register_whenInputIsCorrect_shouldReturnOk() throws Exception {

public void register_whenNameSizeNotCorrect_shouldReturnBadRequest(String name) throws Exception {

public void register_whenPasswordSizeNotCorrect_shouldReturnBadRequest(String password) throws Exception {

Use the built-in formatting to construct this arguments in `HistoryController.java`

Link to Sonar issue

Compliant Solution example:
logger.info("The message text here: {}", historyDto);

logger.info("Creating new history: " + historyDto);

Remove auth null checks in `ExerciseController` methods

Auth null check is unnecessary as the @PreAuthorize("authenticated") annotation should make sure the methods cannot be called by anonymous users.

Remove auth != null from all these:

Use the built-in formatting to construct this arguments in `ExerciseController.java`

Link to Sonar issue

Compliant Solution example:
logger.info("The message text here: {}", exerciseDto);

logger.info("Creating new exercise: " + exerciseDto);

logger.info("Updating the exercise: " + exerciseDto);

Return an empty collection instead of null in `HistoryController`

Sonar issue link

Compliant solution: return Collections.emptyList();

@GetMapping("{date}")
public List<HistoryDto> readAll(@PathVariable("date") String strDate) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (strDate != null) {
try {
LocalDate.parse(strDate);
} catch (DateTimeParseException e) {
throw new FitBuddyException(DATE_NOT_VALID);
}
AppUserDto appUserDto = appUserCrudService.readByName(auth.getName());
if (appUserDto != null && appUserDto.getId() != null) {
List<HistoryDto> historyDtos = historyCrudService.readMany(appUserDto.getId(), strDate);
logger.info("Sending a history for: {}", strDate);
return historyDtos;
}
}
return null;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.