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

AVRO-3149: Add Rust based Implementation of Avro #1234

Merged
merged 206 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
7741c90
Initial commit
flavray Dec 5, 2017
fe7838a
Add LICENSE
flavray Feb 8, 2018
797622f
Basic implementation
flavray Dec 5, 2017
5931c2a
Harmonize named types into a Name struct
flavray Dec 6, 2017
fa255e0
Convert data, Encode data
Dec 17, 2017
f1220e8
Add ToAvro for () and HashMaps
Dec 22, 2017
221c5eb
Introduce HasSchema trait
Dec 23, 2017
22fbfcf
Add Writer implementation
Dec 23, 2017
e66a1a6
Add schema json serialization
Dec 24, 2017
54ee76c
Correclty encode types implementing ToAvro
Dec 24, 2017
8dcefe7
Use mem::transmute to encode floating-point numbers
Dec 24, 2017
9429baf
Consider header written only on success
Dec 24, 2017
0ece0eb
Use usize for Fixed size
Dec 24, 2017
40abec8
Make Schema implement serde::ser::Serialize
Dec 24, 2017
8340007
Add deflate and snappy codecs
flavray Dec 24, 2017
e34c2d4
Improve zigzag functions naming
flavray Dec 25, 2017
523eda8
Make Writer own its inner writer
flavray Dec 25, 2017
d78d679
Add Schema::parse_str
flavray Dec 25, 2017
cc5eea1
More code cleanup
flavray Dec 25, 2017
c2ee646
Perform schema-related conversion in EncodeAvro
flavray Dec 26, 2017
259f6a4
Make schema optional for record
flavray Dec 26, 2017
0a6d68b
Add basic decoding
flavray Dec 26, 2017
a0e36c2
Use VecDeque instead of Vec when decoding
flavray Dec 27, 2017
b62c916
Move codec into src/codec.rs
flavray Dec 27, 2017
8a17afe
Allow decompression with codecs
flavray Dec 27, 2017
02ad501
Remove serde_json from example
flavray Dec 27, 2017
62ac563
Check markers after each block
flavray Dec 27, 2017
279a6fb
Add serde::Serializer code skeleton
flavray Dec 27, 2017
b6cb9b6
Implement Serializer
flavray Dec 27, 2017
4418664
Attempt to impl Serialize for Value
flavray Dec 27, 2017
3ea6c20
Implement Deserializer
flavray Dec 28, 2017
e09f5d6
Improve folder hierarchy
flavray Dec 28, 2017
f22501f
Make use of forward_to_deserialize_any!
flavray Dec 28, 2017
26815f5
Add schema resolution and use it while deserializing
flavray Dec 28, 2017
85bc4e3
Implement Serialize for types::Value and types::Record
flavray Dec 30, 2017
7490170
Use default when serializing if no value is found.
flavray Dec 30, 2017
cf3bf1a
Add helper methods to interact with Value and Record
flavray Jan 1, 2018
571076f
Flatten architecture
flavray Jan 11, 2018
e2e61dd
Only support valid Value encoding
flavray Jan 12, 2018
9dc1db0
Remove non-stable slice_pattern feature dependency
flavray Jan 20, 2018
0a0a66a
Let Writer only interact with Value
flavray Jan 20, 2018
90cff7e
WIP
flavray Jan 24, 2018
402180d
WIP
flavray Jan 24, 2018
ef930cc
Remove comments
flavray Feb 8, 2018
65e2658
Refactor
flavray Feb 9, 2018
229830b
Add StructDeserializer
flavray Feb 13, 2018
8d008e5
Only validate schema when writing
flavray Feb 15, 2018
4185526
Support schema resolution through reader_schema
flavray Feb 22, 2018
2ecd3aa
Refactor record_schema to rschema
flavray Feb 23, 2018
79c3bf5
Support Enum serialization
flavray Feb 23, 2018
8135e24
Avoid computing record schema lookup at every .put
flavray Feb 23, 2018
7dada20
Refactor to remove warnings
flavray Feb 23, 2018
df4e8be
Fix tests
flavray Mar 15, 2018
b2ca48b
Make schema compliant with avro recursive primitive types
flavray Mar 15, 2018
c2c9f25
Do not create intermediate HashMap when writing records
flavray Mar 15, 2018
22f7ecf
Buffer reads/writes
flavray Mar 15, 2018
c87fe92
Add benchmark
flavray Mar 15, 2018
662faf9
Add prototype for Value::from_json_value
flavray Mar 16, 2018
1004141
Hackathon release
flavray Mar 20, 2018
df94ea7
Allow Value::Map to be resolved into a Record
flavray Mar 22, 2018
5932ae7
Add Long/Double resolving into Int/Float
flavray Mar 22, 2018
5554c4a
Avoid non-needed allocations when encoding
flavray Mar 23, 2018
3dfff91
Some quality of life improvements (#1)
poros Apr 6, 2018
1c22ea7
Move hello example to doc test, add rust benchmark based on benchmark…
poros Apr 6, 2018
f102828
Add SingleWriter avro writer (#3)
flavray Apr 6, 2018
b77f77c
Add {reader,writer}_schema to Reader
flavray Apr 10, 2018
db89414
Add docs and tests to codec module and make private modules that don'…
poros Apr 12, 2018
e881e83
Full Enum support and reader's iterator returns Result (#15)
poros Apr 19, 2018
39dd1ee
Add documentation and unit tests to types.rs
flavray Apr 25, 2018
cc55d86
Writer module overhauling (#20)
poros May 1, 2018
738fa3b
Reader module tests, documentation and interface overhaul (#21)
poros May 3, 2018
d6e9c79
Schema documentation and unit tests. (#22)
flavray May 3, 2018
deca059
Avoid calling .resolve when writing datum (#23)
flavray May 4, 2018
69b1023
Write tutorial and README (#24)
poros May 16, 2018
c0c7a34
Make Cargo.toml crates.io-compliant
flavray May 16, 2018
faadbc4
Use an available package name
flavray May 16, 2018
aee5164
Rename crate from avro to avro-rs
flavray May 16, 2018
2baa511
Bump version to 0.1.1
flavray May 16, 2018
5dde3b5
Various fixes/improvements to the documentation (#26)
flavray May 21, 2018
b4138d0
Bump version to 0.2.0
flavray May 22, 2018
90a6498
Use crates.io badge (#28)
flavray May 23, 2018
f1434f0
Move from string as errors to custom fail types (#29)
poros May 29, 2018
520d2ce
Use a single &[u8] when decoding items in Reader (#32)
flavray May 29, 2018
ef8878d
Bump version to 0.3.0
flavray May 29, 2018
04f82c2
Encode/decode Union values with a leading zig-zag long
collosi Jun 2, 2018
c3a19a2
Bump version to 0.3.1
flavray Jun 2, 2018
c94cbb0
Added some missing serialization fields for `Schema::Record`
jaboatman Jun 7, 2018
d39cc23
Bump version to 0.3.2
flavray Jun 7, 2018
372b548
Performance Enhancements
jaboatman Jun 15, 2018
8b0df4c
Remove pub from private methods of Block
poros Jun 17, 2018
2660a8b
Bump version to 0.4.0
poros Jun 17, 2018
6a036fc
Linting and clipping
poros Jun 17, 2018
3b822b6
Bump version to 0.4.1
poros Jun 17, 2018
d053b29
Run clippy as pre-commit
poros Jun 20, 2018
1860c70
Link the other two repos in README
poros Jun 23, 2018
c7942e4
Add a maximum allocation size when decoding
flavray Jun 24, 2018
57bc8c6
Add support for Parsing Canonical Form
jaboatman Jul 18, 2018
260d189
Add `to_value` to the API (#46)
flavray Aug 5, 2018
e5c6c55
Add full union support
jaboatman Aug 6, 2018
e35eb56
Fix encoding of empty Array/Map
flavray Aug 6, 2018
cebc498
impl Send+Sync for Schema
jaboatman Aug 8, 2018
c3a97bb
Bump version to 0.6.0
flavray Aug 11, 2018
9bf2365
Shift 64-bit integers by sixty-three bits
davidalber Sep 29, 2018
1130001
Convert i32 to i64 earlier during serialization
davidalber Oct 4, 2018
fe68328
Bump version to 0.6.1
flavray Oct 7, 2018
227940c
Fix snappy codec
mikaelstaldal Dec 4, 2018
37ea688
Bump version to 0.6.2
flavray Dec 4, 2018
35d2108
Convert to Rust 2018 edition
flavray Dec 16, 2018
10ea827
Add initial integration-style tests
flavray Dec 16, 2018
2fc8d9d
Add fingerprinting generation to library
nlopes Dec 18, 2018
29f318b
Bump version to 0.6.3
flavray Dec 19, 2018
9492d6c
Fix variable-length encoding for big i64 numbers
Dec 24, 2018
1afc3d9
Bump version to 0.6.4
flavray Dec 24, 2018
7b820c1
Add edition declaration to Cargo.toml (#64)
Jan 18, 2019
aa1cb56
Fix enum type deserialization bug (#73)
jiak94 Mar 9, 2019
9e6b18f
Allow Array(Int) to be converted to Bytes
flavray Mar 9, 2019
e5ca80b
Bump version to 0.6.5
flavray Mar 9, 2019
06a1b01
Make use of rust 2018 features (#78)
poros Mar 24, 2019
c4971ac
Port tests from avro/test_io.py (#81)
poros Apr 9, 2019
3a93d16
Port tests from apache/avro test_schema.py and implement schema equal…
poros Oct 20, 2019
652b233
Negative block lengths are not handled (#100)
mkroli Dec 22, 2019
af04ed8
Bump to version v0.6.6
poros Dec 22, 2019
ffede29
Uncomment enum default test and remove unused test import (#102)
poros Dec 31, 2019
c9f62a1
Fix comment and explicit match
poros Dec 31, 2019
3417ccd
Re-export {de,ser}::Error (#104)
sebastianblunt Jan 23, 2020
183893e
Fix union resolution (#103)
poros Jan 23, 2020
7c72554
Bump to version 0.7.0
poros Feb 16, 2020
173e4c5
Fix warnings on master (#112)
cpcloud Mar 22, 2020
0bcb437
Remove some unsafe (#113)
cpcloud Mar 24, 2020
3336bd1
Fix f32 and f64 encoding/decoding (#116)
Apr 1, 2020
1f8af33
[Conflict Fix] Partial Rust Enum Serialization/Deserialization Suppor…
calvinbrown085 Apr 15, 2020
4e89943
Bumo to version 0.8.0
poros Apr 15, 2020
f7f03f3
Add support for logical types (#111)
cpcloud Apr 24, 2020
9837a4d
Make writer block size configurable (#119)
cpcloud Apr 24, 2020
3d774b9
Bump version to 0.9.0
poros Apr 24, 2020
85d8c45
Port benchmarks to criterion (#114)
cpcloud Apr 24, 2020
7a80378
Remove benchmark from travis because they take too long to run[A
poros Apr 24, 2020
f679ac7
Update changelog
poros Apr 24, 2020
83baa43
Configure long running benchmarks
poros Apr 25, 2020
4c184f6
Revert "Remove benchmark from travis because they take too long to ru…
poros Apr 25, 2020
1a9d3ae
Update travis-test.sh
poros Apr 25, 2020
9589175
Compile benchmark in travis instead of running them and do it on stable
poros Apr 25, 2020
86b4587
Fix clippy lints and add to CI (#124)
cpcloud Apr 26, 2020
5acbfbf
Add a test for nullable logical types (#123)
cpcloud Apr 26, 2020
477c71e
Fix reader len bug (#126)
cpcloud May 2, 2020
5b7e52e
remove not relevant comment
poros May 2, 2020
d7aa0a8
Bump version to 0.9.1
poros May 2, 2020
d043d23
Fix remaining clippy lints (#129)
cpcloud May 29, 2020
f343383
Generate README.md with `cargo-readme` (#131)
nlopes May 31, 2020
1988598
Add schema compatibility to library (#88)
nlopes May 31, 2020
7395db8
Make writer.into_inner() call flush() and return a Result (#132)
poros May 31, 2020
606ba8d
Bump to version 0.10.0
poros May 31, 2020
e1cffc5
Update CHANGELOG.md
poros Jun 19, 2020
da3580e
Update README.tpl
poros Jun 19, 2020
45c941d
Sync readme
poros Jun 19, 2020
c1fc9df
Fix broken link markdown
poros Jun 19, 2020
ce7c710
Install clippy before using it
poros Jun 19, 2020
df61e8a
Bump digest library to 0.9 and its dependencies (#133)
nlopes Jul 3, 2020
3fb71e0
Deprecate ToAvro in favor of From<T> for Value impls (#137)
cpcloud Jul 5, 2020
72c0ffc
Replace some manual from_str impls with strum (#136)
cpcloud Jul 7, 2020
9592038
Move from failure to thiserror (#135)
poros Jul 10, 2020
656db36
Move to GH actions (#138)
cpcloud Jul 12, 2020
d841c04
Add rustfmt.toml and consolidate imports (#143)
cpcloud Jul 12, 2020
69807e9
Update ci.yml
poros Jul 12, 2020
7a87b53
Move codec to use site (#142)
cpcloud Jul 12, 2020
d3f3c6e
Handle logical types in canonical form schema (#144)
cpcloud Jul 13, 2020
d719de2
Fix length casting during decoding (#145)
cpcloud Jul 13, 2020
95ae8d2
Update README to remove both old travis badges and pointers to unmain…
poros Jul 20, 2020
6c3b4cd
Update libflate to version 1.0 (#151)
poros Jul 24, 2020
b3edfac
Make errors more fine-grained (#146)
cpcloud Aug 13, 2020
743a6df
Update migration_guide.md
poros Aug 13, 2020
4aae22d
support to convert avro value to json value (#155)
aananthram Aug 13, 2020
8249051
Implement deserialize for Uuid (#153)
piropaolo27 Aug 13, 2020
a89d82e
Update CHANGELOG.md
poros Aug 13, 2020
0ca45b4
Bump version to 0.11.0
poros Aug 13, 2020
c2dbe43
Implement the Rabin fingerprint algorithm (#157)
jeffw-wherethebitsroam Sep 9, 2020
2e24700
Update CHANGELOG.md
poros Sep 9, 2020
389e5ea
Schedule ci.yml
poros Nov 25, 2020
2817b09
Schedule clippy.yml
poros Nov 25, 2020
9eebe82
Add workflow_dispatch to all workflows
poros Nov 25, 2020
f59297f
Run and fix docs tests
poros Nov 25, 2020
1b3e973
Fix matches macro clippy error
poros Nov 25, 2020
9d99073
Bump MSRV to 1.42.0 for subslices patterns and more clippy fixes
poros Nov 25, 2020
1e16824
Remove trailing comma from matches! because support added in 1.48.0
poros Nov 25, 2020
9a42a2b
Revert "Remove trailing comma from matches! because support added in …
poros Nov 25, 2020
226ba8a
Tired of trying to compile on older versions. MSRV is 1.48.0
poros Nov 25, 2020
318cb46
Appease the clippy gods
poros Nov 27, 2020
9076770
Update ci.yml
poros Nov 27, 2020
4e372de
Strip more fields in PCF (#164)
lerouxrgd Nov 27, 2020
d5b1970
Update changelog
poros Nov 27, 2020
d5179c3
Try using stable toolchain for clippy check
poros Nov 27, 2020
de6153e
Bump to v0.12.0
poros Nov 27, 2020
f28acbb
Bump rand crate to 0.7.0 (#168)
fanatid Dec 16, 2020
5d97f28
Remove unnecessary cast (clippy warning) (#172)
atsheehan Jan 23, 2021
d8299dc
allow Value::Bytes to be assigned to Schema::Fixed ... (#171)
dgrijalva-squire Jan 28, 2021
9c248bd
Allow resolution of union schemas with logical types (#176)
zyxw59 Jan 28, 2021
8c02574
Use `main` as branch name in the README
flavray Jan 29, 2021
eef23fc
Support for parsing a list of schemas which may have cross dependenci…
batconjurer Jan 29, 2021
f0c2ac2
Bump to v0.13.0
flavray Jan 29, 2021
8e5a8ef
Validate maps as records (#178)
Feb 7, 2021
941000b
Validate enum symbols (#181)
flavray Feb 7, 2021
88a6014
Import avro-rs into Apache Avro
iemejia May 24, 2021
7f15e3d
Switch LICENSE to Apache Software License v2 (ASL)
iemejia May 24, 2021
f84c53c
Add Apache Software License (ASL) headers
iemejia May 24, 2021
e80bd25
Add lang/rust to the RAT configuration
iemejia May 24, 2021
8cf8e70
Integrate Rust module into parent Github Actions
iemejia May 24, 2021
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
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ Perl: ["lang/perl/**/*"]
Php: ["lang/php/**/*"]
Python: ["lang/py/**/*"]
Ruby: ["lang/ruby/**/*"]
Rust: ["lang/rust/**/*"]
build: ["**/*Dockerfile*", "**/*.sh", "**/*pom.xml", ".github/**/*"]
website: ["doc/**/*"]
39 changes: 39 additions & 0 deletions .github/workflows/test-lang-rust-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- .github/workflows/test-lang-rust-audit.yml
- lang/rust/Cargo.toml
- lang/rust/Cargo.lock

name: Security Audit
iemejia marked this conversation as resolved.
Show resolved Hide resolved
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
76 changes: 76 additions & 0 deletions .github/workflows/test-lang-rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- .github/workflows/test-lang-rust-ci.yml
- lang/rust/**

name: Continuous Integration
iemejia marked this conversation as resolved.
Show resolved Hide resolved

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
- 1.48.0 # MSRV

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt

- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features --all-targets

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all-targets

# because of https://github.com/rust-lang/cargo/issues/6669
- name: Test docs
uses: actions-rs/cargo@v1
with:
command: test
args: --doc
43 changes: 43 additions & 0 deletions .github/workflows/test-lang-rust-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- .github/workflows/test-lang-rust-clippy.yml
- lang/rust/**

name: Clippy Check
iemejia marked this conversation as resolved.
Show resolved Hide resolved

jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -Dclippy::all -Dunused_imports
20 changes: 20 additions & 0 deletions lang/rust/.activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

make install-hooks
22 changes: 22 additions & 0 deletions lang/rust/.deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

if [[ "$VIRTUAL_ENV" != "" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't VIRTUAL_ENV a python-specific environment variable? Does the rust build system work within a python ecosystem?

Copy link
Contributor

@poros poros Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tool to automatically install and activate the virtualenv where pre-commit hooks live without having to do it manually. This for the quality of life of the developers, but it isn't necessary for the project to build at all. You can safely remove it, if you don't want to use it.

deactivate
fi
7 changes: 7 additions & 0 deletions lang/rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/target/
**/*.rs.bk
Cargo.lock
*.swp
.idea/
*.iml
precommit_venv/
33 changes: 33 additions & 0 deletions lang/rust/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

- repo: local
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should either put .pre-commit-config.yaml at the repo root, or ensure that it can apply different config files to different lang trees…

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I would like to introduce pre-commit to lang/py as well, if not everything.)

hooks:
- id: rust-linting
name: Rust linting
description: Run cargo fmt on files included in the commit. rustfmt should be installed before-hand.
entry: cargo fmt --all --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit. clippy should be installed before-hand.
entry: cargo clippy --all-targets --all-features -- -Dclippy::all
pass_filenames: false
types: [file, rust]
language: system
1 change: 1 addition & 0 deletions lang/rust/.requirements-precommit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pre-commit==1.14.4
Loading