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

Efficiency enhancements #1829

Merged
merged 26 commits into from
Jun 3, 2024
Merged

Efficiency enhancements #1829

merged 26 commits into from
Jun 3, 2024

Conversation

jas88
Copy link
Member

@jas88 jas88 commented May 17, 2024

Proposed Change

Summarise your proposed changes here, including any notes for reviewers.

Type of change

What types of changes does your code introduce? Tick all that apply.

  • Bugfix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation-Only Update
  • Other (if none of the other choices apply)

Checklist

By opening this PR, I confirm that I have:

  • Ensured that the PR branch is in sync with the target branch (i.e. it is automatically merge-able)
  • Created or updated any tests if relevant
  • Have validated this change against the Test Plan
  • Requested a review by one of the repository maintainers
  • Have written new documentation or updated existing documentation to detail any new or updated functionality and how to use it
  • Have added an entry into the changelog

jas88 added 26 commits May 16, 2024 12:42
Eliminate double-searching of CommentStore
Clearer variable type, remove redundant casts
Make callbacks static for simplicity
Join declaration and initialisation
Simplify list generation logic
Remove redundant counting of list size
Avoid thread-thrashing if yes or no to all has been clicked
Fix duplicate Dispose calls
Make fake conditional value a constant
String interpolation, object initialisers
@jas88 jas88 requested a review from JFriel May 17, 2024 01:40
Comment on lines 44 to +48
foreach (var f in selected)
using (var stream = File.Open(f.FullName, FileMode.Open))
{
shareManager.ImportSharedObject(stream);
}
{
using var stream = File.Open(f.FullName, FileMode.Open);
shareManager.ImportSharedObject(stream);
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Select Note

This foreach loop immediately
maps its iteration variable to another variable
- consider mapping the sequence explicitly using '.Select(...)'.
Comment on lines 47 to +51
foreach (var xml in Directory.EnumerateFiles(location, "*.xml", SearchOption.AllDirectories))
using (var content = File.OpenRead(xml))
{
ReadComments(content);
}
{
using var content = File.OpenRead(xml);
ReadComments(content);
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Select Note

This foreach loop immediately
maps its iteration variable to another variable
- consider mapping the sequence explicitly using '.Select(...)'.
Comment on lines +98 to +103
foreach (var zipFile in new[] { zipArchive }.Union(SupplementalSourceZipFiles).Where(static zipFile => zipFile.Exists))
{
using var z = ZipFile.OpenRead(zipFile.FullName);
foreach (var entry in z.Entries)
entries.Add(entry.Name);
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Select Note

This foreach loop immediately
maps its iteration variable to another variable
- consider mapping the sequence explicitly using '.Select(...)'.
@@ -69,7 +69,7 @@
return;
}

_alreadyMarkedInConfiguration = _selectedDataSetColumns.Where(c => Getter(c)).ToArray();
_alreadyMarkedInConfiguration = _selectedDataSetColumns.Where(Getter).ToArray();

Check warning

Code scanning / CodeQL

Virtual call in constructor or destructor Warning

Avoid virtual calls in a constructor or destructor.
@@ -81,7 +81,7 @@
return;
}

_alreadyMarked = _extractionInformations.Where(c => Getter(c)).ToArray();
_alreadyMarked = _extractionInformations.Where(Getter).ToArray();

Check warning

Code scanning / CodeQL

Virtual call in constructor or destructor Warning

Avoid virtual calls in a constructor or destructor.
@@ -80,19 +80,18 @@
/// <inheritdoc/>
public override bool Equals(object obj)
{
if (obj is QueryTimeColumn == false)
throw new Exception(".Equals only works for objects of type QueryTimeColumn");
if (obj is QueryTimeColumn other)

Check warning

Code scanning / CodeQL

Equals should not apply "is" Warning

QueryTimeColumn.Equals(object) should not use "is" on its parameter, as it will not work properly for subclasses of QueryTimeColumn.
@JFriel JFriel merged commit a1b76c9 into develop Jun 3, 2024
6 checks passed
@JFriel JFriel deleted the feature/efficiency branch June 3, 2024 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants