Skip to content

Commit

Permalink
add intellij reformatter on pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
breed committed May 14, 2024
1 parent 0007fa9 commit e52e1c3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/reformat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Re-format Code

on:
pull_request:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Install IntelliJ IDEA
run: |
wget -q -O idea.tar.gz https://download.jetbrains.com/idea/ideaIC-2024.1.1.tar.gz
tar -xzf idea.tar.gz
- name: Format code
run: |
./*/bin/format.sh -m *.java -r .
- name: Commit changes
run: |
git config user.name 'github-actions[bot]'
git config user.email "github-actions[bot]@users.noreply.github.com
git commit -a -m "Auto-format code"
git push
10 changes: 8 additions & 2 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ public ResponseEntity<List<UserList>> getApiV1Lists(Principal user) {
}

@GetMapping("/api/v1/markers")
public Mono<ResponseEntity<Map<String, Marker>>> getApiV1Markers(Principal user, @RequestParam(name =
"timeline" + "[]") List<String> timeline) {
public Mono<ResponseEntity<Map<String, Marker>>> getApiV1Markers(Principal user, @RequestParam(name = "timeline[]")
List<String> timeline) {
if (user == null) return Mono.just(ResponseEntity.status(HttpStatus.UNAUTHORIZED).build());
return timelineService.getMarkersForUser(user.getName(), timeline).map(ResponseEntity::ok);
}

@PostMapping("/api/v1/markers")
public Mono<ResponseEntity<Map<String, Marker>>> postApiV1Markers(Principal user, @RequestParam(name = "home" +
"[last_read_id]", required = false) String homeLast, @RequestParam(name = "notifications[last_read_id]",
required = false) String notificationsLast) {
"[last_read_id]", required = false) String homeLast, @RequestParam(name = "notifications" +
"[last_read_id]", required = false) String notificationsLast) {
if (user == null) return Mono.just(ResponseEntity.status(HttpStatus.UNAUTHORIZED).build());
return timelineService.setMarkerForUser(user.getName(), homeLast, notificationsLast).map(ResponseEntity::ok);
}
Expand All @@ -54,7 +54,8 @@ Mono<ResponseEntity<List<Status>>> getApiV1TimelinesHome(Principal user,
@RequestParam(required = false) String max_id,
@RequestParam(required = false) String since_id,
@RequestParam(required = false) String min_id,
@RequestParam(required = false, defaultValue = "20") int limit) {
@RequestParam(required = false, defaultValue = "20")
int limit) {
return statusService.getTimeline(user, max_id, since_id, min_id, limit, false).map(ResponseEntity::ok);
}
}

0 comments on commit e52e1c3

Please sign in to comment.