Skip to content

Commit

Permalink
Add cspell (#3011)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft authored Jan 16, 2025
1 parent 16efde4 commit d033d4e
Show file tree
Hide file tree
Showing 70 changed files with 1,123 additions and 129 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/addCspell-2025-0-15-13-47-59.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Fix spelling mistakes by running cspell in pipelines
165 changes: 165 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
version: "0.2"
language: en
allowCompoundWords: true
dictionaries:
- node
- typescript
- python
words:
- aiohttp
- apim
- arrayofresources
- autorest
- azsdk
- azuresdk
- buongiorno
- byversion
- cadl
- clientenumversiontolerant
- codegen
- collisons
- combinedtype
- commitish
- contoso
- corehttp
- ctxt
- deduplicator
- dictionaryofresources
- dotenv
- dpgcustomizationcustomizedversiontolerant
- dpgcustomizationinitialversiontolerant
- dpgservicedriveninitialversiontolerant
- dpgservicedrivenupdateoneversiontolerant
- dpgtestmodelsversiontolerant
- eastus
- enumdiscriminator
- espt
- extensibleenumsswagger
- extensibleenumsswaggerversiontolerant
- fspath
- getpgid
- giacamo
- hdvcmxk
- hira
- headasbooleanfalse
- headasbooleantrue
- innie
- iohttp
- iswild
- ivar
- killpg
- kwarg
- levelno
- linuxnextvmimage
- linuxos
- linuxvmimage
- lmazuel
- lropaging
- lropagingversiontolerant
- lros
- lrosads
- lroversiontolerant
- lrowithparameterizedendpoints
- lrowithparameterizedendpointsversiontolerant
- macvmimage
- mday
- mergepatchjsonversiontolerant
- mgmt
- mgmtplane
- mros
- mspaint
- msrc
- multiapi
- multiapiclient
- multiapinoasync
- multiapisecurity
- mutli
- myenv
- myoption
- mypythonfile
- myuser
- nexted
- nihao
- noprop
- nspkg
- nonstringenums
- nonstringenumsversiontolerant
- nooperations
- nopolling
- npmjs
- odata
- overriden
- psscriptanalyzer
- ptvsd
- pylint
- pylintrc
- pygen
- qnas
- ragrs
- rcfile
- recommonmark
- reqs
- retrys
- roundtrippable
- rscc
- rscd
- rsce
- rscl
- rsct
- rtype
- sads
- scooby
- sdkcore
- securityaadswagger
- securityaadswaggercredentialflag
- securityaadswaggerversiontolerant
- siameeee
- spheredpg
- subclient
- subnamespace
- subscriptionidapiversion
- subscriptionidapiversionversiontolerant
- tcgc
- tfft
- tikka
- toctree
- undoc
- venv
- venvtools
- wday
- westus
- windowsvmimage
- xmsclientrequestid
- xmserrorresponse
- xmserrorresponseversiontolerant
- yankovic
- zval
ignorePaths:
- "**/node_modules/**"
- "**/dist/**"
- "**/coverage/**"
- "**/__pycache__/**"
- pnpm-lock.yaml
- .git/**
- .gitignore
- .vscode/**
- .github/CODEOWNERS
- "**/Expected/AcceptanceTests/**"
- "**/generated/**"
- "**/CHANGELOG.md"
- .prettierignore
- "**/.github/**"

useGitignore: true
enableGlobDot: true
enableFiletypes:
- cadl
patterns:
- name: cursortest
pattern: /(.*)┆(.*)/g
- name: Authorization_Basic
description: Ignore Base64 authorization tokens
pattern: "/Authorization: Basic\\s+\\S+/g"
ignoreRegExpList:
- cursortest
- Authorization_Basic
4 changes: 2 additions & 2 deletions docs/client/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ snippet
from azure.pets.models import Dog
```

Enums are also listed in the `models` namespace, so say you have enum class `DogTypes`. To access the `DALMATION` enum, your code would look like
Enums are also listed in the `models` namespace, so say you have enum class `DogTypes`. To access the `DALMATIAN` enum, your code would look like

```
from azure.pets.models import DogTypes
my_dog_type = DogTypes.DALMATION
my_dog_type = DogTypes.DALMATIAN
```

## Multi API
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/ci-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ steps:
displayName: List installed packages
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}

- script: pnpm run cspell
displayName: Cspell
workingDirectory: $(Build.SourcesDirectory)/autorest.python/

- script: pnpm run lint --command eslint --skipWarning ${{ parameters.skipWarning }}
displayName: Eslint
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}
Expand Down
2 changes: 1 addition & 1 deletion eng/scripts/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main(update_to_latest_typespec: bool, build_artifacts_path: Path) -> None:
# copy package.json and pnpm-lock.yaml from build artifacts
lock_files_dir = Path(build_artifacts_path) / "lock-files"
if lock_files_dir.exists():
print(f"Copying package.json and pnmp-lock.yaml from {lock_files_dir}")
print(f"Copying package.json and pnpm-lock.yaml from {lock_files_dir}")
copy(lock_files_dir / "package.json", root_dir)
copy(lock_files_dir / "pnpm-lock.yaml", root_dir)
copy(
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"clean": "pnpm -r run clean",
"lint": "pnpm -r run lint",
"format": "npx prettier **/*.ts --write",
"cspell": "cspell --no-progress .",
"check-format": "npx prettier **/*.ts --check --end-of-line auto",
"check-version-mismatch": "syncpack list-mismatches --types prod,peer",
"fix-version-mismatch": "syncpack fix-mismatches",
Expand Down Expand Up @@ -42,7 +43,8 @@
"prettier": "~3.3.3",
"syncpack": "^13.0.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.7.0"
"typescript-eslint": "^8.7.0",
"cspell": "^7.0.0"
},
"syncpack": {
"dependencyTypes": [
Expand Down
4 changes: 2 additions & 2 deletions packages/autorest.python/autorest/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def __init__(
class CodeGeneratorAutorest(CodeGenerator, PluginAutorest):
def get_options(self) -> Dict[str, Any]:
if self._autorestapi.get_boolean_value("python3-only") is False:
_LOGGER.warning("You have passed in --python3-only=False. We have force overriden this to True.")
_LOGGER.warning("You have passed in --python3-only=False. We have force overridden this to True.")
if self._autorestapi.get_boolean_value("add-python3-operation-files"):
_LOGGER.warning(
"You have passed in --add-python3-operation-files. "
"This flag no longer has an effect bc all SDKs are now Python3 only."
)
if self._autorestapi.get_boolean_value("reformat-next-link"):
_LOGGER.warning(
"You have passed in --reformat-next-link. We have force overriden "
"You have passed in --reformat-next-link. We have force overridden "
"this to False because we no longer reformat initial query parameters into next "
"calls unless explicitly defined in the service definition."
)
Expand Down
4 changes: 2 additions & 2 deletions packages/autorest.python/autorest/jsonrpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class Channel(Enum):
# Information is considered the mildest of responses; not necesarily actionable.
# Information is considered the mildest of responses; not necessarily actionable.
Information = "information"

# Warnings are considered important for best practices, but not catastrophic in nature.
Expand All @@ -27,7 +27,7 @@ class Channel(Enum):
# Verbose messages give the user additional clarity on the process.
Verbose = "verbose"

# Catastrophic failure, likely abending the process.
# Catastrophic failure, likely ending the process.
Fatal = "fatal"


Expand Down
26 changes: 13 additions & 13 deletions packages/autorest.python/autorest/m4reformatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def _update_operation_helper(
*,
is_overload: bool = False,
) -> Dict[str, Any]:
in_overriden = body_parameter["type"]["type"] == "combined" if body_parameter else False
in_overridden = body_parameter["type"]["type"] == "combined" if body_parameter else False
abstract = False
if body_parameter and (body_parameter.get("entries") or len(body_parameter["type"].get("types", [])) > 2):
# this means it's formdata or urlencoded, or there are more than 2 types of body
Expand All @@ -507,7 +507,7 @@ def _update_operation_helper(
yaml_data,
body_parameter,
in_overload=is_overload,
in_overriden=in_overriden,
in_overridden=in_overridden,
),
"bodyParameter": body_parameter,
"responses": [update_response(r) for r in yaml_data.get("responses", [])],
Expand Down Expand Up @@ -723,7 +723,7 @@ def _update_content_type_parameter(
request_media_types: List[str],
*,
in_overload: bool = False,
in_overriden: bool = False,
in_overridden: bool = False,
) -> Dict[str, Any]:
# override content type type to string
if not body_parameter:
Expand All @@ -737,14 +737,14 @@ def _update_content_type_parameter(
description = param["language"]["default"]["description"]
if description and description[-1] != ".":
description += "."
if not (in_overriden or in_overload):
if not (in_overridden or in_overload):
param["inDocstring"] = False
elif in_overload:
description += " Content type parameter for " f"{get_body_type_for_description(body_parameter)} body."
if not in_overload or (body_parameter["type"]["type"] == "binary" and len(request_media_types) > 1):
content_types = "'" + "', '".join(request_media_types) + "'"
description += f" Known values are: {content_types}."
if not in_overload and not in_overriden:
if not in_overload and not in_overridden:
param["clientDefaultValue"] = body_parameter["defaultContentType"]
param["language"]["default"]["description"] = description
return param
Expand All @@ -758,7 +758,7 @@ def _update_parameters_helper(
request_media_types: List[str],
*,
in_overload: bool = False,
in_overriden: bool = False,
in_overridden: bool = False,
) -> List[Dict[str, Any]]:
retval: List[Dict[str, Any]] = []
has_flattened_body = body_parameter and body_parameter.get("flattened")
Expand All @@ -785,9 +785,9 @@ def _update_parameters_helper(
body_parameter,
request_media_types,
in_overload=in_overload,
in_overriden=in_overriden,
in_overridden=in_overridden,
)
updated_param = self.update_parameter(param, in_overload=in_overload, in_overriden=in_overriden)
updated_param = self.update_parameter(param, in_overload=in_overload, in_overridden=in_overridden)
retval.append(updated_param)
return retval

Expand All @@ -797,7 +797,7 @@ def update_parameters(
body_parameter: Optional[Dict[str, Any]],
*,
in_overload: bool = False,
in_overriden: bool = False,
in_overridden: bool = False,
) -> List[Dict[str, Any]]:
retval: List[Dict[str, Any]] = []
seen_client_names: Set[str] = set()
Expand All @@ -812,7 +812,7 @@ def update_parameters(
groupers,
request_media_types,
in_overload=in_overload,
in_overriden=in_overriden,
in_overridden=in_overridden,
)
)
# now we handle content type and accept headers.
Expand All @@ -831,7 +831,7 @@ def update_parameters(
groupers,
request_media_types,
in_overload=in_overload,
in_overriden=in_overriden,
in_overridden=in_overridden,
)
)
all_params = (retval + [body_parameter]) if body_parameter else retval
Expand All @@ -853,7 +853,7 @@ def update_parameter(
*,
override_client_name: Optional[str] = None,
in_overload: bool = False,
in_overriden: bool = False,
in_overridden: bool = False,
) -> Dict[str, Any]:
param_base = self.update_parameter_base(yaml_data, override_client_name=override_client_name)
type = get_type(yaml_data["schema"])
Expand All @@ -869,7 +869,7 @@ def update_parameter(
"inOverload": in_overload,
"skipUrlEncoding": yaml_data.get("extensions", {}).get("x-ms-skip-url-encoding", False),
"inDocstring": yaml_data.get("inDocstring", True),
"inOverriden": in_overriden,
"inOverridden": in_overridden,
"delimiter": update_parameter_delimiter(protocol_http.get("style")),
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
"""This is a fake class to support current implementation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass
Expand Down
2 changes: 1 addition & 1 deletion packages/autorest.python/scripts/eng/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
python_version = 3.8


# module level configuratiohns
# module level configurations
[mypy-jsonrpc.*]
ignore_missing_imports = True

Expand Down
Loading

0 comments on commit d033d4e

Please sign in to comment.