Skip to content

Commit f73ae3b

Browse files
committed
update
1 parent c2edf36 commit f73ae3b

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

crates/roughly/tests/format/formatter.template.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ The formatter follows these key principles:
2828

2929
### Why Non-Invasive?
3030

31-
R is an expression-based language with a strong focus on numerical computing and data analysis. Unlike many other programming languages, R code is often written interactively and exploratively, where preserving the original intent and structure of expressions is crucial for readability and debugging.
32-
33-
The non-invasive approach means roughly respects your existing line breaks and won't arbitrarily split expressions that you've chosen to keep on one line. **Non-invasive formatting tries to minimize the amount of line-breaks not set by the programmer** by following these key principles:
31+
The non-invasive approach means Roughly respects your existing line breaks and won't arbitrarily split expressions that you've chosen to keep on one line. **Non-invasive formatting tries to minimize the amount of line-breaks not set by the programmer** by following these key principles:
3432

3533
- **Single line expressions are never broken into multiple lines** (with the exception of loops like `for`, `while`, `repeat`, because they don't yield useful values and can only perform side effects, so they are not normal expressions in that sense)
3634
- **Both hugging and not hugging is allowed** for function calls and other constructs
@@ -39,9 +37,8 @@ The non-invasive approach means roughly respects your existing line breaks and w
3937
This is particularly important in R because:
4038

4139
- **Data analysis workflows**: Short, expressive one-liners are common and meaningful
42-
- **Interactive development**: Code is often built incrementally, and forced line breaks can disrupt the flow
4340
- **Mathematical expressions**: Complex formulas are often more readable when kept compact
44-
- **Functional style**: R's functional nature benefits from preserving the structure of nested calls
41+
- **Functional style**: R's functional nature benefits from preserving the structure of nested expresions
4542

4643
#### Why This Matters for Numerical Computing
4744

@@ -285,7 +282,7 @@ if(
285282

286283
```r
287284
# for_loops : compare
288-
for(item in data) process(item)
285+
for(item in sequence) process(item)
289286
```
290287

291288
**While loops** follow similar block enforcement rules:

crates/roughly/tests/snapshots/test_format__documentation_examples__for_loops.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
source: crates/roughly/tests/test_format.rs
33
expression: code
44
---
5-
for (item in collection) {
5+
for (item in sequence) {
66
process(item)
77
}

docs/content/formatter.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ The formatter follows these key principles:
2828

2929
### Why Non-Invasive?
3030

31-
R is an expression-based language with a strong focus on numerical computing and data analysis. Unlike many other programming languages, R code is often written interactively and exploratively, where preserving the original intent and structure of expressions is crucial for readability and debugging.
32-
33-
The non-invasive approach means roughly respects your existing line breaks and won't arbitrarily split expressions that you've chosen to keep on one line. **Non-invasive formatting tries to minimize the amount of line-breaks not set by the programmer** by following these key principles:
31+
The non-invasive approach means Roughly respects your existing line breaks and won't arbitrarily split expressions that you've chosen to keep on one line. **Non-invasive formatting tries to minimize the amount of line-breaks not set by the programmer** by following these key principles:
3432

3533
- **Single line expressions are never broken into multiple lines** (with the exception of loops like `for`, `while`, `repeat`, because they don't yield useful values and can only perform side effects, so they are not normal expressions in that sense)
3634
- **Both hugging and not hugging is allowed** for function calls and other constructs
@@ -39,9 +37,8 @@ The non-invasive approach means roughly respects your existing line breaks and w
3937
This is particularly important in R because:
4038

4139
- **Data analysis workflows**: Short, expressive one-liners are common and meaningful
42-
- **Interactive development**: Code is often built incrementally, and forced line breaks can disrupt the flow
4340
- **Mathematical expressions**: Complex formulas are often more readable when kept compact
44-
- **Functional style**: R's functional nature benefits from preserving the structure of nested calls
41+
- **Functional style**: R's functional nature benefits from preserving the structure of nested expresions
4542

4643
#### Why This Matters for Numerical Computing
4744

@@ -345,10 +342,10 @@ if (
345342

346343
```r
347344
# Before formatting
348-
for(item in collection) process(item)
345+
for(item in sequence) process(item)
349346

350347
# After formatting
351-
for (item in collection) {
348+
for (item in sequence) {
352349
process(item)
353350
}
354351
```

0 commit comments

Comments
 (0)