Skip to content

Commit

Permalink
chore: adjust justfile, update clippy ci tasks
Browse files Browse the repository at this point in the history
Signed-off-by: James Ebert <[email protected]>
  • Loading branch information
JamesKEbert committed Dec 11, 2024
1 parent 459bc7d commit 3acd25b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 60 deletions.
29 changes: 2 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ jobs:
echo "DOCKER_IMG_CACHED_VDRPROXY ${{ needs.workflow-setup.outputs.DOCKER_IMG_CACHED_VDRPROXY }}"
echo "DOCKER_IMG_CACHED_AATH ${{ needs.workflow-setup.outputs.DOCKER_IMG_CACHED_AATH }}"
workspace_clippy:
clippy:
runs-on: ubuntu-20.04
strategy:
matrix:
wallet: ["askar_wallet"]
steps:
- name: "Git checkout"
uses: actions/checkout@v3
Expand All @@ -117,29 +114,7 @@ jobs:
sudo apt-get install -y libsodium-dev libssl-dev libzmq3-dev
sudo snap install --edge --classic just
- name: "Verify clippy across the entire workspace"
run: just clippy-workspace ${{ matrix.wallet }}

aries_vcx_clippy:
runs-on: ubuntu-20.04
strategy:
matrix:
backend: ["anoncreds,askar_wallet", "vdr_proxy_ledger,askar_wallet"]
steps:
- name: "Git checkout"
uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
default: true
components: clippy
- name: "Install dependencies"
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y libsodium-dev libssl-dev libzmq3-dev
sudo snap install --edge --classic just
- name: "Verify clippy across the entire workspace with default features"
run: just clippy-aries-vcx ${{ matrix.backend }}
run: just clippy

##########################################################################################
############################## DOCKER BUILD ##########################################
Expand Down
17 changes: 8 additions & 9 deletions aries/messages/src/msg_fields/protocols/cred_issuance/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ impl DelayedSerde for CredentialIssuanceV1 {
D: Deserializer<'de>,
{
let (protocol, kind_str) = msg_type;
let kind = match protocol {
CredentialIssuanceKind::V1(CredentialIssuanceTypeV1::V1_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V2(_) => {
return Err(D::Error::custom(
let kind =
match protocol {
CredentialIssuanceKind::V1(CredentialIssuanceTypeV1::V1_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V2(_) => return Err(D::Error::custom(
"Cannot deserialize issue-credential-v2 message type into issue-credential-v1",
))
}
};
)),
};

match kind.map_err(D::Error::custom)? {
CredentialIssuanceTypeV1_0::OfferCredential => {
Expand Down
17 changes: 8 additions & 9 deletions aries/messages/src/msg_fields/protocols/cred_issuance/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,15 @@ impl DelayedSerde for CredentialIssuanceV2 {
D: Deserializer<'de>,
{
let (protocol, kind_str) = msg_type;
let kind = match protocol {
CredentialIssuanceKind::V2(CredentialIssuanceTypeV2::V2_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V1(_) => {
return Err(D::Error::custom(
let kind =
match protocol {
CredentialIssuanceKind::V2(CredentialIssuanceTypeV2::V2_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V1(_) => return Err(D::Error::custom(
"Cannot deserialize issue-credential-v1 message type into issue-credential-v2",
))
}
};
)),
};

match kind.map_err(D::Error::custom)? {
CredentialIssuanceTypeV2_0::OfferCredential => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,10 @@ mod tests {

#[test]
fn test_process_elements_with_multiple_elements() {
let did: Did =
"did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
let did: Did = "did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
SeyJpZCI6IiNzZXJ2aWNlLTAiLCJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludCJ9"
.parse()
.unwrap();
.parse()
.unwrap();

let did_doc = diddoc_from_peerdid2_elements(
DidDocument::new(did.clone()),
Expand All @@ -164,12 +163,11 @@ mod tests {

#[test]
fn test_process_elements_error_on_invalid_element() {
let did: Did =
"did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
let did: Did = "did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
SeyJpZCI6IiNzZXJ2aWNlLTAiLCJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludCJ9.\
Xinvalid"
.parse()
.unwrap();
.parse()
.unwrap();

match diddoc_from_peerdid2_elements(
DidDocument::new(did.clone()),
Expand Down
9 changes: 2 additions & 7 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ fmt-check:
cargo fmt --check

clippy:
cargo clippy --examples --tests

clippy-workspace wallet:
cargo clippy --examples --tests --no-default-features -F anoncreds,vdr_proxy_ledger,legacy_proof,{{wallet}}

clippy-aries-vcx features:
cargo clippy -p aries_vcx --features legacy_proof --features {{features}} --no-default-features
cargo clippy --examples --tests --all-features

# The following need review:
check-workspace:
cargo check --tests --all-features

Expand Down

0 comments on commit 3acd25b

Please sign in to comment.