Skip to content

Commit

Permalink
Add more debug logging for github review workflow
Browse files Browse the repository at this point in the history
Part of #298.
  • Loading branch information
jackfirth committed Sep 19, 2024
1 parent cd946f0 commit f5e541e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 17 additions & 1 deletion main.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,27 @@
[result
(in-option
(refactoring-rules-refactor rule-list stx #:comments comments #:analysis analysis))]
#:when (range-set-encloses? lines (refactoring-result-modified-line-range result)))
#:when (check-lines-enclose-refactoring-result lines result))
(values (cons result results)
(range-set-add modified-positions (refactoring-result-modified-range result)))))


(define (check-lines-enclose-refactoring-result lines result)
(define modified-lines (refactoring-result-modified-line-range result))
(define enclosed? (range-set-encloses? lines modified-lines))
(unless enclosed?
(log-resyntax-info
(string-append "~a: suggestion discarded because it's outside the analyzed line range\n"
" analyzed lines: ~a\n"
" lines modified by result: ~a\n"
" result: ~a")
(refactoring-result-rule-name result)
lines
modified-lines
result))
enclosed?)


(define (refactor! results)
(define results-by-path
(transduce results
Expand Down
2 changes: 2 additions & 0 deletions private/file-group.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
rebellion/collection/range-set
rebellion/streaming/transducer
resyntax/private/git
resyntax/private/logger
resyntax/private/run-command)


Expand Down Expand Up @@ -105,6 +106,7 @@
(parameterize ([current-directory repository-path])
(define diff-lines (git-diff-modified-lines ref))
(for/list ([(file lines) (in-hash diff-lines)])
(log-resyntax-debug "~a: modified lines: ~a" file lines)
(file-portion file lines)))]))
(transduce files (filtering rkt-file?) #:into into-list))

Expand Down

0 comments on commit f5e541e

Please sign in to comment.