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

Add codespell configuration, workflow, pre-commit config and fix few typos #1842

Merged
merged 10 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion datamodel_code_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
)

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
2 changes: 1 addition & 1 deletion tests/data/expected/main/main_graphql_github_api/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -23107,7 +23107,7 @@ class WorkflowsParametersInput(BaseModel):
]


# Any referencable object
# Any referenceable object
ReferencedSubject: TypeAlias = Union[
'Issue',
'PullRequest',
Expand Down
2 changes: 1 addition & 1 deletion tests/data/expected/main/main_openapi_http_refs/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions tests/data/graphql/github-api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -39277,7 +39277,7 @@ type ReferencedEvent implements Node {
}

"""
Any referencable object
Any referenceable object
"""
union ReferencedSubject = Issue | PullRequest

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/data/openapi/definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/data/openapi/query_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading