Skip to content
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

NSRangeException in closure_parameter_position rule #1026

Closed
alejandro-isaza opened this issue Dec 22, 2016 · 7 comments
Closed

NSRangeException in closure_parameter_position rule #1026

alejandro-isaza opened this issue Dec 22, 2016 · 7 comments
Labels
bug Unexpected and reproducible misbehavior.

Comments

@alejandro-isaza
Copy link

swiftlint version: 0.14.0

*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff822f9e7b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff96ee4cad objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff8237899d +[NSException raise:format:] + 205
	3   Foundation                          0x00007fff83c893f8 -[NSRegularExpression(NSMatching) enumerateMatchesInString:options:range:usingBlock:] + 375
	4   Foundation                          0x00007fff83c8926f -[NSRegularExpression(NSMatching) matchesInString:options:range:] + 152
	5   SwiftLintFramework                  0x000000010f1243b8 _TTSf4g_n_g_g_n___TFFV18SwiftLintFramework28ClosureParameterPositionRule12validateFileFTC21SourceKittenFramework4File4kindOS_19SwiftExpressionKind10dictionaryGVs10DictionarySSPS1_22SourceKitRepresentable___GSaVS_14StyleViolation_U2_FGS4_SSPS5___GSqS6__ + 1096
	6   SwiftLintFramework                  0x000000010f12537a _TTSf4g_n_g_n___TFV18SwiftLintFramework28ClosureParameterPositionRule12validateFilefTC21SourceKittenFramework4File4kindOS_19SwiftExpressionKind10dictionaryGVs10DictionarySSPS1_22SourceKitRepresentable___GSaVS_14StyleViolation_ + 2810
	7   SwiftLintFramework                  0x000000010f1f2c62 _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1282
	8   SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	9   SwiftLintFramework                  0x000000010f1f2bcb _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1131
	10  SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	11  SwiftLintFramework                  0x000000010f1f2bcb _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1131
	12  SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	13  SwiftLintFramework                  0x000000010f1f2bcb _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1131
	14  SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	15  SwiftLintFramework                  0x000000010f1f2bcb _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1131
	16  SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	17  SwiftLintFramework                  0x000000010f1f2bcb _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1131
	18  SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	19  SwiftLintFramework                  0x000000010f1f2bcb _TTSf4n_n_g___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFileFTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation_U_FPS6__GSaS7___merged + 1131
	20  SwiftLintFramework                  0x000000010f1f3207 _TTSf4g_g_n___TTSg5V18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS0_S_7ASTRuleS____TFe18SwiftLintFrameworkRxS_7ASTRuleWx8KindType8RawValue_zSSrS0_12validateFilefTC21SourceKittenFramework4File10dictionaryGVs10DictionarySSPS3_22SourceKitRepresentable___GSaVS_14StyleViolation__merged + 1095
	21  SwiftLintFramework                  0x000000010f0be6cc _TTWV18SwiftLintFramework39EmptyParenthesesWithTrailingClosureRuleS_4RuleS_FS1_12validateFilefC21SourceKittenFramework4FileGSaVS_14StyleViolation__merged + 44
	22  SwiftLintFramework                  0x000000010f0f7cd6 _TTSf4n_s_n_n_n___TFFV18SwiftLintFramework6LinterP33_5A5F37FCDEE0B4D78BAE05A90BA8A06218getStyleViolationsFSbTGSaVS_14StyleViolation_GSaT2idSS4timeSd___U_FPS_4Rule_GSaS1__ + 614
	23  SwiftLintFramework                  0x000000010f0f895a _TTSf4n_s___TFV18SwiftLintFramework6LinterP33_5A5F37FCDEE0B4D78BAE05A90BA8A06218getStyleViolationsfSbTGSaVS_14StyleViolation_GSaT2idSS4timeSd___ + 794
	24  SwiftLintFramework                  0x000000010f0f4b89 _TFV18SwiftLintFramework6Linterg15styleViolationsGSaVS_14StyleViolation_ + 25
	25  swiftlint                           0x000000010f01a25d swiftlint + 78429
	26  swiftlint                           0x000000010f01e6b1 swiftlint + 95921
	27  swiftlint                           0x000000010f01e738 swiftlint + 96056
	28  libswiftObjectiveC.dylib            0x000000010fbcf4d6 _TF10ObjectiveC15autoreleasepoolurFzT8invokingFzT_x_x + 54
	29  swiftlint                           0x000000010f019a1f swiftlint + 76319
	30  swiftlint                           0x000000010f01e1b1 swiftlint + 94641
	31  swiftlint                           0x000000010f011368 swiftlint + 41832
	32  swiftlint                           0x000000010f00e813 swiftlint + 30739
	33  swiftlint                           0x000000010f010c34 swiftlint + 39988
	34  swiftlint                           0x000000010f0108cf swiftlint + 39119
	35  swiftlint                           0x000000010f011d3e swiftlint + 44350
	36  Result                              0x000000010f08d2ad _TFO6Result6Result8analysisurfT9ifSuccessFxqd__9ifFailureFq_qd___qd__ + 365
	37  Result                              0x000000010f087727 _TTWu0_R_s5ErrorrGO6Result6Resultxq__S0_14ResultProtocolS0_FS2_8analysisurfT9ifSuccessFwx5Valueqd__9ifFailureFwx5Errorqd___qd__ + 231
	38  Result                              0x000000010f085c8a _TFE6ResultPS_14ResultProtocol7flatMapurfFwx5ValueGOS_6Resultqd__wx5Error_GS2_qd__wxS3__ + 186
	39  swiftlint                           0x000000010f010712 swiftlint + 38674
	40  swiftlint                           0x000000010f01934e swiftlint + 74574
	41  swiftlint                           0x000000010f00cbcc swiftlint + 23500
	42  Commandant                          0x000000010f04ff98 _TFFV10Commandant14CommandWrappercuRd__S_15CommandProtocolxzWd__7Options11ClientError_wd__11ClientErrorzWd__S2_S3__rFqd__GS0_x_U_FCS_14ArgumentParserGO6Result6ResultT_GOS_15CommandantErrorQ___ + 1176
	43  Commandant                          0x000000010f054b28 _TPA__TFFV10Commandant14CommandWrappercuRd__S_15CommandProtocolxzWd__7Options11ClientError_wd__11ClientErrorzWd__S2_S3__rFqd__GS0_x_U_FCS_14ArgumentParserGO6Result6ResultT_GOS_15CommandantErrorQ___ + 88
	44  Commandant                          0x000000010f050b84 _TFC10Commandant15CommandRegistry3runfT7commandSS9argumentsGSaSS__GSqGO6Result6ResultT_GOS_15CommandantErrorx___ + 292
	45  Commandant                          0x000000010f0510e9 _TFC10Commandant15CommandRegistry4mainfT9argumentsGSaSS_11defaultVerbSS12errorHandlerFxT__Os5Never + 505
	46  Commandant                          0x000000010f050ee7 _TFC10Commandant15CommandRegistry4mainfT11defaultVerbSS12errorHandlerFxT__Os5Never + 135
	47  swiftlint                           0x000000010f00c8e0 swiftlint + 22752
	48  libdispatch.dylib                   0x00007fff9779aef7 _dispatch_call_block_and_release + 12
	49  libdispatch.dylib                   0x00007fff977920b8 _dispatch_client_callout + 8
	50  libdispatch.dylib                   0x00007fff977a1266 _dispatch_queue_override_invoke + 743
	51  libdispatch.dylib                   0x00007fff97793e70 _dispatch_root_queue_drain + 476
	52  libdispatch.dylib                   0x00007fff97793c47 _dispatch_worker_thread3 + 99
	53  libsystem_pthread.dylib             0x00007fff979df712 _pthread_wqthread + 1299
	54  libsystem_pthread.dylib             0x00007fff979df1ed start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]```
@marcelofabri
Copy link
Collaborator

Can you add the file that is causing this crash or any other useful info?

@alejandro-isaza
Copy link
Author

Sorry, no. If I knew the line number I could share that.

@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label Dec 22, 2016
@marcelofabri marcelofabri changed the title NSRangeException NSRangeException in closure_parameter_position rule Dec 22, 2016
@marcelofabri
Copy link
Collaborator

If you could try to reduce the crash to a sample (sharable) example, it'd be really helpful.

@alejandro-isaza
Copy link
Author

Ok, I narrowed it down to this:

let mediaView: UIView = { [weak self] index in
    return UIView()
}(index)

@marcelofabri
Copy link
Collaborator

I was able to reproduce it, thanks so much for narrowing it down!

@marcelofabri
Copy link
Collaborator

I've opened #1027 which seems to fix the issue. Could you please test it against your codebase? ✅

@alejandro-isaza
Copy link
Author

It works! Thanks for the quick fix. 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

2 participants