@@ -36,6 +36,8 @@ import {
3636import { extractNamedFunction } from '~src/extracts/extract_named_function'
3737import { makeNoSourceOutput } from '~src/output/makeNoSourceOutput'
3838import { makeParseErrorOutput } from '~src/output/makeParseErrorOutput'
39+ import { hasStubThrow } from '~src/analyzers/utils/extract_main_method'
40+ import { REMOVE_STUB_THROW } from '~src/comments/remove_stub_throw'
3941
4042type ConditionalExpression = TSESTree . ConditionalExpression
4143type IfStatement = TSESTree . IfStatement
@@ -82,19 +84,24 @@ export class TwoFerAnalyzer extends AnalyzerImpl {
8284 private program ! : Program
8385 private source ! : string
8486
85- private mainMethod ! : ExtractedFunction
87+ private mainMethod ? : ExtractedFunction
8688
8789 protected async execute ( input : Input ) : Promise < void > {
8890 const [ parsed ] = await this . parse ( input )
8991
9092 this . program = parsed . program
9193 this . source = parsed . source
9294
93- this . mainMethod = extractNamedFunction ( 'twoFer' , this . program ) !
95+ this . mainMethod = extractNamedFunction ( 'twoFer' , this . program )
9496
9597 // Firstly we want to check that the structure of this solution is correct
9698 // and that there is nothing structural stopping it from passing the tests
9799 this . checkStructure ( )
100+ if ( ! this . mainMethod ) return
101+
102+ if ( hasStubThrow ( this . mainMethod ) ) {
103+ this . disapprove ( REMOVE_STUB_THROW ( ) )
104+ }
98105
99106 // Now we want to ensure that the method signature is sane and that it has
100107 // valid arguments
0 commit comments