Skip to content

Commit f863c4e

Browse files
authored
Configure codespell in pre-commit (apache#1478)
* feat: configure codespell in pre-commit * add apache license header * style: resolve pre-commit violations
1 parent f7d8a2f commit f863c4e

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

.codespellrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
[codespell]
18+
ignore-words-list = BoundIn,fo,MoR,NotIn,notIn,oT

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ repos:
6969
# --line-length is set to a high value to deal with very long lines
7070
- --line-length
7171
- '99999'
72+
- repo: https://github.com/codespell-project/codespell
73+
rev: v2.3.0
74+
hooks:
75+
- id: codespell
7276
ci:
7377
autofix_commit_msg: |
7478
[pre-commit.ci] auto fixes from pre-commit.com hooks

pyiceberg/avro/reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
def _skip_map_array(decoder: BinaryDecoder, skip_entry: Callable[[], None]) -> None:
5252
"""Skips over an array or map.
5353
54-
Both the array and map are encoded similar, and we can re-use
54+
Both the array and map are encoded similar, and we can reuse
5555
the logic of skipping in an efficient way.
5656
5757
From the Avro spec:

pyiceberg/io/pyarrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ def _to_requested_schema(
15361536
include_field_ids: bool = False,
15371537
use_large_types: bool = True,
15381538
) -> pa.RecordBatch:
1539-
# We could re-use some of these visitors
1539+
# We could reuse some of these visitors
15401540
struct_array = visit_with_partner(
15411541
requested_schema,
15421542
batch,

pyiceberg/utils/singleton.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
"""
18-
This is a singleton metaclass that can be used to cache and re-use existing objects.
18+
This is a singleton metaclass that can be used to cache and reuse existing objects.
1919
2020
In the Iceberg codebase we have a lot of objects that are stateless (for example Types such as StringType,
2121
BooleanType etc). FixedTypes have arguments (eg. Fixed[22]) that we also make part of the key when caching

tests/test_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ def test_projection_truncate_string_set_same_result(bound_reference_str: BoundRe
899899
def test_projection_truncate_string_set_in(bound_reference_str: BoundReference[str]) -> None:
900900
assert TruncateTransform(3).project(
901901
"name", BoundIn(term=bound_reference_str, literals={literal("hello"), literal("world")})
902-
) == In(term="name", literals={literal("hel"), literal("wor")})
902+
) == In(term="name", literals={literal("hel"), literal("wor")}) # codespell:ignore hel
903903

904904

905905
def test_projection_truncate_string_set_not_in(bound_reference_str: BoundReference[str]) -> None:

0 commit comments

Comments
 (0)