Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] don't add too-many-lines disable if already exists #5539

Merged
merged 12 commits into from
Jan 9, 2025
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,4 @@ BenchmarkDotnet.Artifacts/
packages/http-client-python/generator/test/**/generated/
packages/http-client-python/generator/test/**/cadl-ranch-coverage.json
!packages/http-client-python/package-lock.json
micropip.lock
packages/http-client-python/micropip.lock
7 changes: 6 additions & 1 deletion packages/http-client-python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@

### Bug Fixes

- Generate `__init__` for all DPG models to ensure stability
- Only add linting disables for a file with too many lines if the file doesn't already disable this linter rule
- Generate `__init__` for internal models to allow for discriminator needs

## 0.6.0

### Features

- Add support for typespec namespace

### Bug Fixes

- Only add linting disables for a file with too many lines if the file doesn't already disable this linter rule

## 0.5.1

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion packages/http-client-python/generator/pygen/black.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def format_file(self, file: Path) -> None:
except:
_LOGGER.error("Error: failed to format %s", file)
raise
if len(file_content.splitlines()) > 1000:
if len(file_content.splitlines()) > 1000 and "pylint: disable=too-many-lines" not in file_content:
file_content = "# pylint: disable=too-many-lines\n" + file_content
self.write_file(file, file_content)

Expand Down
Loading