diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 000000000..dd0eb8e57 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,23 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad4990d90..4e529741e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,11 @@ repos: - id: ruff-format files: "^datamodel_code_generator|^tests" exclude: "^tests/data" + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in pyproject.toml + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + exclude: "^tests/" diff --git a/README.md b/README.md index 83542afff..17ee97e97 100644 --- a/README.md +++ b/README.md @@ -422,7 +422,7 @@ Model customization: --enable-version-header Enable package version on file headers --keep-model-order Keep generated models' order - --reuse-model Re-use models on the field when a module has the model + --reuse-model Reuse models on the field when a module has the model with the same content --target-python-version {3.6,3.7,3.8,3.9,3.10,3.11} target python version (default: 3.7) diff --git a/datamodel_code_generator/__init__.py b/datamodel_code_generator/__init__.py index 9df843f77..aaa3e1772 100644 --- a/datamodel_code_generator/__init__.py +++ b/datamodel_code_generator/__init__.py @@ -525,7 +525,7 @@ def infer_input_type(text: str) -> InputFileType: inferred_message = ( - 'The input file type was determined to be: {}\nThis can be specificied explicitly with the ' + 'The input file type was determined to be: {}\nThis can be specified explicitly with the ' '`--input-file-type` option.' ) diff --git a/docs/index.md b/docs/index.md index d89aed000..008fb01b0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -419,7 +419,7 @@ Model customization: --enable-version-header Enable package version on file headers --keep-model-order Keep generated models' order - --reuse-model Re-use models on the field when a module has the model + --reuse-model Reuse models on the field when a module has the model with the same content --target-python-version {3.6,3.7,3.8,3.9,3.10,3.11} target python version (default: 3.7) diff --git a/pyproject.toml b/pyproject.toml index 7e10ae5db..b877bd26c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -153,3 +153,10 @@ ignore-init-method-arguments = true [tool.pydantic-pycharm-plugin.parsable-types] # str field may parse int and float str = ["int", "float"] + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git,*.lock,tests' +# check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' diff --git a/tests/data/expected/main/main_graphql_github_api/output.py b/tests/data/expected/main/main_graphql_github_api/output.py index 98b5cdb46..a21c842cb 100644 --- a/tests/data/expected/main/main_graphql_github_api/output.py +++ b/tests/data/expected/main/main_graphql_github_api/output.py @@ -23107,7 +23107,7 @@ class WorkflowsParametersInput(BaseModel): ] -# Any referencable object +# Any referenceable object ReferencedSubject: TypeAlias = Union[ 'Issue', 'PullRequest', diff --git a/tests/data/expected/main/main_openapi_http_refs/output.py b/tests/data/expected/main/main_openapi_http_refs/output.py index 4eeed3e1b..c960e3a26 100644 --- a/tests/data/expected/main/main_openapi_http_refs/output.py +++ b/tests/data/expected/main/main_openapi_http_refs/output.py @@ -12,7 +12,7 @@ class Problem(BaseModel): detail: Optional[str] = Field( None, - description='A human readable explanation specific to this occurrence of the\nproblem. You MUST NOT expose internal informations, personal\ndata or implementation details through this field.\n', + description='A human readable explanation specific to this occurrence of the\nproblem. You MUST NOT expose internal information, personal\ndata or implementation details through this field.\n', example='Request took too long to complete.', ) instance: Optional[AnyUrl] = Field( diff --git a/tests/data/graphql/github-api.graphql b/tests/data/graphql/github-api.graphql index 2da3572f6..ed84cd407 100644 --- a/tests/data/graphql/github-api.graphql +++ b/tests/data/graphql/github-api.graphql @@ -3398,7 +3398,7 @@ input CheckRunFilter { conclusions: [CheckConclusionState!] """ - Filters the check runs by this status. Superceded by statuses. + Filters the check runs by this status. Superseded by statuses. """ status: CheckStatusState @@ -12265,14 +12265,14 @@ input EnablePullRequestAutoMergeInput { clientMutationId: String """ - Commit body to use for the commit when the PR is mergable; if omitted, a + Commit body to use for the commit when the PR is mergeable; if omitted, a default message will be used. NOTE: when merging with a merge queue any input value for commit message is ignored. """ commitBody: String """ - Commit headline to use for the commit when the PR is mergable; if omitted, a + Commit headline to use for the commit when the PR is mergeable; if omitted, a default message will be used. NOTE: when merging with a merge queue any input value for commit headline is ignored. """ @@ -20934,7 +20934,7 @@ type MergeQueueConfiguration { minimumEntriesToMerge: Int """ - The amount of time in minutes to wait before ignoring the minumum number of + The amount of time in minutes to wait before ignoring the minimum number of entries in the queue requirement and merging a collection of entries """ minimumEntriesToMergeWaitTime: Int @@ -21085,7 +21085,7 @@ enum MergeQueueMergingStrategy { ALLGREEN """ - Failing Entires are allowed to merge if they are with a passing entry. + Failing Entries are allowed to merge if they are with a passing entry. """ HEADGREEN } @@ -33912,7 +33912,7 @@ The possible roles of a collaborator on a project. """ enum ProjectV2Roles { """ - The collaborator can view, edit, and maange the settings of the project + The collaborator can view, edit, and manage the settings of the project """ ADMIN @@ -39277,7 +39277,7 @@ type ReferencedEvent implements Node { } """ -Any referencable object +Any referenceable object """ union ReferencedSubject = Issue | PullRequest @@ -54687,12 +54687,12 @@ enum ThreadSubscriptionState { IGNORING_THREAD """ - The User is not recieving notifications from this thread + The User is not receiving notifications from this thread """ NONE """ - The User is notified becuase they are watching the list + The User is notified because they are watching the list """ SUBSCRIBED_TO_LIST diff --git a/tests/data/openapi/definitions.yaml b/tests/data/openapi/definitions.yaml index 2e99635d7..d326c0276 100644 --- a/tests/data/openapi/definitions.yaml +++ b/tests/data/openapi/definitions.yaml @@ -5,7 +5,7 @@ schemas: detail: description: | A human readable explanation specific to this occurrence of the - problem. You MUST NOT expose internal informations, personal + problem. You MUST NOT expose internal information, personal data or implementation details through this field. example: Request took too long to complete. type: string diff --git a/tests/data/openapi/query_parameters.yaml b/tests/data/openapi/query_parameters.yaml index 235b62566..9c9ee3fe4 100644 --- a/tests/data/openapi/query_parameters.yaml +++ b/tests/data/openapi/query_parameters.yaml @@ -100,7 +100,7 @@ paths: items: $ref: "#/components/schemas/Pet" '500': - description: An internal error occured + description: An internal error occurred content: application/json: schema: