Skip to content

Commit

Permalink
Fixed code analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
credfeto committed Jan 15, 2024
1 parent b3f3c6a commit 8e271e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release
- Dependencies - Updated Nullable.Extended.Analyzer to 1.15.6169
- Dependencies - Updated FunFair.Test.Common to 6.1.27.296
- Dependencies - Updated Meziantou.Analyzer to 2.0.132
- SDK - Updated DotNet SDK to 8.0.101
### Removed
### Removed
- Nothing
### Deployment Changes
Expand Down
24 changes: 5 additions & 19 deletions src/Experiments/Implementations/HashedContentOptimizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ private static void EnsureFolderExists(string destinationPath)
}
}

private void ChangeReferencesInNonRenamableTextFiles(IReadOnlyList<StrippedFile> fixedNameTextFiles,
Dictionary<string, string> textFiles,
Dictionary<string, string> fileHashes)
private void ChangeReferencesInNonRenamableTextFiles(IReadOnlyList<StrippedFile> fixedNameTextFiles, Dictionary<string, string> textFiles, Dictionary<string, string> fileHashes)
{
this._logger.LogInformation("Changing references in non-renamable text files");

Expand Down Expand Up @@ -289,7 +287,7 @@ private void ReplaceTextFilesInRenamableTextFiles(IReadOnlyList<StrippedFile> re

foreach (StrippedFile referencedFile in renamableTextFiles)
{
if (referencedFile.Path == file.Path)
if (StringComparer.Ordinal.Equals(x: referencedFile.Path, y: file.Path))
{
continue;
}
Expand Down Expand Up @@ -349,11 +347,7 @@ private void AddRemainingRenamableFiles(IReadOnlyList<StrippedFile> renamableTex
}
}

private void MakeReplacement(IReadOnlyList<StrippedFile> renamableTextFiles,
Dictionary<string, string> fileHashes,
Dictionary<string, string> textFiles,
StrippedFile file,
string newHashedPath)
private void MakeReplacement(IReadOnlyList<StrippedFile> renamableTextFiles, Dictionary<string, string> fileHashes, Dictionary<string, string> textFiles, StrippedFile file, string newHashedPath)
{
foreach (StrippedFile referencing in renamableTextFiles)
{
Expand All @@ -366,11 +360,7 @@ private void MakeReplacement(IReadOnlyList<StrippedFile> renamableTextFiles,
string newRelative = PathHelpers.GetRelativePath(documentFullPath: referencing.Path, referencedFileFullPath: newHashedPath);
string referencingContent = textFiles[referencing.Path];

bool changed = this.ChangeContent(relative: relativeInReferencing,
newRelative: newRelative,
hashedFilePath: file.Path,
newHashedPath: newHashedPath,
content: ref referencingContent);
bool changed = this.ChangeContent(relative: relativeInReferencing, newRelative: newRelative, hashedFilePath: file.Path, newHashedPath: newHashedPath, content: ref referencingContent);

if (changed)
{
Expand Down Expand Up @@ -426,11 +416,7 @@ private void ReplaceBinaryFilesInTextFiles(IReadOnlyList<StrippedFile> renamable
string relative = PathHelpers.GetRelativePath(documentFullPath: file.Path, referencedFileFullPath: binaryFile.Path);
string newRelative = string.Concat(relative.AsSpan(start: 0, relative.Length - binaryFile.FileName.Length), str1: hashedBinary);

hasChange |= this.ChangeContent(relative: relative,
newRelative: newRelative,
hashedFilePath: binaryFile.Path,
newHashedPath: hashedBinary,
content: ref content);
hasChange |= this.ChangeContent(relative: relative, newRelative: newRelative, hashedFilePath: binaryFile.Path, newHashedPath: hashedBinary, content: ref content);
}

if (hasChange)
Expand Down

0 comments on commit 8e271e0

Please sign in to comment.