-
Notifications
You must be signed in to change notification settings - Fork 19
feat(ci): add pre-commit and format code #93
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.3.0 | ||
| hooks: | ||
| - id: check-ast | ||
| exclude: ^(tests|samples)/ | ||
| - id: sort-simple-yaml | ||
| exclude: ^(tests|samples)/ | ||
| - id: check-yaml | ||
| exclude: | | ||
| (?x)^( | ||
| meta.yaml | ||
| | tests/ | ||
| | samples/ | ||
| )$ | ||
| - id: check-xml | ||
| exclude: ^(tests|samples)/ | ||
| - id: check-toml | ||
| exclude: ^(tests|samples)/ | ||
| - id: check-docstring-first | ||
| exclude: ^(tests|samples)/ | ||
| - id: check-json | ||
| exclude: ^(tests|samples)/ | ||
| - id: fix-encoding-pragma | ||
| exclude: ^(tests|samples)/ | ||
| - id: detect-private-key | ||
| exclude: ^(tests|samples)/ | ||
| - id: trailing-whitespace | ||
| exclude: ^(tests|samples)/ | ||
| - repo: https://github.com/asottile/add-trailing-comma | ||
| rev: v3.1.0 | ||
| hooks: | ||
| - id: add-trailing-comma | ||
| exclude: ^(tests|samples)/ | ||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.7.0 | ||
| hooks: | ||
| - id: mypy | ||
| exclude: | ||
| (?x)( | ||
| pb2\.py$ | ||
| | grpc\.py$ | ||
| | ^docs | ||
| | ^tests/ | ||
| | ^samples/ | ||
| | \.html$ | ||
| ) | ||
| args: [ | ||
| --ignore-missing-imports, | ||
| --disable-error-code=var-annotated, | ||
| --disable-error-code=union-attr, | ||
| --disable-error-code=assignment, | ||
| --disable-error-code=attr-defined, | ||
| --disable-error-code=import-untyped, | ||
| --disable-error-code=truthy-function, | ||
| --follow-imports=skip, | ||
| --explicit-package-bases, | ||
| ] | ||
| - repo: https://github.com/psf/black | ||
| rev: 23.3.0 | ||
| hooks: | ||
| - id: black | ||
| args: [ --line-length=79 ] | ||
| exclude: ^(tests|samples)/ | ||
| - repo: https://github.com/PyCQA/flake8 | ||
| rev: 6.1.0 | ||
| hooks: | ||
| - id: flake8 | ||
| args: [ "--extend-ignore=E203"] | ||
| exclude: ^(tests|samples)/ | ||
| - repo: https://github.com/pylint-dev/pylint | ||
| rev: v3.0.2 | ||
| hooks: | ||
| - id: pylint | ||
| exclude: | ||
| (?x)( | ||
| ^docs | ||
| | ^tests/ | ||
| | ^samples/ | ||
| | pb2\.py$ | ||
| | grpc\.py$ | ||
| | \.demo$ | ||
| | \.md$ | ||
| | \.html$ | ||
| ) | ||
| args: [ | ||
| --disable=W0511, | ||
| --disable=W0718, | ||
| --disable=W0122, | ||
| --disable=C0103, | ||
| --disable=R0913, | ||
| --disable=E0401, | ||
| --disable=E1101, | ||
| --disable=C0415, | ||
| --disable=W0603, | ||
| --disable=R1705, | ||
| --disable=R0914, | ||
| --disable=E0601, | ||
| --disable=W0602, | ||
| --disable=W0604, | ||
| --disable=R0801, | ||
| --disable=R0902, | ||
| --disable=R0903, | ||
| --disable=C0123, | ||
| --disable=W0231, | ||
| --disable=W1113, | ||
| --disable=W0221, | ||
| --disable=R0401, | ||
| --disable=W0632, | ||
| --disable=W0123, | ||
| --disable=C3001, | ||
| --disable=W0201, | ||
| --disable=C0302, | ||
| --disable=W1203, | ||
| --disable=C2801, | ||
| --disable=C0114, # Disable missing module docstring for quick dev | ||
| --disable=C0115, # Disable missing class docstring for quick dev | ||
| --disable=C0116, # Disable missing function or method docstring for quick dev | ||
|
Comment on lines
+116
to
+118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ] | ||
| - repo: https://github.com/pre-commit/mirrors-eslint | ||
| rev: v7.32.0 | ||
| hooks: | ||
| - id: eslint | ||
| files: \.(js|jsx)$ | ||
| exclude: '(.*js_third_party.*|^tests/|^samples/)' | ||
| args: [ '--fix' ] | ||
| - repo: https://github.com/thibaudcolas/pre-commit-stylelint | ||
| rev: v14.4.0 | ||
| hooks: | ||
| - id: stylelint | ||
| files: \.(css)$ | ||
| exclude: '(.*css_third_party.*|^tests/|^samples/)' | ||
| args: [ '--fix' ] | ||
| - repo: https://github.com/pre-commit/mirrors-prettier | ||
| rev: 'v3.0.0' | ||
| hooks: | ||
| - id: prettier | ||
| additional_dependencies: [ 'prettier@3.0.0' ] | ||
| files: \.(tsx?)$ | ||
| exclude: ^(tests|samples)/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,24 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Copyright (c) Alibaba, Inc. and its affiliates. | ||
| from .conversation import Conversation, History, HistoryItem | ||
| from .generation import Generation, AioGeneration | ||
| from .image_synthesis import ImageSynthesis, AioImageSynthesis | ||
| from .multimodal_conversation import MultiModalConversation, AioMultiModalConversation | ||
| from .multimodal_conversation import ( | ||
| MultiModalConversation, | ||
| AioMultiModalConversation, | ||
| ) | ||
| from .video_synthesis import VideoSynthesis, AioVideoSynthesis | ||
|
|
||
| __all__ = [ | ||
| Generation, | ||
| AioGeneration, | ||
| Conversation, | ||
| HistoryItem, | ||
| History, | ||
| ImageSynthesis, | ||
| AioImageSynthesis, | ||
| MultiModalConversation, | ||
| AioMultiModalConversation, | ||
| VideoSynthesis, | ||
| AioVideoSynthesis, | ||
| "Generation", | ||
| "AioGeneration", | ||
| "Conversation", | ||
| "HistoryItem", | ||
| "History", | ||
| "ImageSynthesis", | ||
| "AioImageSynthesis", | ||
| "MultiModalConversation", | ||
| "AioMultiModalConversation", | ||
| "VideoSynthesis", | ||
| "AioVideoSynthesis", | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
mypyconfiguration is very permissive, with many checks disabled. While this can be a starting point, it significantly reduces the benefits of static type checking. For example,--ignore-missing-importscan hide import errors. It would be beneficial to create a plan to gradually remove these disabled checks to improve the type safety and robustness of the codebase.