prettycsharp 1.1.1__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/CHANGELOG.md +8 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/DESIGN.md +8 -6
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/PKG-INFO +3 -3
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/README.md +2 -2
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/__init__.py +1 -1
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/settings.py +3 -3
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_layout.py +34 -6
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_rewrites.py +0 -1
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_settings.py +8 -6
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.gitattributes +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/codeql/codeql-config.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/dependabot.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/build.in +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/build.txt +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/fuzz.in +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/fuzz.txt +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/pip-audit.in +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/pip-audit.txt +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/runtime.in +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/runtime.txt +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/test.in +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/test.txt +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/zizmor.in +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/requirements/zizmor.txt +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/security/accepted.toml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/security/clamav/Dockerfile +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/security/malware-accepted.toml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/security/semgrep/Dockerfile +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/security/yara.json +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/security/yara_update.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/auto-merge.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/ci.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/fuzz.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/malware-scan.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/publish.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/scorecard.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/security.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/workflows/update-yara-rules.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.github/zizmor.yml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/.gitignore +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/AGENTS.md +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/CLAUDE.md +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/LICENSE +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/SECURITY.md +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/fuzz/fuzz_formatter.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/pyproject.toml +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/scripts/security/malware_report.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/scripts/security/security_report.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/__main__.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/cli.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/conditional.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/config.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/doc.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/formatter.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/ignore.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/isolate.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/parsing.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/printer/__init__.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/printer/core.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/printer/declarations.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/printer/expressions.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/printer/statements.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/project.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/py.typed +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/rewrites.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/syntax.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/src/prettycsharp/verify.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/declarations.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/directives.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/embedded_statements.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/expressions.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/members.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/order.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/queries_and_patterns.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/split_by_conditionals.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/statements.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/fuzz_corpus/csharp/strings.cs +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/support.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_cli.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_conditional.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_config.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_doc.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_docs.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_format_around.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_fuzz_corpus.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_ignore.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_parsing.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_project.py +0 -0
- {prettycsharp-1.1.1 → prettycsharp-1.1.2}/tests/test_verify.py +0 -0
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Each release's section becomes the body of its GitHub release.
|
|
4
4
|
|
|
5
|
+
## [1.1.2] - 2026-10-17
|
|
6
|
+
|
|
7
|
+
- Nothing is padded into columns by default any more: `align_assignments`,
|
|
8
|
+
`align_enum_values` and `align_switch_arms` now default to `false`, so each
|
|
9
|
+
`=` and `=>` has one space before it. Padded columns shift whenever one
|
|
10
|
+
line changes, and the diff then touches every line of the run. Set any of
|
|
11
|
+
the three to `true` to align as before.
|
|
12
|
+
|
|
5
13
|
## [1.1.1] - 2026-10-17
|
|
6
14
|
|
|
7
15
|
- `syntax_errors = "format_around"` now works inside each view of a file
|
|
@@ -233,12 +233,14 @@ int[] codes = [200, 404];
|
|
|
233
233
|
|
|
234
234
|
| Setting | Default | Alternatives |
|
|
235
235
|
| --- | --- | --- |
|
|
236
|
-
| `align_switch_arms` | `
|
|
237
|
-
| `align_assignments` | `true`: consecutive local assignments and field initializers |
|
|
238
|
-
| `align_enum_values` | `
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
| `align_switch_arms` | `false`: one space before each arm's `=>` | `true` |
|
|
237
|
+
| `align_assignments` | `false`: one space before each `=` | `true`: consecutive local assignments and field initializers |
|
|
238
|
+
| `align_enum_values` | `false`: one space before each `=` | `true` |
|
|
239
|
+
|
|
240
|
+
By default nothing is padded into columns: alignment shifts whenever one line
|
|
241
|
+
changes, and the diff touches every line of the run. Turned on, only the `=`
|
|
242
|
+
or `=>` aligns; types and names are not put into columns, and a run ends at a
|
|
243
|
+
blank line or at any statement of a different kind:
|
|
242
244
|
|
|
243
245
|
```csharp
|
|
244
246
|
var id = order.Id;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: prettycsharp
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: An opinionated formatter for C#, in the spirit of Prettier
|
|
5
5
|
Project-URL: Homepage, https://github.com/WilliamSmithEdward/prettyCSharp
|
|
6
6
|
Project-URL: Repository, https://github.com/WilliamSmithEdward/prettyCSharp
|
|
@@ -47,7 +47,7 @@ Description-Content-Type: text/markdown
|
|
|
47
47
|
An opinionated formatter for C#, written in Python, in the spirit of Prettier.
|
|
48
48
|
It parses each file with [tree-sitter](https://tree-sitter.github.io/) and
|
|
49
49
|
reprints the whole file in one consistent layout: braces, indentation, line
|
|
50
|
-
breaks, blank lines
|
|
50
|
+
breaks, blank lines and a few safe rewrites such as file-scoped
|
|
51
51
|
namespaces, sorted usings and expression-bodied members. It needs no .NET
|
|
52
52
|
SDK.
|
|
53
53
|
|
|
@@ -175,7 +175,7 @@ Settings come from, highest precedence first:
|
|
|
175
175
|
max_line_length = 100
|
|
176
176
|
brace_style = "kr"
|
|
177
177
|
continuation_keywords = "same_line"
|
|
178
|
-
align_assignments =
|
|
178
|
+
align_assignments = true
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
Every setting, its default, its alternatives and an example of each layout
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
An opinionated formatter for C#, written in Python, in the spirit of Prettier.
|
|
13
13
|
It parses each file with [tree-sitter](https://tree-sitter.github.io/) and
|
|
14
14
|
reprints the whole file in one consistent layout: braces, indentation, line
|
|
15
|
-
breaks, blank lines
|
|
15
|
+
breaks, blank lines and a few safe rewrites such as file-scoped
|
|
16
16
|
namespaces, sorted usings and expression-bodied members. It needs no .NET
|
|
17
17
|
SDK.
|
|
18
18
|
|
|
@@ -140,7 +140,7 @@ Settings come from, highest precedence first:
|
|
|
140
140
|
max_line_length = 100
|
|
141
141
|
brace_style = "kr"
|
|
142
142
|
continuation_keywords = "same_line"
|
|
143
|
-
align_assignments =
|
|
143
|
+
align_assignments = true
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
Every setting, its default, its alternatives and an example of each layout
|
|
@@ -4,7 +4,7 @@ from prettycsharp.formatter import FormatResult, FormattingError, format_details
|
|
|
4
4
|
from prettycsharp.parsing import CSharpSyntaxError
|
|
5
5
|
from prettycsharp.settings import Settings, SettingsError
|
|
6
6
|
|
|
7
|
-
__version__ = "1.1.
|
|
7
|
+
__version__ = "1.1.2"
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"CSharpSyntaxError",
|
|
@@ -70,9 +70,9 @@ class Settings:
|
|
|
70
70
|
simple_lists_inline: bool = True
|
|
71
71
|
trailing_commas: str = "remove"
|
|
72
72
|
|
|
73
|
-
align_switch_arms: bool =
|
|
74
|
-
align_assignments: bool =
|
|
75
|
-
align_enum_values: bool =
|
|
73
|
+
align_switch_arms: bool = False
|
|
74
|
+
align_assignments: bool = False
|
|
75
|
+
align_enum_values: bool = False
|
|
76
76
|
|
|
77
77
|
switch_case_indent: bool = True
|
|
78
78
|
switch_case_blank_lines: bool = True
|
|
@@ -131,7 +131,6 @@ def test_single_call_and_property_chains_stay_on_one_line() -> None:
|
|
|
131
131
|
var city = order.Customer.Address.City;
|
|
132
132
|
var zip = order.Customer.Address.GetPostalCode();
|
|
133
133
|
""",
|
|
134
|
-
align_assignments=False,
|
|
135
134
|
)
|
|
136
135
|
|
|
137
136
|
|
|
@@ -230,7 +229,7 @@ def test_fields_grouped_tight_and_blank_lines_around_members_with_bodies() -> No
|
|
|
230
229
|
|
|
231
230
|
public Order(int id, string name)
|
|
232
231
|
{
|
|
233
|
-
_id
|
|
232
|
+
_id = id;
|
|
234
233
|
_name = name;
|
|
235
234
|
}
|
|
236
235
|
|
|
@@ -429,7 +428,6 @@ def test_simple_value_lists_stay_inline_and_complex_ones_break() -> None:
|
|
|
429
428
|
new Point(1, 1)
|
|
430
429
|
};
|
|
431
430
|
""",
|
|
432
|
-
align_assignments=False,
|
|
433
431
|
)
|
|
434
432
|
|
|
435
433
|
|
|
@@ -513,7 +511,35 @@ def test_switch_sections_are_indented_with_blank_lines_between() -> None:
|
|
|
513
511
|
)
|
|
514
512
|
|
|
515
513
|
|
|
516
|
-
def
|
|
514
|
+
def test_nothing_is_padded_into_columns() -> None:
|
|
515
|
+
check(
|
|
516
|
+
"""
|
|
517
|
+
var label = status switch { Status.Paid => "Paid", Status.Pending => "Pending", _ => "Unknown" };
|
|
518
|
+
var id = order.Id;
|
|
519
|
+
var customer = order.Customer;
|
|
520
|
+
public enum Status { Pending = 0, Paid = 1, Cancelled = 2 }
|
|
521
|
+
""",
|
|
522
|
+
"""
|
|
523
|
+
var label = status switch
|
|
524
|
+
{
|
|
525
|
+
Status.Paid => "Paid",
|
|
526
|
+
Status.Pending => "Pending",
|
|
527
|
+
_ => "Unknown"
|
|
528
|
+
};
|
|
529
|
+
var id = order.Id;
|
|
530
|
+
var customer = order.Customer;
|
|
531
|
+
|
|
532
|
+
public enum Status
|
|
533
|
+
{
|
|
534
|
+
Pending = 0,
|
|
535
|
+
Paid = 1,
|
|
536
|
+
Cancelled = 2
|
|
537
|
+
}
|
|
538
|
+
""",
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
def test_switch_expression_arms_align_when_turned_on() -> None:
|
|
517
543
|
check(
|
|
518
544
|
"""
|
|
519
545
|
var label = status switch { Status.Paid => "Paid", Status.Pending => "Pending", _ => "Unknown" };
|
|
@@ -526,10 +552,11 @@ def test_switch_expression_arms_align_their_arrows() -> None:
|
|
|
526
552
|
_ => "Unknown"
|
|
527
553
|
};
|
|
528
554
|
""",
|
|
555
|
+
align_switch_arms=True,
|
|
529
556
|
)
|
|
530
557
|
|
|
531
558
|
|
|
532
|
-
def
|
|
559
|
+
def test_assignments_and_enum_values_align_when_turned_on() -> None:
|
|
533
560
|
check(
|
|
534
561
|
"""
|
|
535
562
|
var id = order.Id;
|
|
@@ -551,6 +578,8 @@ def test_consecutive_assignments_and_enum_values_align() -> None:
|
|
|
551
578
|
Cancelled = 2
|
|
552
579
|
}
|
|
553
580
|
""",
|
|
581
|
+
align_assignments=True,
|
|
582
|
+
align_enum_values=True,
|
|
554
583
|
)
|
|
555
584
|
|
|
556
585
|
|
|
@@ -797,7 +826,6 @@ def test_raw_and_verbatim_strings_are_untouched() -> None:
|
|
|
797
826
|
""";
|
|
798
827
|
var path = @"C:\\orders\\ ";
|
|
799
828
|
''',
|
|
800
|
-
align_assignments=False,
|
|
801
829
|
)
|
|
802
830
|
|
|
803
831
|
|
|
@@ -238,13 +238,15 @@ def test_initializer_break_threshold_zero_and_simple_lists() -> None:
|
|
|
238
238
|
assert fmt("var a = new[] { 1, 2 };\n", simple_lists_inline=False) == "var a = new[]\n{\n 1,\n 2\n};\n"
|
|
239
239
|
|
|
240
240
|
|
|
241
|
-
def
|
|
241
|
+
def test_alignment_is_off_by_default_and_each_setting_turns_it_on() -> None:
|
|
242
242
|
source = "var id = order.Id;\nvar customer = order.Customer;\n"
|
|
243
|
-
assert fmt(source
|
|
244
|
-
assert fmt(
|
|
245
|
-
|
|
246
|
-
) == 'var l = s switch\n{\n 1 => "a",\n 22 => "b"\n};\n'
|
|
247
|
-
assert fmt(
|
|
243
|
+
assert fmt(source) == source
|
|
244
|
+
assert fmt(source, align_assignments=True) == "var id = order.Id;\nvar customer = order.Customer;\n"
|
|
245
|
+
switch = 'var l = s switch { 1 => "a", 22 => "b" };\n'
|
|
246
|
+
assert fmt(switch) == 'var l = s switch\n{\n 1 => "a",\n 22 => "b"\n};\n'
|
|
247
|
+
assert fmt(switch, align_switch_arms=True) == 'var l = s switch\n{\n 1 => "a",\n 22 => "b"\n};\n'
|
|
248
|
+
assert fmt("enum E { A = 1, Bb = 2 }\n") == "enum E\n{\n A = 1,\n Bb = 2\n}\n"
|
|
249
|
+
assert fmt("enum E { A = 1, Bb = 2 }\n", align_enum_values=True) == "enum E\n{\n A = 1,\n Bb = 2\n}\n"
|
|
248
250
|
|
|
249
251
|
|
|
250
252
|
def test_switch_case_indent_and_blank_lines_off() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|