Skip to content

Fix all checkstyle errors #608

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

Merged
merged 3 commits into from
May 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
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ default PathItem description(String description) {
* definition of a GET operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem GET(Operation get) {
setGET(get);
return this;
Expand Down Expand Up @@ -147,6 +148,7 @@ default PathItem GET(Operation get) {
* definition of a PUT operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem PUT(Operation put) {
setPUT(put);
return this;
Expand Down Expand Up @@ -174,6 +176,7 @@ default PathItem PUT(Operation put) {
* definition of a PUT operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem POST(Operation post) {
setPOST(post);
return this;
Expand Down Expand Up @@ -201,6 +204,7 @@ default PathItem POST(Operation post) {
* definition of a DELETE operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem DELETE(Operation delete) {
setDELETE(delete);
return this;
Expand Down Expand Up @@ -228,6 +232,7 @@ default PathItem DELETE(Operation delete) {
* definition of an OPTIONS operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem OPTIONS(Operation options) {
setOPTIONS(options);
return this;
Expand Down Expand Up @@ -255,6 +260,7 @@ default PathItem OPTIONS(Operation options) {
* definition of a HEAD operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem HEAD(Operation head) {
setHEAD(head);
return this;
Expand Down Expand Up @@ -282,6 +288,7 @@ default PathItem HEAD(Operation head) {
* definition of a PATCH operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem PATCH(Operation patch) {
setPATCH(patch);
return this;
Expand Down Expand Up @@ -309,6 +316,7 @@ default PathItem PATCH(Operation patch) {
* definition of a TRACE operation
* @return the current PathItem instance
**/
@SuppressWarnings("checkstyle:methodname")
default PathItem TRACE(Operation trace) {
setTRACE(trace);
return this;
Expand Down Expand Up @@ -420,4 +428,4 @@ default PathItem parameters(List<Parameter> parameters) {
**/
void removeParameter(Parameter parameter);

}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile-parent</artifactId>
<version>2.8</version>
<version>2.9-RC1</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to update this before release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #623 so we don't forget to do the update.

</parent>

<groupId>org.eclipse.microprofile.openapi</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.microprofile.openapi.apps.airlines.model.User;

public class UserData {
static List<User> users = new ArrayList<User>();
static private List<User> users = new ArrayList<User>();

static {
users.add(createUser(1, "Bob1", "pswd", "Bob", "Smith", "male", 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public static Airline getRandomAirline() {
@Extension(name = "x-boolean-property", value = "true", parseValue = true),
@Extension(name = "x-number-property", value = "117", parseValue = true),
@Extension(name = "x-object-property",
value = "{ \"property-1\" : \"value-1\", \"property-2\" : \"value-2\", \"property-3\" : { \"prop-3-1\" : 17, \"prop-3-2\" : true } }",
value = "{ \"property-1\" : \"value-1\", \"property-2\" : \"value-2\","
+ " \"property-3\" : { \"prop-3-1\" : 17, \"prop-3-2\" : true } }",
parseValue = true),
@Extension(name = "x-string-array-property", value = "[ \"one\", \"two\", \"three\" ]", parseValue = true),
@Extension(name = "x-object-array-property",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.eclipse.microprofile.openapi.apps.petstore.model.Tag;

public class PetData {
static List<Pet> pets = new ArrayList<Pet>();
static List<Category> categories = new ArrayList<Category>();
static private List<Pet> pets = new ArrayList<Pet>();
static private List<Category> categories = new ArrayList<Category>();

static {
categories.add(createCategory(1, "Dogs"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.eclipse.microprofile.openapi.apps.petstore.model.Order;

public class StoreData {
static List<Order> orders = new ArrayList<Order>();
private static List<Order> orders = new ArrayList<Order>();

static {
orders.add(createOrder(1, 1, 2, new Date(), "placed"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.microprofile.openapi.apps.petstore.model.User;

public class UserData {
static List<User> users = new ArrayList<User>();
private static List<User> users = new ArrayList<User>();

static {
users.add(createUser(1, "user1", "first name 1", "last name 1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class ApiResponse {
public static final int OK = 4;
public static final int TOO_BUSY = 5;

int code;
String type;
String message;
private int code;
private String type;
private String message;

public ApiResponse() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@XmlRootElement(name = "Cat")
public class Cat extends Pet {

String catBreed;
private String catBreed;

public String getCatBreed() {
return catBreed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@XmlRootElement(name = "Dog")
public class Dog extends Pet {

String dogBreed;
private String dogBreed;

public String getDogBreed() {
return dogBreed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@XmlRootElement(name = "Lizard")
public class Lizard extends Pet {

String lizardBreed;
private String lizardBreed;

public String getLizardBreed() {
return lizardBreed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
})
public class PetResource {

static PetData petData = new PetData();
static private PetData petData = new PetData();

@GET
@Path("/{petId}")
Expand Down Expand Up @@ -168,6 +168,7 @@ public Response deletePet(
@APIResponse(responseCode = "400", description = "Invalid input",
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ApiResponse.class)))
@SuppressWarnings("checkstyle:linelength")
@RequestBody(name = "pet",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class),
examples = @ExampleObject(ref = "http://example.org/petapi-examples/openapi.json#/components/examples/pet-example")),
Expand Down Expand Up @@ -203,7 +204,8 @@ public Response updatePet(
@Produces("application/json")
@Callback(name = "tagsCallback", callbackUrlExpression = "http://petstoreapp.com/pet",
operations = @CallbackOperation(method = "GET", summary = "Finds Pets by tags",
description = "Find Pets by tags; Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
description = "Find Pets by tags; Muliple tags can be provided with comma seperated strings. "
+ "Use tag1, tag2, tag3 for testing.",
responses = {
@APIResponse(responseCode = "400",
description = "Invalid tag value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
@Extension(name = "x-mp-type1", value = "true")
@Extension(name = "x-mp-type2", value = "false")
public class PetStoreResource {
static StoreData storeData = new StoreData();
static PetData petData = new PetData();
static private StoreData storeData = new StoreData();
static private PetData petData = new PetData();

@GET
@Path("/inventory")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
scheme = "bearer", bearerFormat = "JWT")
})
public class UserResource {
static UserData userData = new UserData();
private static UserData userData = new UserData();

@POST
@APIResponse(description = "successful operation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
public class MyOASModelReaderImpl implements OASModelReader {

@Override
@SuppressWarnings("checkstyle:methodlength")
public OpenAPI buildModel() {
return OASFactory.createObject(OpenAPI.class)
.info(OASFactory.createObject(Info.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1922,10 +1922,8 @@ private Map<String, Property> collectProperties(Class<?> clazz) {
p.addBuilder(m);
}
}
}
// Possible setter method
else if (returnType == Void.TYPE) {
if (name.startsWith("set") && parameterCount == 1) {
} else if (returnType == Void.TYPE) {
if (name.startsWith("set") && parameterCount == 1) { // Possible setter method
name = Introspector.decapitalize(name.substring(3));
type = m.getParameterTypes()[0];
p = properties.get(name);
Expand All @@ -1937,10 +1935,8 @@ else if (returnType == Void.TYPE) {
p.addSetter(m);
}
}
}
// Possible getter method
else {
if (name.startsWith("get") && parameterCount == 0) {
} else {
if (name.startsWith("get") && parameterCount == 0) { // Possible getter method
name = Introspector.decapitalize(name.substring(3));
type = returnType;
p = properties.get(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,16 @@ public void testAPIResponseSchemaDefaultResponseCode(String type) {
public void testExtensionPlacement(String type) {
ValidatableResponse vr = callEndpoint(type);

final String X_OPERATION_EXT = "x-operation-ext";
final String TEST_OPERATION_EXT = "test-operation-ext";
final String xOperationExt = "x-operation-ext";
final String testOperationExt = "test-operation-ext";
String opPath = "paths.'/store/inventory'.get";

vr.body(opPath, hasEntry(equalTo(X_OPERATION_EXT), equalTo(TEST_OPERATION_EXT)));
vr.body(opPath, hasEntry(equalTo(xOperationExt), equalTo(testOperationExt)));

vr.body(opPath + ".responses", hasEntry(equalTo("x-responses-ext"), equalTo("test-responses-ext")));
vr.body(opPath + ".responses.'200'", not(hasKey(X_OPERATION_EXT)));
vr.body(opPath + ".responses.'200'", not(hasKey(xOperationExt)));
vr.body(opPath + ".responses.'200'", hasEntry(equalTo("x-response-ext"), equalTo("test-response-ext")));
vr.body(opPath + ".responses.'500'", not(hasKey(X_OPERATION_EXT)));
vr.body(opPath + ".responses.'500'", not(hasKey(xOperationExt)));
vr.body(opPath + ".responses.'503'.content.'application/json'",
hasEntry(equalTo("x-notavailable-ext"), equalTo("true")));
vr.body(opPath + ".responses.'503'.content.'application/xml'",
Expand Down
Loading