PrefectHQ / prefect-collection-template

Template to quickly bootstrap a Prefect Collection
Apache License 2.0
68 stars 8 forks source link

Add pydocstyle to static analysis #107

Open ahuang11 opened 1 year ago

ahuang11 commented 1 year ago

This can standardize our docstrings, e.g. missing periods. https://www.pydocstyle.org/en/stable/usage.html#in-file-configuration

To implement, add to pre-commit + static analysis https://www.pydocstyle.org/en/stable/usage.html#example

[pydocstyle]
inherit = false
ignore = D100,D203,D405
match = .*\.py
-   repo: https://github.com/pycqa/pydocstyle
    rev: 6.1.1  # pick a git hash / tag to point to
    hooks:
    -   id: pydocstyle
ahuang11 commented 1 year ago

Here's an example. Maybe we can configure it to ignore D401.

./setup.py:1 at module level:
        D100: Missing docstring in public module
./prefect_dbt/__init__.py:1 at module level:
        D104: Missing docstring in public package
./prefect_dbt/cli/credentials.py:1 at module level:
        D400: First line should end with a period (not 'I')
./prefect_dbt/cli/credentials.py:101 in public method `get_profile`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cli/__init__.py:1 at module level:
        D104: Missing docstring in public package
./prefect_dbt/cli/commands.py:1 at module level:
        D400: First line should end with a period (not 'I')
./prefect_dbt/cli/configs/bigquery.py:1 at module level:
        D400: First line should end with a period (not 's')
./prefect_dbt/cli/configs/bigquery.py:18 in public class `BigQueryTargetConfigs`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cli/configs/bigquery.py:18 in public class `BigQueryTargetConfigs`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cli/configs/bigquery.py:88 in public method `get_configs`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cli/configs/__init__.py:1 at module level:
        D104: Missing docstring in public package
./prefect_dbt/cli/configs/snowflake.py:1 at module level:
        D400: First line should end with a period (not 's')
./prefect_dbt/cli/configs/snowflake.py:20 in public class `SnowflakeTargetConfigs`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cli/configs/snowflake.py:20 in public class `SnowflakeTargetConfigs`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cli/configs/snowflake.py:72 in public method `get_configs`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cli/configs/postgres.py:1 at module level:
        D400: First line should end with a period (not 's')
./prefect_dbt/cli/configs/postgres.py:18 in public class `PostgresTargetConfigs`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cli/configs/postgres.py:18 in public class `PostgresTargetConfigs`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cli/configs/postgres.py:63 in public method `get_configs`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cli/configs/base.py:1 at module level:
        D400: First line should end with a period (not 's')
./prefect_dbt/cli/configs/base.py:29 in private method `_populate_configs_json`:
        D200: One-line docstring should fit on one line with quotes (found 3)
./prefect_dbt/cli/configs/base.py:65 in public method `get_configs`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cli/configs/base.py:75 in public class `TargetConfigs`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cli/configs/base.py:75 in public class `TargetConfigs`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cli/configs/base.py:107 in public class `GlobalConfigs`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cli/configs/base.py:107 in public class `GlobalConfigs`:
        D400: First line should end with a period (not 't')
./prefect_dbt/cli/configs/base.py:162 in public class `MissingExtrasRequireError`:
        D101: Missing docstring in public class
./prefect_dbt/cli/configs/base.py:163 in public method `__init__`:
        D107: Missing docstring in __init__
./prefect_dbt/cloud/models.py:1 at module level:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cloud/models.py:9 in public function `default_cause_factory`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/models.py:9 in public function `default_cause_factory`:
        D400: First line should end with a period (not 'n')
./prefect_dbt/cloud/models.py:9 in public function `default_cause_factory`:
        D401: First line should be in imperative mood; try rephrasing (found 'Factory')
./prefect_dbt/cloud/models.py:28 in public class `TriggerJobRunOptions`:
        D200: One-line docstring should fit on one line with quotes (found 3)
./prefect_dbt/cloud/credentials.py:1 at module level:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cloud/credentials.py:63 in public method `get_administrative_client`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/credentials.py:63 in public method `get_administrative_client`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cloud/credentials.py:63 in public method `get_administrative_client`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cloud/__init__.py:1 at module level:
        D104: Missing docstring in public package
./prefect_dbt/cloud/jobs.py:1 at module level:
        D400: First line should end with a period (not 's')
./prefect_dbt/cloud/jobs.py:47 in public function `get_dbt_cloud_job_info`:
        D401: First line should be in imperative mood; try rephrasing (found 'A')
./prefect_dbt/cloud/jobs.py:100 in public function `trigger_dbt_cloud_job_run`:
        D401: First line should be in imperative mood; try rephrasing (found 'A')
./prefect_dbt/cloud/jobs.py:196 in public function `get_run_id`:
        D400: First line should end with a period (not ',')
./prefect_dbt/cloud/jobs.py:421 in private function `_build_trigger_job_run_options`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/jobs.py:421 in private function `_build_trigger_job_run_options`:
        D400: First line should end with a period (not 'b')
./prefect_dbt/cloud/jobs.py:552 in public function `retry_dbt_cloud_job_run_subset_and_wait_for_completion`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/jobs.py:552 in public function `retry_dbt_cloud_job_run_subset_and_wait_for_completion`:
        D400: First line should end with a period (not ',')
./prefect_dbt/cloud/utils.py:1 at module level:
        D400: First line should end with a period (not 'I')
./prefect_dbt/cloud/utils.py:12 in public function `extract_user_message`:
        D401: First line should be in imperative mood (perhaps 'Extract', not 'Extracts')
./prefect_dbt/cloud/utils.py:28 in public function `extract_developer_message`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/utils.py:28 in public function `extract_developer_message`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cloud/utils.py:28 in public function `extract_developer_message`:
        D401: First line should be in imperative mood (perhaps 'Extract', not 'Extracts')
./prefect_dbt/cloud/utils.py:63 in public function `call_dbt_cloud_administrative_api_endpoint`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/utils.py:63 in public function `call_dbt_cloud_administrative_api_endpoint`:
        D400: First line should end with a period (not 's')
./prefect_dbt/cloud/clients.py:1 at module level:
        D400: First line should end with a period (not 'I')
./prefect_dbt/cloud/clients.py:21 in public method `__init__`:
        D107: Missing docstring in __init__
./prefect_dbt/cloud/clients.py:84 in public method `trigger_job_run`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/clients.py:84 in public method `trigger_job_run`:
        D400: First line should end with a period (not ')')
./prefect_dbt/cloud/clients.py:84 in public method `trigger_job_run`:
        D401: First line should be in imperative mood (perhaps 'Send', not 'Sends')
./prefect_dbt/cloud/clients.py:111 in public method `get_run`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/clients.py:111 in public method `get_run`:
        D400: First line should end with a period (not ')')
./prefect_dbt/cloud/clients.py:111 in public method `get_run`:
        D401: First line should be in imperative mood (perhaps 'Send', not 'Sends')
./prefect_dbt/cloud/clients.py:133 in public method `list_run_artifacts`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/clients.py:133 in public method `list_run_artifacts`:
        D400: First line should end with a period (not ')')
./prefect_dbt/cloud/clients.py:133 in public method `list_run_artifacts`:
        D401: First line should be in imperative mood (perhaps 'Send', not 'Sends')
./prefect_dbt/cloud/clients.py:155 in public method `get_run_artifact`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/clients.py:155 in public method `get_run_artifact`:
        D400: First line should end with a period (not ')')
./prefect_dbt/cloud/clients.py:155 in public method `get_run_artifact`:
        D401: First line should be in imperative mood (perhaps 'Send', not 'Sends')
./prefect_dbt/cloud/clients.py:176 in public method `__aenter__`:
        D105: Missing docstring in magic method
./prefect_dbt/cloud/clients.py:188 in public method `__aexit__`:
        D105: Missing docstring in magic method
./prefect_dbt/cloud/runs.py:1 at module level:
        D400: First line should end with a period (not 's')
./prefect_dbt/cloud/runs.py:15 in public class `DbtCloudGetRunFailed`:
        D400: First line should end with a period (not 'n')
./prefect_dbt/cloud/runs.py:19 in public class `DbtCloudListRunArtifactsFailed`:
        D400: First line should end with a period (not 's')
./prefect_dbt/cloud/runs.py:23 in public class `DbtCloudGetRunArtifactFailed`:
        D400: First line should end with a period (not 't')
./prefect_dbt/cloud/runs.py:27 in public class `DbtCloudJobRunFailed`:
        D400: First line should end with a period (not 's')
./prefect_dbt/cloud/runs.py:31 in public class `DbtCloudJobRunCancelled`:
        D400: First line should end with a period (not 'd')
./prefect_dbt/cloud/runs.py:35 in public class `DbtCloudJobRunTimedOut`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/runs.py:35 in public class `DbtCloudJobRunTimedOut`:
        D400: First line should end with a period (not 'x')
./prefect_dbt/cloud/runs.py:53 in public method `is_terminal_status_code`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/runs.py:53 in public method `is_terminal_status_code`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
./prefect_dbt/cloud/runs.py:74 in public function `get_dbt_cloud_run_info`:
        D401: First line should be in imperative mood; try rephrasing (found 'A')
./prefect_dbt/cloud/runs.py:127 in public function `list_dbt_cloud_run_artifacts`:
        D401: First line should be in imperative mood; try rephrasing (found 'A')
./prefect_dbt/cloud/runs.py:181 in public function `get_dbt_cloud_run_artifact`:
        D202: No blank lines allowed after function docstring (found 1)
./prefect_dbt/cloud/runs.py:181 in public function `get_dbt_cloud_run_artifact`:
        D205: 1 blank line required between summary line and description (found 0)
./prefect_dbt/cloud/runs.py:181 in public function `get_dbt_cloud_run_artifact`:
        D400: First line should end with a period (not 't')
./prefect_dbt/cloud/runs.py:181 in public function `get_dbt_cloud_run_artifact`:
        D401: First line should be in imperative mood; try rephrasing (found 'A')
./prefect_dbt/cloud/runs.py:272 in public function `wait_for_dbt_cloud_job_run`:
        D401: First line should be in imperative mood (perhaps 'Wait', not 'Waits')
./tests/conftest.py:1 at module level:
        D100: Missing docstring in public module
./tests/conftest.py:10 in public function `dbt_cloud_credentials`:
        D103: Missing docstring in public function
./tests/conftest.py:15 in public function `prefect_db`:
        D103: Missing docstring in public function
./tests/conftest.py:21 in public function `dbt_cli_profile`:
        D103: Missing docstring in public function
./tests/conftest.py:60 in public function `dbt_cli_profile_bare`:
        D103: Missing docstring in public function
./docs/gen_ref_pages.py:1 at module level:
        D300: Use """triple double quotes""" (found "-quotes)