Skip to content

Commit

Permalink
Fix indentation removal
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Binzer-Panchal <mahesh.binzer-panchal@nbis.se>
  • Loading branch information
mahesh-panchal committed Jan 23, 2024
1 parent e3ff2ce commit 2992a92
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1219,16 +1219,14 @@ class TaskProcessor {
else {
if( task?.source ) {
message << "Source block:"
def ws_check = task.source =~ /\n(\s+)['"]{3}\n/
if( ws_check.find() ){
def whitespace = ws_check[0][1]
task.source.eachLine {
message << " ${it.startsWith(whitespace) ? it.substring(whitespace.size()) : it}"
}
} else {
task.source.eachLine {
message << " $it"
}
// Trim indentation
def ws_size = []
task.source.eachLine {
ws_size << it.indexOf(it.trim())
}
def min_ws_size = ws_size.findAll{ it > 0 }.min()
task.source.eachLine {
message << " ${min_ws_size && it.startsWith(" ") ? it.substring(min_ws_size) : it}"
}
}

Expand Down

0 comments on commit 2992a92

Please sign in to comment.