You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was reading how XcodeGen works and I noticed an improvement using early break in loops on SpecValidation.validateSettings that can be done.
Snipped of code that I would change
My points to consider here:
Reduce nested if, the condition on line 23 errors.append(.invalidBuildSettingConfig(config)) happens when line 21 and 22 it's true, so don't need to have 2 ifs, instead can be only 1 with 2 validations.
Early break in loops
2.1. On loop in line 32, once the validation at line 33 it's true, in line 34 sets isConfig = true and isConfig will never be false in the rest of iteration of line 32, so it's no longer necessary iterate over the rest
2.2. Using the same idea on 2.1, on the outer loop at line 30, once the validation at line 37 it's true, in line 38 sets allConfigs = false and allConfigs will never be true again. So the outer loop can be stopped.
The text was updated successfully, but these errors were encountered:
Descrição:
Hello there, it's my first time here!
I was reading how XcodeGen works and I noticed an improvement using early break in loops on
SpecValidation.validateSettings
that can be done.Snipped of code that I would change
My points to consider here:
errors.append(.invalidBuildSettingConfig(config))
happens when line 21 and 22 it's true, so don't need to have 2 ifs, instead can be only 1 with 2 validations.2.1. On loop in line 32, once the validation at line 33 it's true, in line 34 sets
isConfig = true
and isConfig will never be false in the rest of iteration of line 32, so it's no longer necessary iterate over the rest2.2. Using the same idea on 2.1, on the outer loop at line 30, once the validation at line 37 it's true, in line 38 sets
allConfigs = false
and allConfigs will never be true again. So the outer loop can be stopped.The text was updated successfully, but these errors were encountered: