Skip to content

Commit eb49730

Browse files
committed
fixing more linting issues
1 parent 83f1472 commit eb49730

38 files changed

+1082
-747
lines changed

Macros/Options/Package@swift-5.10.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let package = Package(
3535
)
3636
],
3737
dependencies: [
38-
.package(url: "https://github.com/apple/swift-syntax", from: "510.0.0")
38+
.package(url: "https://github.com/swiftlang/swift-syntax", from: "510.0.0")
3939
// Dependencies declare other packages that this package depends on.
4040
// .package(url: /* package url */, from: "1.0.0")
4141
],

Macros/Options/Package@swift-6.1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let package = Package(
2525
],
2626
dependencies: [
2727
.package(path: "../.."),
28-
.package(url: "https://github.com/apple/swift-syntax.git", from: "601.0.1")
28+
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "601.0.1")
2929
// Dependencies declare other packages that this package depends on.
3030
// .package(url: /* package url */, from: "1.0.0")
3131
],

Macros/SKSampleMacro/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Macros/SKSampleMacro/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let package = Package(
2626
],
2727
dependencies: [
2828
.package(path: "../.."),
29-
.package(url: "https://github.com/apple/swift-syntax.git", from: "601.0.1")
29+
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "601.0.1")
3030
],
3131
targets: [
3232
// Targets are the basic building blocks of a package, defining a module or a test suite.

Sources/SyntaxKit/Attributes/Attribute.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@
2929

3030
public import SwiftSyntax
3131

32-
/// Internal representation of a Swift attribute with its arguments.
33-
internal struct AttributeInfo {
34-
internal let name: String
35-
internal let arguments: [String]
36-
37-
internal init(name: String, arguments: [String] = []) {
38-
self.name = name
39-
self.arguments = arguments
40-
}
41-
}
42-
4332
/// A Swift attribute that can be used as a property wrapper.
4433
public struct Attribute: CodeBlock {
4534
private let name: String
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// AttributeInfo.swift
3+
// SyntaxKit
4+
//
5+
// Created by Leo Dion.
6+
// Copyright © 2025 BrightDigit.
7+
//
8+
// Permission is hereby granted, free of charge, to any person
9+
// obtaining a copy of this software and associated documentation
10+
// files (the “Software”), to deal in the Software without
11+
// restriction, including without limitation the rights to use,
12+
// copy, modify, merge, publish, distribute, sublicense, and/or
13+
// sell copies of the Software, and to permit persons to whom the
14+
// Software is furnished to do so, subject to the following
15+
// conditions:
16+
//
17+
// The above copyright notice and this permission notice shall be
18+
// included in all copies or substantial portions of the Software.
19+
//
20+
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
21+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
// OTHER DEALINGS IN THE SOFTWARE.
28+
//
29+
30+
/// Internal representation of a Swift attribute with its arguments.
31+
internal struct AttributeInfo {
32+
internal let name: String
33+
internal let arguments: [String]
34+
35+
internal init(name: String, arguments: [String] = []) {
36+
self.name = name
37+
self.arguments = arguments
38+
}
39+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// CodeBlock+DictionaryValue.swift
3+
// SyntaxKit
4+
//
5+
// Created by Leo Dion.
6+
// Copyright © 2025 BrightDigit.
7+
//
8+
// Permission is hereby granted, free of charge, to any person
9+
// obtaining a copy of this software and associated documentation
10+
// files (the “Software”), to deal in the Software without
11+
// restriction, including without limitation the rights to use,
12+
// copy, modify, merge, publish, distribute, sublicense, and/or
13+
// sell copies of the Software, and to permit persons to whom the
14+
// Software is furnished to do so, subject to the following
15+
// conditions:
16+
//
17+
// The above copyright notice and this permission notice shall be
18+
// included in all copies or substantial portions of the Software.
19+
//
20+
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
21+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
// OTHER DEALINGS IN THE SOFTWARE.
28+
//
29+
30+
public import SwiftSyntax
31+
32+
// MARK: - CodeBlock Conformance
33+
34+
extension CodeBlock where Self: DictionaryValue {
35+
/// Converts this code block to an expression syntax.
36+
/// If the code block is already an expression, returns it directly.
37+
/// If it's a token, wraps it in a declaration reference expression.
38+
/// Otherwise, creates a default empty expression to prevent crashes.
39+
public var exprSyntax: ExprSyntax {
40+
if let expr = self.syntax.as(ExprSyntax.self) {
41+
return expr
42+
}
43+
44+
if let token = self.syntax.as(TokenSyntax.self) {
45+
return ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier(token.text)))
46+
}
47+
48+
// Fallback for unsupported syntax types - create a default expression
49+
// This prevents crashes while still allowing dictionary operations to continue
50+
#warning(
51+
"TODO: Review fallback for unsupported syntax types - consider if this should be an error instead"
52+
)
53+
return ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier("")))
54+
}
55+
}

Sources/SyntaxKit/Collections/DictionaryValue.swift

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,39 +35,6 @@ public protocol DictionaryValue: Sendable {
3535
var exprSyntax: ExprSyntax { get }
3636
}
3737

38-
// MARK: - Literal Conformance
39-
40-
extension Literal: DictionaryValue {
41-
// Literal already has exprSyntax from ExprCodeBlock protocol
42-
}
43-
44-
// MARK: - CodeBlock Conformance
45-
46-
extension CodeBlock where Self: DictionaryValue {
47-
/// Converts this code block to an expression syntax.
48-
/// If the code block is already an expression, returns it directly.
49-
/// If it's a token, wraps it in a declaration reference expression.
50-
/// Otherwise, creates a default empty expression to prevent crashes.
51-
public var exprSyntax: ExprSyntax {
52-
if let expr = self.syntax.as(ExprSyntax.self) {
53-
return expr
54-
}
55-
56-
if let token = self.syntax.as(TokenSyntax.self) {
57-
return ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier(token.text)))
58-
}
59-
60-
// Fallback for unsupported syntax types - create a default expression
61-
// This prevents crashes while still allowing dictionary operations to continue
62-
#warning(
63-
"TODO: Review fallback for unsupported syntax types - consider if this should be an error instead"
64-
)
65-
return ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier("")))
66-
}
67-
}
68-
69-
// MARK: - Specific CodeBlock Types
70-
7138
extension Call: DictionaryValue {}
7239
extension Init: DictionaryValue {}
7340
extension VariableExp: DictionaryValue {}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// Literal+DictionaryValue.swift
3+
// SyntaxKit
4+
//
5+
// Created by Leo Dion.
6+
// Copyright © 2025 BrightDigit.
7+
//
8+
// Permission is hereby granted, free of charge, to any person
9+
// obtaining a copy of this software and associated documentation
10+
// files (the “Software”), to deal in the Software without
11+
// restriction, including without limitation the rights to use,
12+
// copy, modify, merge, publish, distribute, sublicense, and/or
13+
// sell copies of the Software, and to permit persons to whom the
14+
// Software is furnished to do so, subject to the following
15+
// conditions:
16+
//
17+
// The above copyright notice and this permission notice shall be
18+
// included in all copies or substantial portions of the Software.
19+
//
20+
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
21+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
// OTHER DEALINGS IN THE SOFTWARE.
28+
//
29+
30+
extension Literal: DictionaryValue {
31+
// Literal already has exprSyntax from ExprCodeBlock protocol
32+
}

Sources/SyntaxKit/Core/AccessModifier.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,3 @@ public enum AccessModifier: CaseIterable, Sendable, Equatable {
5353
}
5454
}
5555
}
56-
57-
extension Keyword {
58-
/// Creates a Keyword from an AccessModifier.
59-
/// - Parameter accessModifier: The access modifier to convert.
60-
public init(_ accessModifier: AccessModifier) {
61-
self = accessModifier.keyword
62-
}
63-
}

0 commit comments

Comments
 (0)