Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Set up Google Java style guide linter as CI step #162

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: checkstyle

on: pull_request

jobs:
checkstyle_job:
runs-on: ubuntu-latest
name: Checkstyle job
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run check style
uses: nikitasavinov/checkstyle-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: 'github-pr-check'
level: error
fail_on_error: true
workdir: src
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,46 @@

@DgsComponent
public class BookDataFetcher {
private final BookService bookService;

public BookDataFetcher(BookService bookService) {
this.bookService = bookService;
}
private final BookService bookService;

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindAllBooks)
public List<Book> findAllBooks() {
return bookService.findAll();
}
public BookDataFetcher(BookService bookService) {
this.bookService = bookService;
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindBookByIsbn13)
public Book findBookByIsbn13(@InputArgument(DgsConstants.BOOK.Isbn13) String isbn13) {
return bookService.findBookByIsbn13(isbn13);
}
@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindAllBooks)
public List<Book> findAllBooks() {
return bookService.findAll();
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByAuthor)
public List<Book> findByAuthor(@InputArgument(DgsConstants.AUTHOR.FullName) String fullName) {
return bookService.findByAuthor(fullName);
}
@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindBookByIsbn13)
public Book findBookByIsbn13(@InputArgument(DgsConstants.BOOK.Isbn13) String isbn13) {
return bookService.findBookByIsbn13(isbn13);
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByPublisher)
public List<Book> findByPublisher(@InputArgument(DgsConstants.PUBLISHER.Name) String publisherName) {
return bookService.findByPublisher(publisherName);
}
@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByAuthor)
public List<Book> findByAuthor(@InputArgument(DgsConstants.AUTHOR.FullName) String fullName) {
return bookService.findByAuthor(fullName);
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByTitleIgnoreCase)
public List<Book> findByTitle(@InputArgument(DgsConstants.BOOK.Title) String title) {
return bookService.findByTitle(title);
}
@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByPublisher)
public List<Book> findByPublisher(
@InputArgument(DgsConstants.PUBLISHER.Name) String publisherName) {
return bookService.findByPublisher(publisherName);
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByGenre)
public List<Book> findByGenre(@InputArgument(DgsConstants.GENRE.Name) GenreName genreName) {
return bookService.findByGenre(genreName);
}
@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByTitleIgnoreCase)
public List<Book> findByTitle(@InputArgument(DgsConstants.BOOK.Title) String title) {
return bookService.findByTitle(title);
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByAwardName)
public List<Book> findByAward(@InputArgument(DgsConstants.AWARD.AwardName) String awardName) {
return bookService.findByAward(awardName);
}
@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByGenre)
public List<Book> findByGenre(@InputArgument(DgsConstants.GENRE.Name) GenreName genreName) {
return bookService.findByGenre(genreName);
}

@DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.FindByAwardName)
public List<Book> findByAward(@InputArgument(DgsConstants.AWARD.AwardName) String awardName) {
return bookService.findByAward(awardName);
}
}