mirror of
https://github.com/mas-cli/mas
synced 2024-11-24 12:33:08 +00:00
Improve lint configurations.
Partial #592 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
2edd21803b
commit
4d4dd02cd3
6 changed files with 266 additions and 48 deletions
|
@ -1,41 +1,62 @@
|
||||||
{
|
{
|
||||||
"indentation" : {
|
"indentConditionalCompilationBlocks": false,
|
||||||
"spaces" : 4
|
"indentation": {
|
||||||
|
"spaces": 4
|
||||||
},
|
},
|
||||||
"lineLength" : 120,
|
"lineBreakAroundMultilineExpressionChainComponents": true,
|
||||||
"rules" : {
|
"lineBreakBeforeControlFlowKeywords": false,
|
||||||
"AllPublicDeclarationsHaveDocumentation" : false,
|
"lineBreakBeforeEachArgument": true,
|
||||||
"AlwaysUseLowerCamelCase" : true,
|
"lineBreakBeforeEachGenericRequirement": true,
|
||||||
"AmbiguousTrailingClosureOverload" : true,
|
"lineBreakBetweenDeclarationAttributes": true,
|
||||||
"BeginDocumentationCommentWithOneLineSummary" : false,
|
"lineLength": 120,
|
||||||
"DoNotUseSemicolons" : true,
|
"maximumBlankLines": 1,
|
||||||
"DontRepeatTypeInStaticProperties" : true,
|
"multiElementCollectionTrailingCommas": true,
|
||||||
"FileScopedDeclarationPrivacy" : true,
|
"prioritizeKeepingFunctionOutputTogether": true,
|
||||||
"FullyIndirectEnum" : true,
|
"respectsExistingLineBreaks": true,
|
||||||
"GroupNumericLiterals" : true,
|
"rules": {
|
||||||
"IdentifiersMustBeASCII" : true,
|
"AllPublicDeclarationsHaveDocumentation": true,
|
||||||
"NeverForceUnwrap" : false,
|
"AlwaysUseLiteralForEmptyCollectionInit": true,
|
||||||
"NeverUseForceTry" : false,
|
"AlwaysUseLowerCamelCase": true,
|
||||||
"NeverUseImplicitlyUnwrappedOptionals" : false,
|
"AmbiguousTrailingClosureOverload": true,
|
||||||
"NoAccessLevelOnExtensionDeclaration" : false,
|
"BeginDocumentationCommentWithOneLineSummary": true,
|
||||||
"NoBlockComments" : true,
|
"DoNotUseSemicolons": true,
|
||||||
"NoCasesWithOnlyFallthrough" : true,
|
"DontRepeatTypeInStaticProperties": true,
|
||||||
"NoEmptyTrailingClosureParentheses" : true,
|
"FileScopedDeclarationPrivacy": true,
|
||||||
"NoLabelsInCasePatterns" : true,
|
"FullyIndirectEnum": true,
|
||||||
"NoLeadingUnderscores" : false,
|
"GroupNumericLiterals": true,
|
||||||
"NoParensAroundConditions" : true,
|
"IdentifiersMustBeASCII": true,
|
||||||
"NoVoidReturnOnFunctionSignature" : true,
|
"NeverForceUnwrap": true,
|
||||||
"OneCasePerLine" : true,
|
"NeverUseForceTry": true,
|
||||||
"OneVariableDeclarationPerLine" : true,
|
"NeverUseImplicitlyUnwrappedOptionals": true,
|
||||||
"OnlyOneTrailingClosureArgument" : true,
|
"NoAccessLevelOnExtensionDeclaration": true,
|
||||||
"OrderedImports" : true,
|
"NoAssignmentInExpressions": true,
|
||||||
"ReturnVoidInsteadOfEmptyTuple" : true,
|
"NoBlockComments": true,
|
||||||
"UseLetInEveryBoundCaseVariable" : true,
|
"NoCasesWithOnlyFallthrough": true,
|
||||||
"UseShorthandTypeNames" : true,
|
"NoEmptyTrailingClosureParentheses": true,
|
||||||
"UseSingleLinePropertyGetter" : true,
|
"NoLabelsInCasePatterns": true,
|
||||||
"UseSynthesizedInitializer" : true,
|
"NoLeadingUnderscores": true,
|
||||||
"UseTripleSlashForDocumentationComments" : true,
|
"NoParensAroundConditions": true,
|
||||||
"ValidateDocumentationComments" : false
|
"NoPlaygroundLiterals": true,
|
||||||
|
"NoVoidReturnOnFunctionSignature": true,
|
||||||
|
"OmitExplicitReturns": true,
|
||||||
|
"OneCasePerLine": true,
|
||||||
|
"OneVariableDeclarationPerLine": true,
|
||||||
|
"OnlyOneTrailingClosureArgument": true,
|
||||||
|
"OrderedImports": true,
|
||||||
|
"ReplaceForEachWithForLoop": true,
|
||||||
|
"ReturnVoidInsteadOfEmptyTuple": true,
|
||||||
|
"TypeNamesShouldBeCapitalized": true,
|
||||||
|
"UseEarlyExits": true,
|
||||||
|
"UseLetInEveryBoundCaseVariable": true,
|
||||||
|
"UseShorthandTypeNames": true,
|
||||||
|
"UseSingleLinePropertyGetter": true,
|
||||||
|
"UseSynthesizedInitializer": true,
|
||||||
|
"UseTripleSlashForDocumentationComments": true,
|
||||||
|
"UseWhereClausesInForLoops": true,
|
||||||
|
"ValidateDocumentationComments": true
|
||||||
},
|
},
|
||||||
"version" : 1
|
"spacesAroundRangeFormationOperators": false,
|
||||||
|
"spacesBeforeEndOfLineComments": 1,
|
||||||
|
"TrailingComma": false,
|
||||||
|
"version": 1
|
||||||
}
|
}
|
||||||
|
|
21
.swiftformat
21
.swiftformat
|
@ -5,22 +5,33 @@
|
||||||
# https://github.com/nicklockwood/SwiftFormat#config-file
|
# https://github.com/nicklockwood/SwiftFormat#config-file
|
||||||
#
|
#
|
||||||
|
|
||||||
--exclude docs/
|
|
||||||
|
|
||||||
# Disabled rules
|
# Disabled rules
|
||||||
--disable blankLinesAroundMark
|
|
||||||
--disable consecutiveSpaces
|
|
||||||
--disable hoistAwait
|
--disable hoistAwait
|
||||||
--disable hoistPatternLet
|
--disable hoistPatternLet
|
||||||
--disable hoistTry
|
--disable hoistTry
|
||||||
|
|
||||||
|
# Enable later
|
||||||
--disable indent
|
--disable indent
|
||||||
--disable trailingCommas
|
--disable trailingCommas
|
||||||
|
|
||||||
# Enabled rules (disabled by default)
|
# Enabled rules (disabled by default)
|
||||||
--enable trailingClosures
|
#--enable acronyms
|
||||||
|
#--enable blankLinesBetweenImports
|
||||||
|
--enable blockComments
|
||||||
|
--enable docComments
|
||||||
|
--enable isEmpty
|
||||||
|
--enable noExplicitOwnership
|
||||||
|
#--enable organizeDeclarations
|
||||||
|
--enable redundantProperty
|
||||||
|
--enable sortSwitchCases
|
||||||
|
--enable wrapConditionalBodies
|
||||||
|
--enable wrapEnumCases
|
||||||
|
--enable wrapMultilineConditionalAssignment
|
||||||
|
--enable wrapSwitchCases
|
||||||
|
|
||||||
# Rule options
|
# Rule options
|
||||||
--commas always
|
--commas always
|
||||||
--extensionacl on-declarations
|
--extensionacl on-declarations
|
||||||
--importgrouping testable-last
|
--importgrouping testable-last
|
||||||
|
--lineaftermarks false
|
||||||
--ranges no-space
|
--ranges no-space
|
||||||
|
|
132
.swiftlint.yml
132
.swiftlint.yml
|
@ -5,11 +5,131 @@
|
||||||
# https://github.com/realm/SwiftLint#configuration
|
# https://github.com/realm/SwiftLint#configuration
|
||||||
#
|
#
|
||||||
---
|
---
|
||||||
|
opt_in_rules:
|
||||||
|
- accessibility_label_for_image
|
||||||
|
- accessibility_trait_for_button
|
||||||
|
- anonymous_argument_in_multiline_closure
|
||||||
|
- array_init
|
||||||
|
- attributes
|
||||||
|
- closure_end_indentation
|
||||||
|
- closure_spacing
|
||||||
|
- collection_alignment
|
||||||
|
- comma_inheritance
|
||||||
|
- conditional_returns_on_newline
|
||||||
|
- contains_over_filter_count
|
||||||
|
- contains_over_filter_is_empty
|
||||||
|
- contains_over_first_not_nil
|
||||||
|
- contains_over_range_nil_comparison
|
||||||
|
- convenience_type
|
||||||
|
- direct_return
|
||||||
|
- discarded_notification_center_observer
|
||||||
|
- discouraged_assert
|
||||||
|
- discouraged_none_name
|
||||||
|
- discouraged_object_literal
|
||||||
|
- discouraged_optional_boolean
|
||||||
|
- discouraged_optional_collection
|
||||||
|
- empty_collection_literal
|
||||||
|
- empty_count
|
||||||
|
- empty_string
|
||||||
|
- empty_xctest_method
|
||||||
|
- enum_case_associated_values_count
|
||||||
|
- expiring_todo
|
||||||
|
- explicit_init
|
||||||
|
- extension_access_modifier
|
||||||
|
- fallthrough
|
||||||
|
- fatal_error_message
|
||||||
|
- file_name_no_space
|
||||||
|
- file_types_order
|
||||||
|
- first_where
|
||||||
|
- flatmap_over_map_reduce
|
||||||
|
- function_default_parameter_at_end
|
||||||
|
- ibinspectable_in_extension
|
||||||
|
- identical_operands
|
||||||
|
- implicit_return
|
||||||
|
- implicitly_unwrapped_optional
|
||||||
|
- indentation_width
|
||||||
|
- joined_default_parameter
|
||||||
|
- last_where
|
||||||
|
- legacy_multiple
|
||||||
|
- let_var_whitespace
|
||||||
|
- literal_expression_end_indentation
|
||||||
|
- local_doc_comment
|
||||||
|
- lower_acl_than_parent
|
||||||
|
- missing_docs
|
||||||
|
- modifier_order
|
||||||
|
- multiline_arguments
|
||||||
|
- multiline_arguments_brackets
|
||||||
|
- multiline_function_chains
|
||||||
|
- multiline_literal_brackets
|
||||||
|
- multiline_parameters
|
||||||
|
- multiline_parameters_brackets
|
||||||
|
- nimble_operator
|
||||||
|
- no_empty_block
|
||||||
|
- no_extension_access_modifier
|
||||||
|
- no_magic_numbers
|
||||||
|
- non_overridable_class_declaration
|
||||||
|
- nslocalizedstring_key
|
||||||
|
- nslocalizedstring_require_bundle
|
||||||
|
- object_literal
|
||||||
|
- operator_usage_whitespace
|
||||||
|
- optional_enum_case_matching
|
||||||
|
- overridden_super_call
|
||||||
|
- override_in_extension
|
||||||
|
- pattern_matching_keywords
|
||||||
|
- period_spacing
|
||||||
|
- prefer_key_path
|
||||||
|
- prefer_self_in_static_references
|
||||||
|
- prefer_self_type_over_type_of_self
|
||||||
|
- prefer_zero_over_explicit_init
|
||||||
|
- private_action
|
||||||
|
- private_outlet
|
||||||
|
- private_subject
|
||||||
|
- private_swiftui_state
|
||||||
|
- prohibited_interface_builder
|
||||||
|
- prohibited_super_call
|
||||||
|
- quick_discouraged_focused_test
|
||||||
|
- raw_value_for_camel_cased_codable_enum
|
||||||
|
- reduce_into
|
||||||
|
- redundant_nil_coalescing
|
||||||
|
- redundant_self_in_closure
|
||||||
|
- redundant_type_annotation
|
||||||
|
- required_enum_case
|
||||||
|
- return_value_from_void_function
|
||||||
|
- self_binding
|
||||||
|
- shorthand_argument
|
||||||
|
- shorthand_optional_binding
|
||||||
|
- single_test_class
|
||||||
|
- sorted_first_last
|
||||||
|
- sorted_imports
|
||||||
|
- static_operator
|
||||||
|
- strict_fileprivate
|
||||||
|
- strong_iboutlet
|
||||||
|
- superfluous_else
|
||||||
|
- switch_case_on_newline
|
||||||
|
- test_case_accessibility
|
||||||
|
- toggle_bool
|
||||||
|
- trailing_closure
|
||||||
|
- type_contents_order
|
||||||
|
- unavailable_function
|
||||||
|
- unhandled_throwing_task
|
||||||
|
- unneeded_parentheses_in_closure_argument
|
||||||
|
- unowned_variable_capture
|
||||||
|
- untyped_error_in_catch
|
||||||
|
- unused_parameter
|
||||||
|
- vertical_parameter_alignment_on_call
|
||||||
|
- vertical_whitespace_closing_braces
|
||||||
|
- vertical_whitespace_opening_braces
|
||||||
|
- weak_delegate
|
||||||
|
- xct_specific_matcher
|
||||||
|
- yoda_condition
|
||||||
disabled_rules:
|
disabled_rules:
|
||||||
- non_optional_string_data_conversion
|
- function_body_length
|
||||||
- trailing_comma
|
- trailing_comma
|
||||||
excluded:
|
file_types_order:
|
||||||
- docs
|
order: [
|
||||||
opening_brace:
|
[main_type],
|
||||||
ignore_multiline_function_signatures: true
|
[supporting_type],
|
||||||
ignore_multiline_statement_conditions: true
|
[extension],
|
||||||
|
[preview_provider],
|
||||||
|
[library_content_provider]
|
||||||
|
]
|
||||||
|
|
|
@ -33,10 +33,12 @@ extension ISStoreAccount: StoreAccount {
|
||||||
}
|
}
|
||||||
|
|
||||||
static func signIn(username: String, password: String, systemDialog: Bool) -> Promise<ISStoreAccount> {
|
static func signIn(username: String, password: String, systemDialog: Bool) -> Promise<ISStoreAccount> {
|
||||||
|
// swift-format-ignore: UseEarlyExits
|
||||||
if #available(macOS 10.13, *) {
|
if #available(macOS 10.13, *) {
|
||||||
// Signing in is no longer possible as of High Sierra.
|
// Signing in is no longer possible as of High Sierra.
|
||||||
// https://github.com/mas-cli/mas/issues/164
|
// https://github.com/mas-cli/mas/issues/164
|
||||||
return Promise(error: MASError.notSupported)
|
return Promise(error: MASError.notSupported)
|
||||||
|
// swiftlint:disable:next superfluous_else
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
primaryAccount
|
primaryAccount
|
||||||
|
|
62
Tests/masTests/.swift-format
Normal file
62
Tests/masTests/.swift-format
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
"indentConditionalCompilationBlocks": false,
|
||||||
|
"indentation": {
|
||||||
|
"spaces": 4
|
||||||
|
},
|
||||||
|
"lineBreakAroundMultilineExpressionChainComponents": true,
|
||||||
|
"lineBreakBeforeControlFlowKeywords": false,
|
||||||
|
"lineBreakBeforeEachArgument": true,
|
||||||
|
"lineBreakBeforeEachGenericRequirement": true,
|
||||||
|
"lineBreakBetweenDeclarationAttributes": true,
|
||||||
|
"lineLength": 120,
|
||||||
|
"maximumBlankLines": 1,
|
||||||
|
"multiElementCollectionTrailingCommas": true,
|
||||||
|
"prioritizeKeepingFunctionOutputTogether": true,
|
||||||
|
"respectsExistingLineBreaks": true,
|
||||||
|
"rules": {
|
||||||
|
"AllPublicDeclarationsHaveDocumentation": false,
|
||||||
|
"AlwaysUseLiteralForEmptyCollectionInit": true,
|
||||||
|
"AlwaysUseLowerCamelCase": true,
|
||||||
|
"AmbiguousTrailingClosureOverload": true,
|
||||||
|
"BeginDocumentationCommentWithOneLineSummary": true,
|
||||||
|
"DoNotUseSemicolons": true,
|
||||||
|
"DontRepeatTypeInStaticProperties": true,
|
||||||
|
"FileScopedDeclarationPrivacy": true,
|
||||||
|
"FullyIndirectEnum": true,
|
||||||
|
"GroupNumericLiterals": true,
|
||||||
|
"IdentifiersMustBeASCII": true,
|
||||||
|
"NeverForceUnwrap": false,
|
||||||
|
"NeverUseForceTry": false,
|
||||||
|
"NeverUseImplicitlyUnwrappedOptionals": true,
|
||||||
|
"NoAccessLevelOnExtensionDeclaration": true,
|
||||||
|
"NoAssignmentInExpressions": true,
|
||||||
|
"NoBlockComments": true,
|
||||||
|
"NoCasesWithOnlyFallthrough": true,
|
||||||
|
"NoEmptyTrailingClosureParentheses": true,
|
||||||
|
"NoLabelsInCasePatterns": true,
|
||||||
|
"NoLeadingUnderscores": true,
|
||||||
|
"NoParensAroundConditions": true,
|
||||||
|
"NoPlaygroundLiterals": true,
|
||||||
|
"NoVoidReturnOnFunctionSignature": true,
|
||||||
|
"OmitExplicitReturns": true,
|
||||||
|
"OneCasePerLine": true,
|
||||||
|
"OneVariableDeclarationPerLine": true,
|
||||||
|
"OnlyOneTrailingClosureArgument": true,
|
||||||
|
"OrderedImports": true,
|
||||||
|
"ReplaceForEachWithForLoop": true,
|
||||||
|
"ReturnVoidInsteadOfEmptyTuple": true,
|
||||||
|
"TypeNamesShouldBeCapitalized": true,
|
||||||
|
"UseEarlyExits": true,
|
||||||
|
"UseLetInEveryBoundCaseVariable": true,
|
||||||
|
"UseShorthandTypeNames": true,
|
||||||
|
"UseSingleLinePropertyGetter": true,
|
||||||
|
"UseSynthesizedInitializer": true,
|
||||||
|
"UseTripleSlashForDocumentationComments": true,
|
||||||
|
"UseWhereClausesInForLoops": true,
|
||||||
|
"ValidateDocumentationComments": true
|
||||||
|
},
|
||||||
|
"spacesAroundRangeFormationOperators": false,
|
||||||
|
"spacesBeforeEndOfLineComments": 1,
|
||||||
|
"TrailingComma": false,
|
||||||
|
"version": 1
|
||||||
|
}
|
|
@ -9,3 +9,5 @@ disabled_rules:
|
||||||
- force_cast
|
- force_cast
|
||||||
- force_try
|
- force_try
|
||||||
- function_body_length
|
- function_body_length
|
||||||
|
- implicitly_unwrapped_optional
|
||||||
|
- no_magic_numbers
|
||||||
|
|
Loading…
Reference in a new issue