Skip to content

Commit 99d59c1

Browse files
fix: lints & copyright dates
1 parent 5d0584f commit 99d59c1

File tree

3 files changed

+21
-34
lines changed

3 files changed

+21
-34
lines changed

OptimizelySDK.Tests/DecisionServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void SetUp()
6666
ErrorHandlerMock.Object, null, LoggerMock.Object);
6767
DecisionServiceMock = new Mock<DecisionService>(BucketerMock.Object,
6868
ErrorHandlerMock.Object, null, LoggerMock.Object)
69-
{ CallBase = true };
69+
{ CallBase = true };
7070
DecisionReasons = new DecisionReasons();
7171

7272
VariationWithKeyControl =

OptimizelySDK/Bucketing/DecisionService.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ ProjectConfig config
264264
if (experimentToVariationMap.ContainsKey(experimentId) == false)
265265
{
266266
Logger.Log(LogLevel.DEBUG,
267-
$@"No experiment ""{experimentKey}"" mapped to user ""{userId
268-
}"" in the forced variation map.");
267+
$@"No experiment ""{experimentKey}"" mapped to user ""{userId}"" in the forced variation map.");
269268
return Result<Variation>.NullResult(reasons);
270269
}
271270

@@ -274,8 +273,7 @@ ProjectConfig config
274273
if (string.IsNullOrEmpty(variationId))
275274
{
276275
Logger.Log(LogLevel.DEBUG,
277-
$@"No variation mapped to experiment ""{experimentKey
278-
}"" in the forced variation map.");
276+
$@"No variation mapped to experiment ""{experimentKey}"" in the forced variation map.");
279277
return Result<Variation>.NullResult(reasons);
280278
}
281279

@@ -288,8 +286,7 @@ ProjectConfig config
288286
}
289287

290288
Logger.Log(LogLevel.DEBUG,
291-
reasons.AddInfo($@"Variation ""{variationKey}"" is mapped to experiment ""{
292-
experimentKey}"" and user ""{userId}"" in the forced variation map"));
289+
reasons.AddInfo($@"Variation ""{variationKey}"" is mapped to experiment ""{experimentKey}"" and user ""{userId}"" in the forced variation map"));
293290

294291
var variation = config.GetVariationFromKey(experimentKey, variationKey);
295292

@@ -333,8 +330,7 @@ ProjectConfig config
333330
}
334331

335332
Logger.Log(LogLevel.DEBUG,
336-
$@"Variation mapped to experiment ""{experimentKey
337-
}"" has been removed for user ""{userId}"".");
333+
$@"Variation mapped to experiment ""{experimentKey}"" has been removed for user ""{userId}"".");
338334
return true;
339335
}
340336

@@ -356,8 +352,7 @@ ProjectConfig config
356352
ForcedVariationMap[userId][experimentId] = variationId;
357353

358354
Logger.Log(LogLevel.DEBUG,
359-
$@"Set variation ""{variationId}"" for experiment ""{experimentId}"" and user ""{
360-
userId}"" in the forced variation map.");
355+
$@"Set variation ""{variationId}"" for experiment ""{experimentId}"" and user ""{userId}"" in the forced variation map.");
361356
return true;
362357
}
363358

OptimizelySDK/Optimizely.cs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023, Optimizely
2+
* Copyright 2017-2024, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use file except in compliance with the License.
@@ -573,8 +573,7 @@ public virtual bool IsFeatureEnabled(string featureKey, string userId,
573573
else
574574
{
575575
Logger.Log(LogLevel.INFO,
576-
$@"The user ""{userId}"" is not being experimented on feature ""{featureKey
577-
}"".");
576+
$@"The user ""{userId}"" is not being experimented on feature ""{featureKey}"".");
578577
}
579578
}
580579

@@ -624,8 +623,7 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
624623
if (config == null)
625624
{
626625
Logger.Log(LogLevel.ERROR,
627-
$@"Datafile has invalid format. Failing '{
628-
FeatureVariable.GetFeatureVariableTypeName(variableType)}'.");
626+
$@"Datafile has invalid format. Failing '{FeatureVariable.GetFeatureVariableTypeName(variableType)}'.");
629627
return default;
630628
}
631629

@@ -649,15 +647,13 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
649647
if (featureVariable == null)
650648
{
651649
Logger.Log(LogLevel.ERROR,
652-
$@"No feature variable was found for key ""{variableKey}"" in feature flag ""{
653-
featureKey}"".");
650+
$@"No feature variable was found for key ""{variableKey}"" in feature flag ""{featureKey}"".");
654651
return default;
655652
}
656653
else if (featureVariable.Type != variableType)
657654
{
658655
Logger.Log(LogLevel.ERROR,
659-
$@"Variable is of type ""{featureVariable.Type
660-
}"", but you requested it as type ""{variableType}"".");
656+
$@"Variable is of type ""{featureVariable.Type}"", but you requested it as type ""{variableType}"".");
661657
return default;
662658
}
663659

@@ -681,28 +677,24 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
681677
{
682678
variableValue = featureVariableUsageInstance.Value;
683679
Logger.Log(LogLevel.INFO,
684-
$@"Got variable value ""{variableValue}"" for variable ""{variableKey
685-
}"" of feature flag ""{featureKey}"".");
680+
$@"Got variable value ""{variableValue}"" for variable ""{variableKey}"" of feature flag ""{featureKey}"".");
686681
}
687682
else
688683
{
689684
Logger.Log(LogLevel.INFO,
690-
$@"Feature ""{featureKey}"" is not enabled for user {userId
691-
}. Returning the default variable value ""{variableValue}"".");
685+
$@"Feature ""{featureKey}"" is not enabled for user {userId}. Returning the default variable value ""{variableValue}"".");
692686
}
693687
}
694688
else
695689
{
696690
Logger.Log(LogLevel.INFO,
697-
$@"Variable ""{variableKey}"" is not used in variation ""{variation.Key
698-
}"", returning default value ""{variableValue}"".");
691+
$@"Variable ""{variableKey}"" is not used in variation ""{variation.Key}"", returning default value ""{variableValue}"".");
699692
}
700693
}
701694
else
702695
{
703696
Logger.Log(LogLevel.INFO,
704-
$@"User ""{userId}"" is not in any variation for feature flag ""{featureKey
705-
}"", returning default value ""{variableValue}"".");
697+
$@"User ""{userId}"" is not in any variation for feature flag ""{featureKey}"", returning default value ""{variableValue}"".");
706698
}
707699

708700
var sourceInfo = new Dictionary<string, string>();
@@ -951,12 +943,12 @@ internal Dictionary<string, OptimizelyDecision> DecideForKeys(OptimizelyUserCont
951943

952944
var decisionReasons = new DecisionReasons();
953945
decisionReasonsMap.Add(key, decisionReasons);
954-
946+
955947
var optimizelyDecisionContext = new OptimizelyDecisionContext(key);
956948
var forcedDecisionVariation =
957949
DecisionService.ValidatedForcedDecision(optimizelyDecisionContext, projectConfig, user);
958950
decisionReasons += forcedDecisionVariation.DecisionReasons;
959-
951+
960952
if (forcedDecisionVariation.ResultObject != null)
961953
{
962954
flagDecisions.Add(key, new FeatureDecision(null,
@@ -1040,7 +1032,7 @@ ProjectConfig projectConfig
10401032
decisionSource = flagDecision.Source;
10411033
}
10421034

1043-
var includeReasons= allOptions.Contains(OptimizelyDecideOption.INCLUDE_REASONS);
1035+
var includeReasons = allOptions.Contains(OptimizelyDecideOption.INCLUDE_REASONS);
10441036
var reasonsToReport = decisionReasons.ToReport(includeReasons).ToArray();
10451037
var variationKey = flagDecision.Variation?.Key;
10461038
// TODO: add ruleKey values when available later. use a copy of experimentKey until then.
@@ -1071,8 +1063,8 @@ ProjectConfig projectConfig
10711063
{ "reasons", reasonsToReport },
10721064
{ "decisionEventDispatched", decisionEventDispatched },
10731065
};
1074-
1075-
NotificationCenter.SendNotifications(NotificationCenter.NotificationType.Decision,
1066+
1067+
NotificationCenter.SendNotifications(NotificationCenter.NotificationType.Decision,
10761068
DecisionNotificationTypes.FLAG, userId, user.GetAttributes(), decisionInfo);
10771069

10781070
return new OptimizelyDecision(
@@ -1114,7 +1106,7 @@ private Result<Dictionary<string, object>> GetDecisionVariableMap(FeatureFlag fl
11141106

11151107
valuesMap[variable.Key] = convertedValue;
11161108
}
1117-
1109+
11181110
return Result<Dictionary<string, object>>.NewResult(valuesMap, reasons);
11191111
}
11201112

0 commit comments

Comments
 (0)