-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscanner.rs
More file actions
692 lines (647 loc) · 23.2 KB
/
Copy pathscanner.rs
File metadata and controls
692 lines (647 loc) · 23.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
// Project: macbash
// File: src/scanner.rs
// Purpose: Line-by-line rule matcher with shebang gating, here-doc skipping
// Language: Rust
//
// License: Apache-2.0
// Copyright: (c) 2025-2026 HYPERI PTY LIMITED
use std::collections::BTreeMap;
use std::path::Path;
use std::sync::OnceLock;
use regex::Regex;
use thiserror::Error;
use crate::rules::{FixType, MatchHit, RuleSet, Severity};
// Display strings omit `{source}` on purpose -- see the note on LoadError in
// src/rules/loader.rs.
#[derive(Debug, Error)]
pub enum ScanError {
#[error("compiling pattern for rule {rule_id}")]
BadPattern {
rule_id: String,
#[source]
source: regex::Error,
},
#[error("reading {path}")]
Read {
path: String,
#[source]
source: std::io::Error,
},
}
struct CompiledRule {
rule_id: String,
rule_pattern_starts_caret_hash: bool,
pattern: Regex,
negative: Option<Regex>,
shebang: Option<Regex>,
fix_type: FixType,
fix_template: String,
}
pub struct Scanner {
compiled: Vec<CompiledRule>,
}
impl Scanner {
/// Compile every rule in the set. Errors out on the first bad regex.
pub fn new(rs: &RuleSet) -> Result<Self, ScanError> {
let mut compiled = Vec::with_capacity(rs.rules.len());
for r in &rs.rules {
let pattern = Regex::new(&r.pattern).map_err(|e| ScanError::BadPattern {
rule_id: r.id.clone(),
source: e,
})?;
let negative = if r.negative_pattern.is_empty() {
None
} else {
Some(
Regex::new(&r.negative_pattern).map_err(|e| ScanError::BadPattern {
rule_id: r.id.clone(),
source: e,
})?,
)
};
let shebang = if r.shebang_match.is_empty() {
None
} else {
Some(
Regex::new(&r.shebang_match).map_err(|e| ScanError::BadPattern {
rule_id: r.id.clone(),
source: e,
})?,
)
};
compiled.push(CompiledRule {
rule_id: r.id.clone(),
rule_pattern_starts_caret_hash: r.pattern.starts_with("^#"),
pattern,
negative,
shebang,
fix_type: r.fix_type,
fix_template: r.fix_template.clone(),
});
}
Ok(Self { compiled })
}
pub fn rule_count(&self) -> usize {
self.compiled.len()
}
pub fn scan_file(&self, path: &Path) -> Result<Vec<MatchHit>, ScanError> {
let text = std::fs::read_to_string(path).map_err(|e| ScanError::Read {
path: path.display().to_string(),
source: e,
})?;
Ok(self.scan_text(&text, &path.display().to_string()))
}
pub fn scan_text(&self, text: &str, source: &str) -> Vec<MatchHit> {
let mut out: Vec<MatchHit> = Vec::new();
let mut shebang_owned: String = String::new();
let mut in_heredoc = false;
let mut heredoc_delim = String::new();
let lines: Vec<&str> = text.lines().collect();
for (idx, raw) in lines.iter().enumerate() {
// .lines() already handles \r\n by stripping the \r; line numbers
// are 1-based for users.
let line = *raw;
let line_num = idx + 1;
if line_num == 1 && line.starts_with("#!") {
shebang_owned = line.to_string();
}
if in_heredoc {
if line.trim() == heredoc_delim {
in_heredoc = false;
heredoc_delim.clear();
}
continue;
}
// Only enter here-doc mode if the terminator ACTUALLY appears
// later in the file. Detection is a regex over one line, so it
// will always have false positives -- and a false positive used
// to swallow every remaining line, making the scanner report a
// broken script as clean and exit 0. That is the worst failure a
// linter has, so the cost of a misdetection is capped here rather
// than trusted to the regex.
if let Some(d) = detect_heredoc(line)
&& lines[idx + 1..].iter().any(|l| l.trim() == d)
{
in_heredoc = true;
heredoc_delim = d;
}
let trimmed = line.trim();
if trimmed.is_empty() {
continue;
}
for cr in &self.compiled {
if let Some(sh) = &cr.shebang
&& !sh.is_match(&shebang_owned)
{
continue;
}
if trimmed.starts_with('#') && !cr.rule_pattern_starts_caret_hash {
continue;
}
let Some(m) = cr.pattern.find(line) else {
continue;
};
if let Some(neg) = &cr.negative
&& neg.is_match(line)
{
continue;
}
let mut hit = MatchHit {
rule_id: cr.rule_id.clone(),
file: source.to_string(),
line: line_num,
column: m.start() + 1,
content: line.to_string(),
matched_str: line[m.start()..m.end()].to_string(),
fixed_str: None,
};
if cr.fix_type == FixType::Replace && !cr.fix_template.is_empty() {
hit.fixed_str = Some(
cr.pattern
.replace_all(line, cr.fix_template.as_str())
.into_owned(),
);
}
out.push(hit);
}
}
out
}
pub fn scan_files<'a>(
&self,
paths: impl IntoIterator<Item = &'a Path>,
) -> Result<Vec<MatchHit>, ScanError> {
let mut all = Vec::new();
for p in paths {
all.extend(self.scan_file(p)?);
}
Ok(all)
}
}
/// Filter matches to those at or above `min`. The Go implementation uses
/// match.Rule.Severity directly; here we look the rule up by id from the
/// RuleSet to avoid stuffing a borrowed reference into MatchHit.
pub fn filter_by_severity(matches: Vec<MatchHit>, min: Severity, rs: &RuleSet) -> Vec<MatchHit> {
let min_rank = min.order();
let sev: BTreeMap<&str, Severity> = rs
.rules
.iter()
.map(|r| (r.id.as_str(), r.severity))
.collect();
matches
.into_iter()
.filter(|m| {
sev.get(m.rule_id.as_str())
.copied()
.map(|s| s.order())
.unwrap_or(0)
>= min_rank
})
.collect()
}
/// Return true if any match references a rule with severity = Error.
pub fn has_errors(matches: &[MatchHit], rs: &RuleSet) -> bool {
let by_id: BTreeMap<&str, Severity> = rs
.rules
.iter()
.map(|r| (r.id.as_str(), r.severity))
.collect();
matches
.iter()
.any(|m| by_id.get(m.rule_id.as_str()).copied() == Some(Severity::Error))
}
/// Group matches by file name (BTreeMap for stable iteration order).
pub fn group_by_file(matches: &[MatchHit]) -> BTreeMap<String, Vec<&MatchHit>> {
let mut g: BTreeMap<String, Vec<&MatchHit>> = BTreeMap::new();
for m in matches {
g.entry(m.file.clone()).or_default().push(m);
}
g
}
/// Detect here-doc start; returns the delimiter or None.
///
/// Derived from the Go regex `<<-?\s*['"]?(\w+)['"]?`, with two exclusions the
/// original lacked. Both were false positives that put the scanner into
/// here-doc mode on a line that starts no here-doc:
///
/// - `<<<` is a here-STRING. The bare regex matched from the second `<` and
/// read the first word of the string as a delimiter. `(?:^|[^<])` before the
/// `<<` stops that.
/// - `$((1 << 3))` is an arithmetic left shift, and `3` is not a delimiter.
/// A here-doc delimiter that is entirely digits is legal but effectively
/// never used, so rejecting it is far cheaper than the false positive.
///
/// `scan_text` additionally requires the delimiter to actually appear later in
/// the file, so anything this still gets wrong degrades to scanning a few
/// extra lines rather than skipping the rest of the file.
pub fn detect_heredoc(line: &str) -> Option<String> {
static RE: OnceLock<Regex> = OnceLock::new();
let re = RE.get_or_init(|| Regex::new(r#"(?:^|[^<])<<-?\s*['"]?(\w+)['"]?"#).unwrap());
let delim = re.captures(line).map(|c| c[1].to_string())?;
if delim.bytes().all(|b| b.is_ascii_digit()) {
return None;
}
Some(delim)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::rules::{FixType, Rule, RuleSet, Severity, load_builtin};
fn rule(id: &str, pattern: &str, sev: Severity) -> Rule {
Rule {
id: id.to_string(),
name: id.to_string(),
description: String::new(),
severity: sev,
pattern: pattern.to_string(),
negative_pattern: String::new(),
shebang_match: String::new(),
fix_type: FixType::Suggest,
fix_template: String::new(),
why_unfixable: String::new(),
fix_function: String::new(),
examples: Default::default(),
tags: vec![],
references: vec![],
test_cases: Default::default(),
}
}
#[test]
fn new_compiles_valid_pattern() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![rule("test-rule", r"echo\s+-e", Severity::Warning)],
};
let s = Scanner::new(&rs).unwrap();
assert_eq!(s.rule_count(), 1);
}
#[test]
fn new_rejects_invalid_pattern() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![rule("bad-rule", "[invalid", Severity::Warning)],
};
assert!(Scanner::new(&rs).is_err());
}
#[test]
fn scan_text_finds_echo_e_and_grep_p() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![
rule("echo-escape", r"echo\s+-e\s", Severity::Warning),
rule("grep-perl", r"grep\s+-P\s", Severity::Error),
],
};
let s = Scanner::new(&rs).unwrap();
let text = "#!/bin/bash\necho -e \"hello\\nworld\"\ngrep -P '\\d+' file.txt\n";
let matches = s.scan_text(text, "test.sh");
assert_eq!(matches.len(), 2);
assert_eq!(matches[0].rule_id, "echo-escape");
assert_eq!(matches[0].line, 2);
assert_eq!(matches[1].rule_id, "grep-perl");
assert_eq!(matches[1].line, 3);
}
#[test]
fn negative_pattern_suppresses_match() {
let mut r = rule("realpath-unchecked", r"\brealpath\s+", Severity::Warning);
r.negative_pattern = r"command\s+-v\s+realpath".to_string();
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![r],
};
let s = Scanner::new(&rs).unwrap();
let text = "#!/bin/bash\n# Check if realpath exists before using\ncommand -v realpath && realpath /some/path\nrealpath /another/path\n";
let matches = s.scan_text(text, "test.sh");
assert_eq!(matches.len(), 1);
assert_eq!(matches[0].line, 4);
}
#[test]
fn shebang_match_gates_rule_to_bin_sh() {
let mut r = rule("posix-double-bracket", r"\[\[", Severity::Error);
r.shebang_match = r"^#!/bin/sh".to_string();
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![r],
};
let s = Scanner::new(&rs).unwrap();
let sh_hits = s.scan_text("#!/bin/sh\nif [[ -f foo ]]; then echo yes; fi\n", "sh.sh");
assert_eq!(sh_hits.len(), 1, "[[ in /bin/sh must match");
let bash_hits = s.scan_text(
"#!/bin/bash\nif [[ -f foo ]]; then echo yes; fi\n",
"bash.sh",
);
assert_eq!(bash_hits.len(), 0, "[[ in /bin/bash must be skipped");
let env_hits = s.scan_text(
"#!/usr/bin/env bash\nif [[ -f foo ]]; then echo yes; fi\n",
"env.sh",
);
assert_eq!(env_hits.len(), 0, "[[ in env bash must be skipped");
}
#[test]
fn heredoc_lines_are_skipped() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![
rule("echo-escape", r"echo\s+-e\s", Severity::Warning),
rule("grep-perl", r"grep\s+-P\s", Severity::Error),
],
};
let s = Scanner::new(&rs).unwrap();
let text = concat!(
"#!/bin/bash\n",
"cat <<EOF\n",
"echo -e \"this is inside a heredoc and should be skipped\"\n",
"grep -P '\\d+' not-a-real-command\n",
"EOF\n",
"echo -e \"this is real code and should be caught\"\n",
);
let matches = s.scan_text(text, "hd.sh");
assert_eq!(matches.len(), 1);
assert_eq!(matches[0].line, 6);
}
#[test]
fn timeout_false_positive_suppressed_by_negative_pattern() {
let mut r = rule("timeout-command", r"\btimeout\s+(\d)", Severity::Error);
r.negative_pattern = "-timeout".to_string();
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![r],
};
let s = Scanner::new(&rs).unwrap();
let text = concat!(
"#!/bin/bash\n",
"timeout 5 some-command\n",
"golangci-lint run --timeout 5m\n",
"curl --connect-timeout 30 https://example.com\n",
);
let matches = s.scan_text(text, "t.sh");
assert_eq!(matches.len(), 1);
assert_eq!(matches[0].line, 2);
}
#[test]
fn detect_heredoc_table() {
let cases = [
("cat <<EOF", Some("EOF")),
("cat <<'EOF'", Some("EOF")),
("cat <<\"EOF\"", Some("EOF")),
("cat <<-EOF", Some("EOF")),
("cat <<-'MARKER'", Some("MARKER")),
("echo hello", None),
// Here-STRING, not a here-doc. The bare `<<-?...` regex matched
// from the second `<` and took "some" as a delimiter.
("grep -q pat <<< \"some text\"", None),
("grep -q pat <<<\"$var\"", None),
// Arithmetic left shift, not a here-doc.
("mask=$((1 << 3))", None),
("x=$(( 1 << 16 ))", None),
];
for (line, want) in cases {
let got = detect_heredoc(line);
assert_eq!(
got.as_deref(),
want,
"detect_heredoc({line:?}) returned {got:?}"
);
}
}
/// A linter that reports a broken script as clean is worse than one that
/// misses a rule. A here-doc false positive used to swallow every
/// remaining line of the file, so `mask=$((1 << 3))` or a here-string
/// above the problems made macbash print "No issues found." and exit 0.
#[test]
fn a_false_heredoc_does_not_blind_the_rest_of_the_file() {
let rs = load_builtin().unwrap();
let s = Scanner::new(&rs).unwrap();
for preamble in [
"mask=$((1 << 3))",
"grep -q pattern <<< \"some text\"",
// Even a plausible-looking delimiter that never terminates must
// not swallow the file -- scan_text requires the terminator to
// exist further down.
"cat <<NEVER_CLOSED",
] {
let text =
format!("#!/bin/bash\n{preamble}\nsed -i 's/a/b/' file.txt\ndeclare -A map\n");
let hits = s.scan_text(&text, "t.sh");
assert!(
hits.iter().any(|h| h.rule_id == "sed-inplace-no-backup"),
"sed finding lost after {preamble:?}"
);
assert!(
hits.iter().any(|h| h.rule_id == "bash4-associative-array"),
"declare -A finding lost after {preamble:?}"
);
}
}
/// The flip side: a REAL here-doc still suppresses its body.
#[test]
fn a_real_heredoc_still_skips_its_body() {
let rs = load_builtin().unwrap();
let s = Scanner::new(&rs).unwrap();
let text = concat!(
"#!/bin/bash\n",
"cat <<EOF\n",
"sed -i 's/a/b/' inside.txt\n",
"EOF\n",
"sed -i 's/c/d/' outside.txt\n",
);
let hits = s.scan_text(text, "t.sh");
let sed: Vec<_> = hits
.iter()
.filter(|h| h.rule_id == "sed-inplace-no-backup")
.collect();
assert_eq!(sed.len(), 1, "only the line outside the here-doc counts");
assert_eq!(sed[0].line, 5);
}
#[test]
fn builtin_rules_all_compile() {
let rs = load_builtin().unwrap();
let s = Scanner::new(&rs).unwrap();
assert!(s.rule_count() > 0);
assert_eq!(s.rule_count(), rs.rules.len());
}
#[test]
fn filter_by_severity_counts() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![
rule("i1", "x", Severity::Info),
rule("w1", "x", Severity::Warning),
rule("e1", "x", Severity::Error),
rule("i2", "x", Severity::Info),
],
};
let matches: Vec<MatchHit> = rs
.rules
.iter()
.map(|r| MatchHit {
rule_id: r.id.clone(),
file: "t.sh".to_string(),
line: 1,
column: 1,
content: String::new(),
matched_str: String::new(),
fixed_str: None,
})
.collect();
assert_eq!(
filter_by_severity(matches.clone(), Severity::Info, &rs).len(),
4
);
assert_eq!(
filter_by_severity(matches.clone(), Severity::Warning, &rs).len(),
2
);
assert_eq!(filter_by_severity(matches, Severity::Error, &rs).len(), 1);
}
#[test]
fn has_errors_table() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![
rule("w", "x", Severity::Warning),
rule("e", "x", Severity::Error),
],
};
let warn_only = vec![MatchHit {
rule_id: "w".to_string(),
file: "t.sh".to_string(),
line: 1,
column: 1,
content: String::new(),
matched_str: String::new(),
fixed_str: None,
}];
let with_error = vec![
warn_only[0].clone(),
MatchHit {
rule_id: "e".to_string(),
file: "t.sh".to_string(),
line: 2,
column: 1,
content: String::new(),
matched_str: String::new(),
fixed_str: None,
},
];
assert!(!has_errors(&[], &rs));
assert!(!has_errors(&warn_only, &rs));
assert!(has_errors(&with_error, &rs));
}
#[test]
fn columns_are_one_based() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![rule("sed-inplace", r"sed\s+-i\s+[^.]", Severity::Error)],
};
let s = Scanner::new(&rs).unwrap();
let matches = s.scan_text(" sed -i 's/a/b/' f\n", "t.sh");
assert_eq!(matches.len(), 1);
assert_eq!(matches[0].column, 4);
}
#[test]
fn comment_lines_skipped_unless_pattern_starts_caret_hash() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![
rule("sed-inplace", r"sed\s+-i\s+[^.]", Severity::Error),
rule("shebang-bin-bash", r"^#!/bin/bash\s*$", Severity::Info),
],
};
let s = Scanner::new(&rs).unwrap();
let m1 = s.scan_text("# sed -i 's/a/b/' file\n", "t.sh");
assert!(!m1.iter().any(|h| h.rule_id == "sed-inplace"));
let m2 = s.scan_text("#!/bin/bash\n", "t.sh");
assert!(m2.iter().any(|h| h.rule_id == "shebang-bin-bash"));
}
#[test]
fn crlf_inputs_yield_correct_line_numbers() {
let rs = RuleSet {
version: "1.0".to_string(),
rules: vec![rule("echo-escape", r"echo\s+-e\s", Severity::Warning)],
};
let s = Scanner::new(&rs).unwrap();
let matches = s.scan_text("#!/bin/bash\r\necho -e foo\r\n", "win.sh");
assert_eq!(matches.len(), 1);
assert_eq!(matches[0].line, 2);
}
#[test]
fn group_by_file_groups_correctly() {
let m: Vec<MatchHit> = vec![
MatchHit {
rule_id: "r".into(),
file: "a.sh".into(),
line: 1,
column: 1,
content: String::new(),
matched_str: String::new(),
fixed_str: None,
},
MatchHit {
rule_id: "r".into(),
file: "b.sh".into(),
line: 1,
column: 1,
content: String::new(),
matched_str: String::new(),
fixed_str: None,
},
MatchHit {
rule_id: "r".into(),
file: "a.sh".into(),
line: 2,
column: 1,
content: String::new(),
matched_str: String::new(),
fixed_str: None,
},
];
let g = group_by_file(&m);
assert_eq!(g.len(), 2);
assert_eq!(g["a.sh"].len(), 2);
assert_eq!(g["b.sh"].len(), 1);
}
use crate::testutil::synthesise_script;
#[test]
fn every_should_match_example_matches_its_own_rule() {
let rs = load_builtin().unwrap();
let s = Scanner::new(&rs).unwrap();
let mut failures: Vec<String> = Vec::new();
for rule in &rs.rules {
for ex in &rule.test_cases.should_match {
let text = synthesise_script(rule, ex);
let hits = s.scan_text(&text, "ex.sh");
if !hits.iter().any(|h| h.rule_id == rule.id) {
failures.push(format!("rule {} did not match: {ex:?}", rule.id));
}
}
}
assert!(
failures.is_empty(),
"should_match failures ({}):\n{}",
failures.len(),
failures.join("\n")
);
}
#[test]
fn no_should_not_match_example_matches_its_own_rule() {
let rs = load_builtin().unwrap();
let s = Scanner::new(&rs).unwrap();
let mut failures: Vec<String> = Vec::new();
for rule in &rs.rules {
for ex in &rule.test_cases.should_not_match {
let text = synthesise_script(rule, ex);
let hits = s.scan_text(&text, "ex.sh");
if hits.iter().any(|h| h.rule_id == rule.id) {
failures.push(format!("rule {} unexpectedly matched: {ex:?}", rule.id));
}
}
}
assert!(
failures.is_empty(),
"should_not_match failures ({}):\n{}",
failures.len(),
failures.join("\n")
);
}
}