diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5e05a51c85..23ed7eeb30f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,17 +15,14 @@ exclude: | (?x)^( .*zz_generated.deepcopy.*| .*pb.go| - pkg/apis/manager/.*pb2(?:_grpc)?.py| + pkg/apis/manager/.*pb2(?:_grpc)?.py(?:i)?| pkg/apis/v1beta1/openapi_generated.go| pkg/mock/.*| - pkg/client/controller/informers/externalversions/.*| - pkg/client/controller/applyconfiguration/.*| - pkg/client/controller/listers/.*| - pkg/client/controller/clientset/versioned/.*| + pkg/client/controller/.*| sdk/python/v1beta1/kubeflow/katib/configuration.py| sdk/python/v1beta1/kubeflow/katib/rest.py| sdk/python/v1beta1/kubeflow/katib/__init__.py| sdk/python/v1beta1/kubeflow/katib/exceptions.py| sdk/python/v1beta1/kubeflow/katib/api_client.py| sdk/python/v1beta1/kubeflow/katib/models/.* - )$ \ No newline at end of file + )$ diff --git a/docs/developer-guide.md b/docs/developer-guide.md index dfe04250b06..955c44e5ae5 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -18,6 +18,7 @@ see the following user guides: - [Java](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html) (8 or later) - [Python](https://www.python.org/) (3.11 or later) - [kustomize](https://kustomize.io/) (4.0.5 or later) +- [pre-commit](https://pre-commit.com/) ## Build from source code @@ -150,3 +151,21 @@ Please see [Katib UI README](../pkg/ui/v1beta1). ## Design proposals Please see [proposals](./proposals). + +## Code Style + +### pre-commit + +Make sure to install [pre-commit](https://pre-commit.com/) (`pip install +pre-commit`) and run `pre-commit install` from the root of the repository at +least once before creating git commits. + +The pre-commit [hooks](../.pre-commit-config.yaml) ensure code quality and +consistency. They are executed in CI. PRs that fail to comply with the hooks +will not be able to pass the corresponding CI gate. The hooks are only executed +against staged files unless you run `pre-commit run --all`, in which case, +they'll be executed against every file in the repository. + +Specific programmatically generated files listed in the `exclude` field in +[.pre-commit-config.yaml](../.pre-commit-config.yaml) are deliberately excluded +from the hooks. diff --git a/pkg/apis/manager/health/python/health_pb2.pyi b/pkg/apis/manager/health/python/health_pb2.pyi index f8a67276d5b..0a624f983b1 100644 --- a/pkg/apis/manager/health/python/health_pb2.pyi +++ b/pkg/apis/manager/health/python/health_pb2.pyi @@ -1,10 +1,7 @@ -from typing import ClassVar as _ClassVar -from typing import Optional as _Optional -from typing import Union as _Union - +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor diff --git a/pkg/apis/manager/v1beta1/python/api_pb2.pyi b/pkg/apis/manager/v1beta1/python/api_pb2.pyi index 8aea7e455aa..d1df3096d05 100644 --- a/pkg/apis/manager/v1beta1/python/api_pb2.pyi +++ b/pkg/apis/manager/v1beta1/python/api_pb2.pyi @@ -1,13 +1,8 @@ -from typing import ClassVar as _ClassVar -from typing import Iterable as _Iterable -from typing import Mapping as _Mapping -from typing import Optional as _Optional -from typing import Union as _Union - -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor