prettycsharp 1.1.6__tar.gz → 1.1.7__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.6 → prettycsharp-1.1.7}/CHANGELOG.md +6 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/DESIGN.md +3 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/PKG-INFO +1 -1
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/__init__.py +1 -1
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/printer/statements.py +5 -1
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_layout.py +23 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.gitattributes +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/codeql/codeql-config.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/dependabot.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/build.in +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/build.txt +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/fuzz.in +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/fuzz.txt +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/pip-audit.in +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/pip-audit.txt +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/runtime.in +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/runtime.txt +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/test.in +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/test.txt +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/zizmor.in +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/requirements/zizmor.txt +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/security/accepted.toml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/security/clamav/Dockerfile +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/security/malware-accepted.toml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/security/semgrep/Dockerfile +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/security/yara.json +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/security/yara_update.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/auto-merge.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/ci.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/fuzz.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/malware-scan.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/publish.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/scorecard.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/security.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/workflows/update-yara-rules.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.github/zizmor.yml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/.gitignore +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/AGENTS.md +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/CLAUDE.md +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/LICENSE +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/README.md +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/SECURITY.md +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/fuzz/fuzz_formatter.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/pyproject.toml +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/scripts/security/malware_report.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/scripts/security/security_report.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/__main__.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/cli.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/conditional.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/config.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/doc.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/formatter.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/ignore.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/isolate.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/parsing.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/printer/__init__.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/printer/core.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/printer/declarations.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/printer/expressions.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/project.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/py.typed +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/rewrites.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/settings.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/syntax.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/src/prettycsharp/verify.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/comment_only_accessor_list.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/declarations.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/directives.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/embedded_statements.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/expressions.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/members.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/order.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/queries_and_patterns.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/split_by_conditionals.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/statements.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/strings.cs +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/support.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_cli.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_conditional.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_config.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_doc.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_docs.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_format_around.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_fuzz_corpus.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_ignore.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_parsing.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_project.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_rewrites.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_settings.py +0 -0
- {prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/test_verify.py +0 -0
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Each release's section becomes the body of its GitHub release.
|
|
4
4
|
|
|
5
|
+
## [1.1.7] - 2026-10-18
|
|
6
|
+
|
|
7
|
+
- Comments after the final `switch` section align with its statements
|
|
8
|
+
instead of its case label, avoiding Visual Studio's IDE0055 formatting
|
|
9
|
+
diagnostic. Switches containing only comments keep one indentation level.
|
|
10
|
+
|
|
5
11
|
## [1.1.6] - 2026-10-18
|
|
6
12
|
|
|
7
13
|
- `for` headers keep a space between semicolons when the condition is
|
|
@@ -273,6 +273,9 @@ public enum Status
|
|
|
273
273
|
| `switch_case_indent` | `true` | `false` |
|
|
274
274
|
| `switch_case_blank_lines` | `true`: blank line between case sections; stacked fall-through labels stay together | `false` |
|
|
275
275
|
|
|
276
|
+
Comments after the final switch section align with its statements. A switch
|
|
277
|
+
containing only comments indents them one level inside its braces.
|
|
278
|
+
|
|
276
279
|
### Syntax rewrites
|
|
277
280
|
|
|
278
281
|
These change tokens, not only whitespace. Verification accounts for each one.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: prettycsharp
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7
|
|
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
|
|
@@ -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.7"
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"CSharpSyntaxError",
|
|
@@ -327,7 +327,11 @@ class Statements(Expressions):
|
|
|
327
327
|
lines = [HARDLINE, self.print_list(sections, self.section_blank)]
|
|
328
328
|
# Case labels sit one level in, or flush with switch.
|
|
329
329
|
body = indent(lines) if self.settings.switch_case_indent else lines
|
|
330
|
-
|
|
330
|
+
comments = self.close_comments(close_tok)
|
|
331
|
+
# Trailing comments belong at the final section's statement level.
|
|
332
|
+
if self.settings.switch_case_indent and any(section.type == "switch_section" for section in sections):
|
|
333
|
+
comments = indent(comments)
|
|
334
|
+
return [self.tok(open_tok), body, comments, HARDLINE, self.tok(close_tok, leading=False)]
|
|
331
335
|
|
|
332
336
|
def section_blank(self, previous: Node, item: Node) -> bool:
|
|
333
337
|
if self.tight_directive(previous, item):
|
|
@@ -561,6 +561,29 @@ def test_nothing_is_padded_into_columns() -> None:
|
|
|
561
561
|
)
|
|
562
562
|
|
|
563
563
|
|
|
564
|
+
@pytest.mark.parametrize("case_indent", [True, False])
|
|
565
|
+
@pytest.mark.parametrize("comment", ["// Unknown settings are ignored.", "/* Unknown settings are ignored. */"])
|
|
566
|
+
@pytest.mark.parametrize("blank", ["", "\n"])
|
|
567
|
+
def test_trailing_switch_comment_aligns_with_statements(case_indent: bool, comment: str, blank: str) -> None:
|
|
568
|
+
label_indent = " " if case_indent else ""
|
|
569
|
+
statement_indent = label_indent + " "
|
|
570
|
+
check(
|
|
571
|
+
f"switch(x){{case 9:break;\n{blank}{comment}\n}}",
|
|
572
|
+
f"switch (x)\n{{\n{label_indent}case 9:\n{statement_indent}break;\n"
|
|
573
|
+
f"{blank}{statement_indent}{comment}\n}}\n",
|
|
574
|
+
switch_case_indent=case_indent,
|
|
575
|
+
)
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
@pytest.mark.parametrize("case_indent", [True, False])
|
|
579
|
+
def test_comment_only_switch_keeps_one_indent(case_indent: bool) -> None:
|
|
580
|
+
check(
|
|
581
|
+
"switch(x){\n// No cases yet.\n}",
|
|
582
|
+
"switch (x)\n{\n // No cases yet.\n}\n",
|
|
583
|
+
switch_case_indent=case_indent,
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
|
|
564
587
|
def test_switch_expression_arms_align_when_turned_on() -> None:
|
|
565
588
|
check(
|
|
566
589
|
"""
|
|
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
|
{prettycsharp-1.1.6 → prettycsharp-1.1.7}/tests/fuzz_corpus/csharp/comment_only_accessor_list.cs
RENAMED
|
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
|