Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PxWeb/Mappers/DatasetMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class DatasetMapper : IDatasetMapper
{
private readonly ILinkCreator _linkCreator;
private readonly PxApiConfigurationOptions _configOptions;

Check warning on line 21 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Remove the field '_configOptions' and declare it as a local variable in the relevant methods. (https://rules.sonarsource.com/csharp/RSPEC-1450)

Check warning on line 21 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Remove the field '_configOptions' and declare it as a local variable in the relevant methods. (https://rules.sonarsource.com/csharp/RSPEC-1450)
private readonly ILogger _logger;
private string _language;

Expand All @@ -32,7 +32,7 @@
_logger = logger;
}

public Dataset Map(PXModel model, string id, string language)

Check warning on line 35 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Refactor this method to reduce its Cognitive Complexity from 25 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)

Check warning on line 35 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Refactor this method to reduce its Cognitive Complexity from 25 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)
{

_language = language;
Expand Down Expand Up @@ -141,7 +141,7 @@
//Codelists
var codeLists = new System.Collections.Generic.List<CodelistInformation>();
MapCodelists(codeLists, variable);
if (codeLists != null)

Check warning on line 144 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)

Check warning on line 144 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
DatasetSubclass.AddCodelist(dimensionValue, codeLists);
}
Expand Down Expand Up @@ -318,7 +318,7 @@

private static void AddPxToExtension(PXModel model, DatasetSubclass dataset)
{
// TODO should we have included both Decimals and ShowDecimals?

Check warning on line 321 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 321 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 321 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
var decimals = model.Meta.ShowDecimals < 0 ? model.Meta.Decimals : model.Meta.ShowDecimals;

dataset.AddInfoFile(model.Meta.InfoFile);
Expand All @@ -329,7 +329,7 @@
dataset.AddDescriptiondefault(model.Meta.DescriptionDefault);
dataset.AddStub(model.Meta.Stub.Select(v => v.Code).ToList());
dataset.AddHeading(model.Meta.Heading.Select(v => v.Code).ToList());
dataset.AddLanguage(model.Meta.Language);
dataset.AddLanguage(model.Meta.CurrentLanguage);
dataset.AddOfficialStatistics(model.Meta.OfficialStatistics);
dataset.AddCopyright(model.Meta.Copyright);
dataset.AddMatrix(model.Meta.Matrix);
Expand Down Expand Up @@ -498,7 +498,7 @@

var contacts = contactString.Split(new[] { "##" }, StringSplitOptions.RemoveEmptyEntries);

foreach (var contact in contacts)

Check warning on line 501 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Loops should be simplified using the "Where" LINQ method (https://rules.sonarsource.com/csharp/RSPEC-3267)

Check warning on line 501 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Loops should be simplified using the "Where" LINQ method (https://rules.sonarsource.com/csharp/RSPEC-3267)
{
if (!dataset.Extension.Contact.Exists(x => x.Raw.Equals(contact)))
{
Expand Down Expand Up @@ -583,9 +583,9 @@



// TODO: HIERARCHIES(“Country”)="parent","parent":"child", (I think child in dimention for jsonstat)

Check warning on line 586 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 586 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 586 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

// TODO: the below is cloned from TableMetadataResponseMapper, should be moved to common class

Check warning on line 588 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 588 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)



Expand Down Expand Up @@ -627,7 +627,7 @@

if (variable.HasValuesets())
{
foreach (var valueset in variable.ValueSets)

Check warning on line 630 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Loops should be simplified using the "Where" LINQ method (https://rules.sonarsource.com/csharp/RSPEC-3267)

Check warning on line 630 in PxWeb/Mappers/DatasetMapper.cs

View workflow job for this annotation

GitHub Actions / build

Loops should be simplified using the "Where" LINQ method (https://rules.sonarsource.com/csharp/RSPEC-3267)
{
if (!valueset.ID.Equals("_ALL_"))
{
Expand Down