-
Notifications
You must be signed in to change notification settings - Fork 834
Add validation to ensure that settings.configs values are dictionaries, in order to prevent misuse #1547
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
Open
Ryu0118
wants to merge
23
commits into
yonaskolb:master
Choose a base branch
from
Ryu0118:validate_invalid_configs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add validation to ensure that settings.configs values are dictionaries, in order to prevent misuse #1547
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0cdd80d
Add validation to ensure settings.configs values are dictionaries to …
Ryu0118 58cdf9b
Add tests for invalid settings.configs value formats
Ryu0118 6af2709
Merge branch 'master' into validate_invalid_configs
Ryu0118 5c164b2
Replaced with filter and split into a function
Ryu0118 d90866f
Rename invalidConfigsFormat to invalidConfigsMappingFormat
Ryu0118 eac4831
Add comments to explain invalid fixture
Ryu0118 8d90c4a
Rename test fixture
Ryu0118 340b8e6
Update CHANGELOG.md
Ryu0118 1b32082
Correct grammer
Ryu0118 70bf933
Use KeyPath instead of closure
Ryu0118 d9ca225
Rename validateMappingStyleInConfig to extractValidConfigs
Ryu0118 53968a5
Add a document comment for extractValidConfigs(from:)
Ryu0118 c56b072
Use old testing api and remove EquatableErrorBox
Ryu0118 d65fc9e
Rename test case to use "mapping" instead of "dictionary"
Ryu0118 cb2f605
Add ValidSettingsExtractor to encapsulate the logic for converting a …
Ryu0118 54081ce
Add settings validation for both Target and AggregateTarget
Ryu0118 24040e7
Add tests for invalid settings.configs in Target and AggregateTarget
Ryu0118 9dc8405
Add document comments for ValidSettingsExtractor
Ryu0118 ca9ed3e
Rename ValidSettingsExtractor to BuildSettingsExtractor
Ryu0118 6b9cc59
Add settings validation for settingGroups
Ryu0118 6f7592d
Add tests for settingGroups
Ryu0118 79d78ca
Rename extract to parse
Ryu0118 03bcec1
Refactor
Ryu0118 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: InvalidConfigsValueNonMapping | ||
|
||
# This fixture is used to test the validation that ensures all values under `settings.configs` | ||
# are mappings. `invalid_key0` and `invalid_key1` are not mapping, | ||
# which should cause a SpecParsingError.invalidConfigsMappingFormat to be thrown. | ||
settings: | ||
configs: | ||
invalid_key0: value0 | ||
debug: | ||
valid_key: value1 | ||
invalid_key1: value2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import ProjectSpec | ||
import Testing | ||
import TestSupport | ||
import PathKit | ||
|
||
struct invalidConfigsMappingFormatTests { | ||
Ryu0118 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Test("throws invalidConfigsMappingFormat error for non-dictionary configs entries") | ||
func testNonDictionaryConfigsEntries() throws { | ||
Ryu0118 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let path = fixturePath + "invalid_configs_value_non_mapping.yml" | ||
let expectedError = SpecParsingError.invalidConfigsMappingFormat(keys: ["invalid_key0", "invalid_key1"]) | ||
|
||
#expect { | ||
try Project(path: path) | ||
} throws: { actualError in | ||
(actualError as any CustomStringConvertible).description == expectedError.description | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.