Skip to content

Commit

Permalink
Fix "line-too-long" for property of model (#2837)
Browse files Browse the repository at this point in the history
* fix line-too-long for property of model

* changelog
  • Loading branch information
msyyc authored Sep 12, 2024
1 parent 2b29fe0 commit 1670cc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .chronus/changes/fix-pylint-2024-09-12-2024-8-12-16-9-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-python"
---

Fix "line-too-long" for property of model
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ def declare_property(prop: Property) -> str:
else ""
)
generated_code = f'{prop.client_name}: {prop.type_annotation()} = {field}({", ".join(args)})'
# there is 4 spaces indentation so original line length limit 120 - 4 = 116
pylint_disable = (
" # pylint: disable=line-too-long"
if len(generated_code) <= 120 < (len(generated_code) + len(type_ignore))
if len(generated_code) <= 116 < (len(generated_code) + len(type_ignore))
else ""
)
return f"{generated_code}{type_ignore}{pylint_disable}"
Expand Down

0 comments on commit 1670cc6

Please sign in to comment.