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

Adding base pylint rcfile and plugin for unittests. #221

Closed
wants to merge 1 commit into from

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Oct 4, 2014

No description provided.

@dhermes
Copy link
Contributor Author

dhermes commented Oct 4, 2014

@tseaver This is a start towards getting our code clean without having to sprinkle comments as you mentioned before.

I had a lot of fun learning a bit about the internals of pylint and astroid. However, I'm not sure building a world class code inspection library is worth the trade-off relative to just using pylint: disable.

LMK what you think.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 67417e0 on dhermes:unittest-pylint-plugin into e30de64 on GoogleCloudPlatform:master.

@dhermes
Copy link
Contributor Author

dhermes commented Oct 6, 2014

@silvolu @tseaver Here

@silvolu
Copy link
Contributor

silvolu commented Oct 6, 2014

The plugin looks very slick, but I'm worried about the maintenance cost; also, if I understand correctly, comments are the most common way of handling this, is that correct?

@dhermes
Copy link
Contributor Author

dhermes commented Oct 6, 2014

I'm trying to read up on best practices / things people do on the web.

This comment seems interesting:

QUES: How do you handle people adding lots of pylint disable commands? We fail the build on pylint on pylint errors, and Django/Celery peculiarities require us to disable those messages to prevent build failures. Unfortunately, that practice has spread, and we have lots disable statements for things that truly are code smell (e.g. too many local variables, etc.).

ANS: We have a custom .pylintrc file that is under source control. Disabling checks inline is not permissable and changes to the .pylintrc file are carefully reviewed for appropriateness.

I'm also looking into pyflakes as a SO post seems to indicate it is a nice best practice as well.

@tseaver
Copy link
Contributor

tseaver commented Oct 7, 2014

As in that answer, ISTM that enforcing project policy through a .pylintrc file and a ban on inline comments disabling lint leads to the best code quality.

@dhermes
Copy link
Contributor Author

dhermes commented Oct 7, 2014

Yes it seems to be a policy which is alive and well in the Python ecosystem. I'd be interested to hear what people do in cases like this.

In reality, a class with 47 public methods is doing too much, but having pylint complain about the 47 public methods "owned" by our unittest2.TestCase subclass is a bit silly. I'm not sure how one modifies it as the only setting I know of is

[DESIGN]
max-public-methods=20

@dhermes dhermes force-pushed the unittest-pylint-plugin branch 2 times, most recently from e2dfbce to f85eeba Compare October 7, 2014 03:57
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f85eeba on dhermes:unittest-pylint-plugin into * on GoogleCloudPlatform:master*.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling f85eeba on dhermes:unittest-pylint-plugin into 6dd5f2b on GoogleCloudPlatform:master.

@dhermes dhermes force-pushed the unittest-pylint-plugin branch 2 times, most recently from 063031d to 21b4574 Compare October 7, 2014 18:38
f.write(PRIVATE_KEY)
f.flush()
found = cls.get_for_service_account(CLIENT_EMAIL, f.name)
with NamedTemporaryFile() as file_obj:

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Contributor

tseaver commented Oct 7, 2014

Feel free to ignore the other "Invert the test and nest the following code?" comments if you don't find the first helpful.

@dhermes
Copy link
Contributor Author

dhermes commented Oct 7, 2014

Gotcher. I will handle uniformly depending on the resolution of our discussion.

@tseaver tseaver added the testing label Oct 7, 2014
parthea added a commit that referenced this pull request Sep 14, 2023
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: googleapis/googleapis-gen@387b734
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add gapic_version.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Sep 20, 2023
* chore: use gapic-generator-python 0.65.2

PiperOrigin-RevId: 444333013

Source-Link: googleapis/googleapis@f91b6cf

Source-Link: googleapis/googleapis-gen@16eb360
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
vchudnov-g pushed a commit that referenced this pull request Sep 20, 2023
parthea pushed a commit that referenced this pull request Sep 22, 2023
chore: relocate owl bot post processor
parthea pushed a commit that referenced this pull request Sep 22, 2023
Source-Link: googleapis/synthtool@06e8279
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce
parthea pushed a commit that referenced this pull request Sep 22, 2023
…221)

Source-Link: googleapis/synthtool@95d9289
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c8878270182edaab99f2927969d4f700c3af265accd472c3425deedff2b7fd93

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Sep 22, 2023
Source-Link: googleapis/synthtool@993985f
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd
parthea pushed a commit that referenced this pull request Sep 22, 2023
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pytest](https://docs.pytest.org/en/latest/) ([source](https://togithub.com/pytest-dev/pytest), [changelog](https://docs.pytest.org/en/stable/changelog.html)) | `==7.0.0` -> `==7.0.1` | [![age](https://badges.renovateapi.com/packages/pypi/pytest/7.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/pytest/7.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/pytest/7.0.1/compatibility-slim/7.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/pytest/7.0.1/confidence-slim/7.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>pytest-dev/pytest</summary>

### [`v7.0.1`](https://togithub.com/pytest-dev/pytest/releases/7.0.1)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/7.0.0...7.0.1)

# pytest 7.0.1 (2022-02-11)

## Bug Fixes

-   [#&#8203;9608](https://togithub.com/pytest-dev/pytest/issues/9608): Fix invalid importing of `importlib.readers` in Python 3.9.
-   [#&#8203;9610](https://togithub.com/pytest-dev/pytest/issues/9610): Restore \[UnitTestFunction.obj]{.title-ref} to return unbound rather than bound method.
    Fixes a crash during a failed teardown in unittest TestCases with non-default \[\__init\_\_]{.title-ref}.
    Regressed in pytest 7.0.0.
-   [#&#8203;9636](https://togithub.com/pytest-dev/pytest/issues/9636): The `pythonpath` plugin was renamed to `python_path`. This avoids a conflict with the `pytest-pythonpath` plugin.
-   [#&#8203;9642](https://togithub.com/pytest-dev/pytest/issues/9642): Fix running tests by id with `::` in the parametrize portion.
-   [#&#8203;9643](https://togithub.com/pytest-dev/pytest/issues/9643): Delay issuing a `~pytest.PytestWarning`{.interpreted-text role="class"} about diamond inheritance involving `~pytest.Item`{.interpreted-text role="class"} and
    `~pytest.Collector`{.interpreted-text role="class"} so it can be filtered using `standard warning filters <warnings>`{.interpreted-text role="ref"}.

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-tasks).
parthea pushed a commit that referenced this pull request Sep 22, 2023
* feat: update v1 proto

PiperOrigin-RevId: 410256789

Source-Link: googleapis/googleapis@b3ff183

Source-Link: googleapis/googleapis-gen@488fbdc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDg4ZmJkYzQ2OTYyZDhiMGM3N2FmNzA2ZmFhNTUyYjlmYjVhNzFiOCJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Sep 22, 2023
chore: relocate owl bot post processor
parthea pushed a commit that referenced this pull request Oct 21, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790
parthea pushed a commit that referenced this pull request Oct 21, 2023
* chore(samples): Adding samples for custom hostname

* chore(samples): Changing zone for tests, as europe-central2-c seems to have capcity issues with e2 instances.
parthea pushed a commit that referenced this pull request Oct 21, 2023
parthea pushed a commit that referenced this pull request Oct 21, 2023
Source-Link: googleapis/synthtool@52aef91
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
- [ ] Regenerate this pull request now.

fix: add 'dict' annotation type to 'request'

Committer: @busunkim96
PiperOrigin-RevId: 398509016

Source-Link: googleapis/googleapis@b224dfa

Source-Link: googleapis/googleapis-gen@63a1db7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjNhMWRiN2EzOGQ3NGI5NjM5NTkyZjUyMWVkMWRhYWY3Mjk5YWQ5YSJ9
parthea pushed a commit that referenced this pull request Oct 21, 2023
Source-Link: googleapis/synthtool@453a5d9
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
parthea pushed a commit that referenced this pull request Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/eaef28efd179e6eeb9f4e9bf697530d074a6f3b9
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e
parthea added a commit that referenced this pull request Oct 21, 2023
* chore(python): use cov_level in unittest gh action

Source-Link: googleapis/synthtool@e5aaa84
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0

* set coverage to 100%

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea added a commit that referenced this pull request Oct 22, 2023
* chore: Update gapic-generator-python to v1.8.2

PiperOrigin-RevId: 504289125

Source-Link: googleapis/googleapis@38a48a4

Source-Link: googleapis/googleapis-gen@b2dc226
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJkYzIyNjYzZGJlNDdhOTcyYzhkOGMyZjhhNGRmMDEzZGFmZGNiYyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix build

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Oct 22, 2023
Source-Link: googleapis/synthtool@25083af
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 22, 2023
Source-Link: googleapis/synthtool@453a5d9
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants