3737
3838(define-enum-type resyntax-output-format (plain-text github-pull-request-review git-commit-message json))
3939(define-enum-type resyntax-fix-method (modify-files create-multiple-git-commits))
40- (define-record-type resyntax-analyze-options (targets suite output-format output-destination))
40+ (define-record-type resyntax-analyze-options (targets suite output-format output-destination analyzer-timeout-ms ))
4141
4242
4343(define-record-type resyntax-fix-options
4848 max-fixes
4949 max-modified-files
5050 max-modified-lines
51- max-pass-count))
51+ max-pass-count
52+ analyzer-timeout-ms))
5253
5354
5455(define all-lines (range-set (unbounded-range #:comparator natural<=>)))
6061 (define selected-rule #false )
6162 (define output-format plain-text)
6263 (define output-destination 'console )
64+ (define analyzer-timeout-ms 10000 )
6365
6466 (command-line
6567 #:program "resyntax analyze "
@@ -105,6 +107,11 @@ changed relative to baseref are analyzed."
105107 (define rule-sym (string->symbol rule-name))
106108 (set! selected-rule rule-sym))
107109
110+ ("--analyzer-timeout "
111+ timeout-ms
112+ "The timeout in milliseconds for expansion analyzers. Defaults to 10000 (10 seconds). "
113+ (set! analyzer-timeout-ms (string->number timeout-ms)))
114+
108115 ("--output-to-file "
109116 outputpath
110117 "Store results in a file instead of printing them to the console. "
@@ -128,7 +135,8 @@ determined by the GITHUB_REPOSITORY and GITHUB_REF environment variables."
128135 #:targets (build-vector targets)
129136 #:suite suite
130137 #:output-format output-format
131- #:output-destination output-destination))
138+ #:output-destination output-destination
139+ #:analyzer-timeout-ms analyzer-timeout-ms))
132140
133141
134142(define (resyntax-fix-parse-command-line)
@@ -143,6 +151,7 @@ determined by the GITHUB_REPOSITORY and GITHUB_REF environment variables."
143151 (define max-pass-count 10 )
144152 (define max-modified-files +inf.0 )
145153 (define max-modified-lines +inf.0 )
154+ (define analyzer-timeout-ms 10000 )
146155
147156 (command-line
148157 #:program "resyntax fix "
@@ -197,6 +206,11 @@ changed relative to baseref are analyzed and fixed."
197206 (define rule-sym (string->symbol rule-name))
198207 (set! selected-rule rule-sym))
199208
209+ ("--analyzer-timeout "
210+ timeout-ms
211+ "The timeout in milliseconds for expansion analyzers. Defaults to 10000 (10 seconds). "
212+ (set! analyzer-timeout-ms (string->number timeout-ms)))
213+
200214 ("--max-pass-count "
201215 passcount
202216 "The maximum number of times Resyntax will fix each file. By default, Resyntax runs at most 10 \
@@ -235,7 +249,8 @@ are needed when applying a fix unlocks further fixes."
235249 #:max-fixes max-fixes
236250 #:max-modified-files max-modified-files
237251 #:max-modified-lines max-modified-lines
238- #:max-pass-count max-pass-count))
252+ #:max-pass-count max-pass-count
253+ #:analyzer-timeout-ms analyzer-timeout-ms))
239254
240255
241256(define (resyntax-run)
@@ -273,7 +288,8 @@ For help on these, use 'analyze --help' or 'fix --help'."
273288 (define analysis
274289 (resyntax-analyze-all sources
275290 #:suite (resyntax-analyze-options-suite options)
276- #:max-passes 1 ))
291+ #:max-passes 1
292+ #:timeout-ms (resyntax-analyze-options-analyzer-timeout-ms options)))
277293 (define results
278294 (transduce (resyntax-analysis-all-results analysis)
279295 (append-mapping in-hash-values)
@@ -322,7 +338,8 @@ For help on these, use 'analyze --help' or 'fix --help'."
322338 #:max-fixes (resyntax-fix-options-max-fixes options)
323339 #:max-passes (resyntax-fix-options-max-pass-count options)
324340 #:max-modified-sources max-modified-files
325- #:max-modified-lines max-modified-lines))
341+ #:max-modified-lines max-modified-lines
342+ #:timeout-ms (resyntax-fix-options-analyzer-timeout-ms options)))
326343 (match fix-method
327344 [(== modify-files)
328345 (resyntax-analysis-write-file-changes! analysis)]
0 commit comments