Skip to content

Commit

Permalink
[894] Use the formattedCode for the formattedHash.
Browse files Browse the repository at this point in the history
resolves #894

Signed-off-by: James R. Perkins <jperkins@redhat.com>
  • Loading branch information
jamezp committed Jun 3, 2024
1 parent 21d0826 commit 5ea683e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/net/revelc/code/formatter/FormatterMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ protected void doFormatFile(final File file, final ResultCollector rc, final Pro

// Process the result type
if (Result.SKIPPED.equals(result)) {
rc.unchangedCount++;
rc.skippedCount++;
} else if (Result.SUCCESS.equals(result)) {
rc.successCount++;
} else if (Result.FAIL.equals(result)) {
Expand All @@ -806,19 +806,19 @@ protected void doFormatFile(final File file, final ResultCollector rc, final Pro
formattedHash = originalHash;
// Default to formatted hashing for unknown type otherwise include formatter options
} else if (file.getName().endsWith(".java")) {
formattedHash = this.sha512hash(originalCode + this.javaFormatter.getOptions().hashCode());
formattedHash = this.sha512hash(formattedCode + this.javaFormatter.getOptions().hashCode());
} else if (file.getName().endsWith(".js")) {
formattedHash = this.sha512hash(originalCode + this.jsFormatter.getOptions().hashCode());
formattedHash = this.sha512hash(formattedCode + this.jsFormatter.getOptions().hashCode());
} else if (file.getName().endsWith(".html")) {
formattedHash = this.sha512hash(originalCode + this.htmlFormatter.getOptions().hashCode());
formattedHash = this.sha512hash(formattedCode + this.htmlFormatter.getOptions().hashCode());
} else if (file.getName().endsWith(".xml")) {
formattedHash = this.sha512hash(originalCode + this.xmlFormatter.getOptions().hashCode());
formattedHash = this.sha512hash(formattedCode + this.xmlFormatter.getOptions().hashCode());
} else if (file.getName().endsWith(".json")) {
formattedHash = this.sha512hash(originalCode + this.jsonFormatter.getOptions().hashCode());
formattedHash = this.sha512hash(formattedCode + this.jsonFormatter.getOptions().hashCode());
} else if (file.getName().endsWith(".css")) {
formattedHash = this.sha512hash(originalCode + this.cssFormatter.getOptions().hashCode());
formattedHash = this.sha512hash(formattedCode + this.cssFormatter.getOptions().hashCode());
} else {
formattedHash = this.sha512hash(originalCode);
formattedHash = this.sha512hash(formattedCode);
}
hashCache.setProperty(path, formattedHash);
this.hashCacheWritten = true;
Expand Down

0 comments on commit 5ea683e

Please sign in to comment.