Skip to content

Commit bf134fe

Browse files
committed
Move fixtures into resources folder
1 parent c2ab862 commit bf134fe

File tree

38 files changed

+20
-20
lines changed

38 files changed

+20
-20
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Linting rules are defined in `Source/SwiftLintBuiltInRules/Rules`. If someone me
44

55
User-facing changes must be documented in the `CHANGELOG.md` file, which is organized by version. New entries always go into the "Main" section. They give credit to the person who has made the change and they reference the issue which has been fixed by the change.
66

7-
All changes on configuration options must be reflected in `Tests/IntegrationTests/default_rule_configurations.yml`. This can be achieved by running `swift run swiftlint-dev rules register`. Running this command is also necessary when new rules got added or removed to (un-)register them from/in the list of built-in rules and tests verifying all examples in rule descriptions.
7+
All changes on configuration options must be reflected in `Tests/IntegrationTests/Resources/default_rule_configurations.yml`. This can be achieved by running `swift run swiftlint-dev rules register`. Running this command is also necessary when new rules got added or removed to (un-)register them from/in the list of built-in rules and tests verifying all examples in rule descriptions.
88

99
For some rules, there are dedicated tests in `Tests/BuiltInRulesTests`. However, they are typically not required as all the examples in the rule descriptions are automatically tested. The examples in the rule descriptions are also used to generate documentation for the rules. If an example presents a very pathological case, that's helpful for testing but not for user documentation, you can add the `excludeFromDocumentation: true` parameter to the example initializer. Important is that all examples in the rule description are verified by running `<RuleName>RuleGeneratedTests` for rule modified rules.
1010

.swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ excluded:
88
- assets
99
- Tests/BuiltInRulesTests/Resources
1010
- Tests/FileSystemAccessTests/Resources
11-
- Tests/IntegrationTests/PathHierarchyFixtures
11+
- Tests/IntegrationTests/Resources
1212

1313
# Enabled/disabled rules
1414
analyzer_rules:

Package.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ let package = Package(
207207
"TestHelpers",
208208
],
209209
exclude: [
210-
"default_rule_configurations.yml",
211-
"PathHierarchyFixtures",
210+
"Resources",
212211
],
213212
swiftSettings: swiftFeatures + targetedConcurrency // Set to strict once SwiftLintFramework is updated
214213
),

Source/swiftlint-dev/Rules+Register.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ private extension SwiftLintDev.Rules.Register {
269269
.write(
270270
to: testsParentDirectory
271271
.appendingPathComponent("IntegrationTests", isDirectory: true)
272+
.appendingPathComponent("Resources", isDirectory: true)
272273
.appendingPathComponent("default_rule_configurations.yml", isDirectory: false),
273274
atomically: true,
274275
encoding: .utf8

Tests/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ swift_library(
166166
swift_test(
167167
name = "IntegrationTests",
168168
data = [
169-
"IntegrationTests/default_rule_configurations.yml",
169+
"IntegrationTests/Resources/default_rule_configurations.yml",
170170
"//:LintInputs",
171171
],
172172
visibility = ["//visibility:public"],

Tests/IntegrationTests/ConfigHierarchyPathResolutionTests.swift renamed to Tests/IntegrationTests/ConfigPathResolutionTests.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import SwiftLintFramework
33
import TestHelpers
44
import XCTest
55

6-
final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
6+
final class ConfigPathResolutionTests: SwiftLintTestCase {
77
private func fixturePath(_ scenario: String) -> String {
88
#filePath.bridge()
99
.deletingLastPathComponent
10-
.stringByAppendingPathComponent("PathHierarchyFixtures")
10+
.stringByAppendingPathComponent("Resources")
1111
.stringByAppendingPathComponent(scenario)
1212
}
1313

@@ -33,15 +33,15 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
3333

3434
func testParentChildSameDirectory() {
3535
XCTAssertEqual(
36-
lintableFilePaths(in: "scenario1_parent_child_same_dir", configFile: "parent.yml"),
36+
lintableFilePaths(in: "_1_parent_child_same_dir", configFile: "parent.yml"),
3737
["Sources/CoreFile.swift"]
3838
)
3939
}
4040

4141
func testParentChildDifferentDirectories() {
4242
XCTAssertEqual(
4343
lintableFilePaths(
44-
in: "scenario2_parent_child_different_dirs",
44+
in: "_2_parent_child_different_dirs",
4545
configFile: "project/.swiftlint.yml",
4646
inPath: "project"
4747
),
@@ -52,7 +52,7 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
5252
func testChildOverridesParentExclusion() {
5353
XCTAssertEqual(
5454
lintableFilePaths(
55-
in: "scenario3_child_overrides_parent_exclusion",
55+
in: "_3_child_overrides_parent_exclusion",
5656
configFile: "project/.swiftlint.yml",
5757
inPath: "project"
5858
),
@@ -62,22 +62,22 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
6262

6363
func testParentIncludesChildExcludes() {
6464
XCTAssertEqual(
65-
lintableFilePaths(in: "scenario1_parent_child_same_dir", configFile: "parent.yml"),
65+
lintableFilePaths(in: "_1_parent_child_same_dir", configFile: "parent.yml"),
6666
["Sources/CoreFile.swift"]
6767
)
6868
}
6969

7070
func testNestedConfigurationBasic() {
7171
XCTAssertEqual(
72-
lintableFilePaths(in: "scenario4_nested_basic", configFile: ".swiftlint.yml"),
72+
lintableFilePaths(in: "_4_nested_basic", configFile: ".swiftlint.yml"),
7373
["ModuleA/File.swift", "ModuleA/Generated/File.swift", "ModuleB/File.swift"]
7474
)
7575
}
7676

7777
func testWildcardPatternCount() {
7878
XCTAssertEqual(
7979
lintableFilePaths(
80-
in: "scenario6_wildcard_patterns",
80+
in: "_5_wildcard_patterns",
8181
configFile: "project/.swiftlint.yml",
8282
inPath: "project"
8383
),
@@ -88,7 +88,7 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
8888
func testLintChildFolder() {
8989
XCTAssertEqual(
9090
lintableFilePaths(
91-
in: "scenario2_parent_child_different_dirs",
91+
in: "_2_parent_child_different_dirs",
9292
configFile: "project/.swiftlint.yml",
9393
inPath: "project"
9494
),
@@ -99,7 +99,7 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
9999
func testEmptyIncludedDefaultsToAll() {
100100
XCTAssertEqual(
101101
lintableFilePaths(
102-
in: "scenario7_wildcard_regression_5953",
102+
in: "_6_wildcards_from_nested_folder",
103103
configFile: ".swiftlint-exclude-thirdparty.yml"
104104
),
105105
[
@@ -113,25 +113,25 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
113113

114114
func testMultipleLevelsOfExclusion() {
115115
XCTAssertEqual(
116-
lintableFilePaths(in: "scenario1_parent_child_same_dir", configFile: "parent.yml"),
116+
lintableFilePaths(in: "_1_parent_child_same_dir", configFile: "parent.yml"),
117117
["Sources/CoreFile.swift"]
118118
)
119119
}
120120

121121
func testConfigFromParentFolder() {
122122
XCTAssertEqual(
123-
lintableFilePaths(in: "scenario7_wildcard_regression_5953", configFile: ".swiftlint.yml"),
123+
lintableFilePaths(in: "_6_wildcards_from_nested_folder", configFile: ".swiftlint.yml"),
124124
["MyProject/Sources/App.swift"]
125125
)
126126

127127
XCTAssertEqual(
128-
lintableFilePaths(in: "scenario7_wildcard_regression_5953/MyProject", configFile: "../.swiftlint.yml"),
128+
lintableFilePaths(in: "_6_wildcards_from_nested_folder/MyProject", configFile: "../.swiftlint.yml"),
129129
["Sources/App.swift"]
130130
)
131131
}
132132

133133
func testNestedConfigurationAppliesOnlyToSubdirectory() {
134-
let scenarioPath = fixturePath("scenario4_nested_basic")
134+
let scenarioPath = fixturePath("_4_nested_basic")
135135
let config = Configuration(configurationFiles: [])
136136

137137
let moduleAFile = SwiftLintFile(
@@ -155,7 +155,7 @@ final class ConfigHierarchyPathResolutionTests: SwiftLintTestCase {
155155
}
156156

157157
func testNestedConfigurationDisabledByConfigFlag() {
158-
let scenarioPath = fixturePath("scenario4_nested_basic")
158+
let scenarioPath = fixturePath("_4_nested_basic")
159159
let configFile = scenarioPath.stringByAppendingPathComponent("root.yml")
160160

161161
let moduleAFile = SwiftLintFile(

0 commit comments

Comments
 (0)