Skip to content
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

implementation smells and design smells refactored #499

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added DesigniteJava.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions Smells/DesigniteLog21112023_0836.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Extracting code smells...
Done.
267 changes: 267 additions & 0 deletions Smells/designCodeSmells.csv

Large diffs are not rendered by default.

483 changes: 483 additions & 0 deletions Smells/implementationCodeSmells.csv

Large diffs are not rendered by default.

2,136 changes: 2,136 additions & 0 deletions Smells/methodMetrics.csv

Large diffs are not rendered by default.

260 changes: 260 additions & 0 deletions Smells/typeMetrics.csv

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,17 @@
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,29 @@ void visitArraySchema(ArraySchema arraySchema) {
.ifPresent(owner::failure);
}

@Override void visitAdditionalItems(boolean additionalItems) {
// @Override void visitAdditionalItems(boolean additionalItems) {
// List<Schema> itemSchemas = arraySchema.getItemSchemas();
// int itemSchemaCount = itemSchemas == null ? 0 : itemSchemas.size();
// if (itemSchemas != null && !additionalItems && subjectLength > itemSchemaCount) {
// owner.failure(format("expected: [%d] array items, found: [%d]", itemSchemaCount, subjectLength), "items");
// }
// }


@Override
void visitAdditionalItems(boolean additionalItems) {
List<Schema> itemSchemas = arraySchema.getItemSchemas();
int itemSchemaCount = itemSchemas == null ? 0 : itemSchemas.size();
if (itemSchemas != null && !additionalItems && subjectLength > itemSchemaCount) {
if (shouldFailForAdditionalItems(additionalItems, itemSchemas, itemSchemaCount)) {
owner.failure(format("expected: [%d] array items, found: [%d]", itemSchemaCount, subjectLength), "items");
}
}

private boolean shouldFailForAdditionalItems(boolean additionalItems, List<Schema> itemSchemas, int itemSchemaCount) {
return itemSchemas != null && !additionalItems && subjectLength > itemSchemaCount;
}


@Override void visitSchemaOfAdditionalItems(Schema schemaOfAdditionalItems) {
if (schemaOfAdditionalItems == null || arraySchema.getItemSchemas() == null) {
return;
Expand Down