-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e81c1e
commit c16aa60
Showing
33 changed files
with
855 additions
and
720 deletions.
There are no files selected for viewing
This file contains 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,119 @@ | ||
included: | ||
- Plugins | ||
- Source | ||
- Tests | ||
excluded: | ||
- Tests/SwiftLintFrameworkTests/Resources | ||
analyzer_rules: | ||
- unused_declaration | ||
- unused_import | ||
opt_in_rules: | ||
- array_init | ||
- attributes | ||
- closure_end_indentation | ||
- closure_spacing | ||
- collection_alignment | ||
- contains_over_filter_count | ||
- contains_over_filter_is_empty | ||
- contains_over_first_not_nil | ||
- contains_over_range_nil_comparison | ||
- discouraged_none_name | ||
- discouraged_object_literal | ||
- empty_collection_literal | ||
- empty_count | ||
- empty_string | ||
- empty_xctest_method | ||
- enum_case_associated_values_count | ||
- explicit_init | ||
- extension_access_modifier | ||
- fallthrough | ||
- fatal_error_message | ||
- file_header | ||
- file_name | ||
- first_where | ||
- flatmap_over_map_reduce | ||
- identical_operands | ||
- joined_default_parameter | ||
- last_where | ||
- legacy_multiple | ||
- literal_expression_end_indentation | ||
- local_doc_comment | ||
- lower_acl_than_parent | ||
- modifier_order | ||
- nimble_operator | ||
- nslocalizedstring_key | ||
- number_separator | ||
- object_literal | ||
- operator_usage_whitespace | ||
- overridden_super_call | ||
- override_in_extension | ||
- pattern_matching_keywords | ||
- prefer_self_type_over_type_of_self | ||
- private_action | ||
- private_outlet | ||
- prohibited_interface_builder | ||
- prohibited_super_call | ||
- quick_discouraged_call | ||
- quick_discouraged_focused_test | ||
- quick_discouraged_pending_test | ||
- reduce_into | ||
- redundant_nil_coalescing | ||
- redundant_type_annotation | ||
- return_value_from_void_function | ||
- single_test_class | ||
- sorted_first_last | ||
- sorted_imports | ||
- static_operator | ||
- strong_iboutlet | ||
- test_case_accessibility | ||
- toggle_bool | ||
- unavailable_function | ||
- unneeded_parentheses_in_closure_argument | ||
- unowned_variable_capture | ||
- untyped_error_in_catch | ||
- vertical_parameter_alignment_on_call | ||
- vertical_whitespace_closing_braces | ||
- vertical_whitespace_opening_braces | ||
- xct_specific_matcher | ||
- yoda_condition | ||
|
||
identifier_name: | ||
excluded: | ||
- id | ||
large_tuple: 3 | ||
number_separator: | ||
minimum_length: 5 | ||
file_name: | ||
excluded: | ||
- SwiftSyntax+SwiftLint.swift | ||
- GeneratedTests.swift | ||
- TestHelpers.swift | ||
|
||
function_body_length: 60 | ||
type_body_length: 400 | ||
|
||
custom_rules: | ||
rule_id: | ||
included: Source/SwiftLintFramework/Rules/.+/\w+\.swift | ||
name: Rule ID | ||
message: Rule IDs must be all lowercase, snake case and not end with `rule` | ||
regex: identifier:\s*("\w+_rule"|"\S*[^a-z_]\S*") | ||
severity: error | ||
fatal_error: | ||
name: Fatal Error | ||
excluded: "Tests/*" | ||
message: Prefer using `queuedFatalError` over `fatalError` to avoid leaking compiler host machine paths. | ||
regex: \bfatalError\b | ||
match_kinds: | ||
- identifier | ||
severity: error | ||
rule_test_function: | ||
included: Tests/SwiftLintFrameworkTests/RulesTests.swift | ||
name: Rule Test Function | ||
message: Rule Test Function mustn't end with `rule` | ||
regex: func\s*test\w+(r|R)ule\(\) | ||
severity: error | ||
|
||
unused_import: | ||
always_keep_imports: | ||
- SwiftSyntaxBuilder # we can't detect uses of string interpolation of swift syntax nodes |
This file contains 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,34 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "SwiftDocCPlugin", | ||
"repositoryURL": "https://github.com/apple/swift-docc-plugin", | ||
"state": { | ||
"branch": null, | ||
"revision": "10bc670db657d11bdd561e07de30a9041311b2b1", | ||
"version": "1.1.0" | ||
} | ||
}, | ||
{ | ||
"package": "SymbolKit", | ||
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit", | ||
"state": { | ||
"branch": null, | ||
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34", | ||
"version": "1.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "SwiftLintPlugin", | ||
"repositoryURL": "https://github.com/lukepistrol/SwiftLintPlugin", | ||
"state": { | ||
"branch": null, | ||
"revision": "f69b412a765396d44dc9f4788a5b79919c1ca9e3", | ||
"version": "0.2.2" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,55 +1,55 @@ | ||
// | ||
// File.swift | ||
// | ||
// AuthorAPIs.swift | ||
// QuoteKit | ||
// | ||
// Created by Rudrank Riyam on 03/10/21. | ||
// | ||
|
||
import Foundation | ||
|
||
public extension QuoteKit { | ||
static func authorImage(with slug: String, size: Int = 700) -> URL { | ||
QuotableEndpoint(.authorProfile(size, slug), host: .images).url | ||
} | ||
|
||
static func author(id: String) async throws -> Author { | ||
try await execute(with: QuotableEndpoint(.author(id))) | ||
static func authorImage(with slug: String, size: Int = 700) -> URL { | ||
QuotableEndpoint(.authorProfile(size, slug), host: .images).url | ||
} | ||
|
||
static func author(id: String) async throws -> Author { | ||
try await execute(with: QuotableEndpoint(.author(id))) | ||
} | ||
|
||
static func authors(slugs: [String]? = nil, | ||
sortBy: AuthorsAndTagsSortType? = nil, | ||
order: QuotableListOrder? = nil, | ||
limit: Int = 20, | ||
page: Int = 1) async throws -> Authors { | ||
|
||
let queryItems = authorsParameters(slugs: slugs, sortBy: sortBy, order: order, limit: limit, page: page) | ||
|
||
return try await execute(with: QuotableEndpoint(.authors, queryItems: queryItems)) | ||
} | ||
|
||
private static func authorsParameters(slugs: [String]? = nil, | ||
sortBy: AuthorsAndTagsSortType? = nil, | ||
order: QuotableListOrder? = nil, | ||
limit: Int = 20, | ||
page: Int = 1) -> [URLQueryItem] { | ||
|
||
var queryItems: [URLQueryItem] = [] | ||
|
||
queryItems.append(.limit(limit)) | ||
queryItems.append(.page(page)) | ||
|
||
if let slugs = slugs { | ||
queryItems.append(.slugs(slugs)) | ||
} | ||
|
||
static func authors(slugs: [String]? = nil, | ||
sortBy: AuthorsAndTagsSortType? = nil, | ||
order: QuotableListOrder? = nil, | ||
limit: Int = 20, | ||
page: Int = 1) async throws -> Authors { | ||
|
||
let queryItems = authorsParameters(slugs: slugs, sortBy: sortBy, order: order, limit: limit, page: page) | ||
|
||
return try await execute(with: QuotableEndpoint(.authors, queryItems: queryItems)) | ||
|
||
if let sortBy = sortBy { | ||
queryItems.append(.sortBy(sortBy)) | ||
} | ||
|
||
private static func authorsParameters(slugs: [String]? = nil, | ||
sortBy: AuthorsAndTagsSortType? = nil, | ||
order: QuotableListOrder? = nil, | ||
limit: Int = 20, | ||
page: Int = 1) -> [URLQueryItem] { | ||
|
||
var queryItems: [URLQueryItem] = [] | ||
|
||
queryItems.append(.limit(limit)) | ||
queryItems.append(.page(page)) | ||
|
||
if let slugs = slugs { | ||
queryItems.append(.slugs(slugs)) | ||
} | ||
|
||
if let sortBy = sortBy { | ||
queryItems.append(.sortBy(sortBy)) | ||
} | ||
|
||
if let order = order { | ||
queryItems.append(.order(order)) | ||
} | ||
|
||
return queryItems | ||
|
||
if let order = order { | ||
queryItems.append(.order(order)) | ||
} | ||
|
||
return queryItems | ||
} | ||
} |
Oops, something went wrong.