Skip to content

Cmd add modality - #340

Draft
jas88 wants to merge 2 commits into
developfrom
cmd-add-modality
Draft

Cmd add modality#340
jas88 wants to merge 2 commits into
developfrom
cmd-add-modality

Conversation

@jas88

@jas88 jas88 commented Mar 18, 2023

Copy link
Copy Markdown
Contributor

Add a function to populate a new modality

}

var study = template.Tables.Single(t => t.TableName.Equals(StudyTable));
var series = template.Tables.Single(t => t.TableName.Equals(SeriesTable));

Check warning

Code scanning / CodeQL

Useless assignment to local variable

This assignment to [series](1) is useless, since its value is never read.

var study = template.Tables.Single(t => t.TableName.Equals(StudyTable));
var series = template.Tables.Single(t => t.TableName.Equals(SeriesTable));
var image = template.Tables.Single(t => t.TableName.Equals(ImageTable));

Check warning

Code scanning / CodeQL

Useless assignment to local variable

This assignment to [image](1) is useless, since its value is never read.
private readonly DiscoveredDatabase _live;
private readonly LoadMetadata _lmd;
private readonly string _prefix;
private ExecuteCommandCreateNewImagingDatasetSuite _schemaCreationCommand;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity

Field '_schemaCreationCommand' can be 'readonly'.
Comment on lines +37 to +41
catch (Exception ex)
{
SetImpossible($"Could not get single live server from the LoadMetadata {lmd} :" + ex);
return;
}

Check notice

Code scanning / CodeQL

Generic catch clause

Generic catch clause.
Comment on lines +49 to +56
if (modality.EndsWith("_"))
{
_prefix = modality;
}
else
{
_prefix = modality + "_";
}

Check notice

Code scanning / CodeQL

Missed ternary opportunity

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
Comment on lines +78 to +85
foreach (var n in new[] { StudyTable, SeriesTable, ImageTable })
{
if (template.Tables.Any(t => t.TableName.Equals(n)))
{
SetImpossible($"Template did not contain an expected table name: {n}. Table names in template were {string.Join(",", template.Tables.Select(t => t.TableName))}");
return;
}
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Where

This foreach loop [implicitly filters its target sequence](1) - consider filtering the sequence explicitly using '.Where(...)'.
}
}

var study = template.Tables.Single(t => t.TableName.Equals(StudyTable));

Check warning

Code scanning / CodeQL

Useless assignment to local variable

This assignment to [study](1) is useless, since its value is never read.
@jas88
jas88 marked this pull request as draft March 20, 2023 18:11
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