use-ink / ink

Polkadot's ink! to write smart contracts.
https://use.ink
Apache License 2.0
1.34k stars 426 forks source link

Linter: Prepare the `ink_linting` crates for publishing #2060

Closed jubnzv closed 8 months ago

jubnzv commented 8 months ago

Summary

Various improvements in ink_linting that allow to publish the its crates on crates.io. This is necessary for https://github.com/paritytech/cargo-contract/pull/1412.

Description

To publish ink_linting on crates.io, we need to prepare the Cargo workspace in linting and resolve all local dependencies to ensure they are also publishable.

The summary to the changes present here:

  1. Published the parity_clippy_utils crate on crates.io and added it as a dependency to ink_linting. We had to do this, because all the dependencies must be present on crates.io, but the original clippy_utils are not. For more context, see: https://github.com/rust-lang/rust-clippy/discussions/12111#discussioncomment-8052237 and https://github.com/rust-lang/rust-clippy/pull/6746#issuecomment-780747522.
  2. Created the separate ink_linting_utils crate that basically contains the existing utilities functions shared between lints and wraps the parity_clippy_utils trait.
  3. Various changes in Cargo.toml files to make cargo publish happy.

The ink_linting and ink_linting_mandatory crates are currently reserved on crates.io and could be replaced with the real ones as soon as this PR is reviewed.

Checklist before requesting a review

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (af90adc) 53.62% compared to head (9a113ea) 53.58%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2060 +/- ## ========================================== - Coverage 53.62% 53.58% -0.05% ========================================== Files 224 224 Lines 7107 7107 Branches 3146 3146 ========================================== - Hits 3811 3808 -3 - Misses 3296 3299 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 8 months ago

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the integration-tests/* contracts from this branch with cargo-contract and comparing them to ink! master:

Contract Upstream Size (kB) PR Size (kB) Diff (kB) Diff (%) Change
basic-contract-caller 3.207 3.207 0 0 :heavy_minus_sign:
basic-contract-caller/other-contract 1.581 1.581 0 0 :heavy_minus_sign:
call-builder-return-value 8.904 8.904 0 0 :heavy_minus_sign:
call-runtime 2.013 2.013 0 0 :heavy_minus_sign:
conditional-compilation 1.453 1.453 0 0 :heavy_minus_sign:
contract-storage 7.336 7.336 0 0 :heavy_minus_sign:
contract-terminate 1.336 1.336 0 0 :heavy_minus_sign:
contract-transfer 1.693 1.693 0 0 :heavy_minus_sign:
custom-allocator 7.652 7.652 0 0 :heavy_minus_sign:
dns 7.321 7.321 0 0 :heavy_minus_sign:
e2e-call-runtime 1.302 1.302 0 0 :heavy_minus_sign:
e2e-runtime-only-backend 1.879 1.879 0 0 :heavy_minus_sign:
erc1155 14.123 14.123 0 0 :heavy_minus_sign:
erc20 6.918 6.918 0 0 :heavy_minus_sign:
erc721 9.816 9.816 0 0 :heavy_minus_sign:
events 5.264 5.264 0 0 :heavy_minus_sign:
flipper 1.637 1.637 0 0 :heavy_minus_sign:
incrementer 1.504 1.504 0 0 :heavy_minus_sign:
lang-err-integration-tests/call-builder-delegate 2.561 2.561 0 0 :heavy_minus_sign:
lang-err-integration-tests/call-builder 5.087 5.087 0 0 :heavy_minus_sign:
lang-err-integration-tests/constructors-return-value 1.987 1.987 0 0 :heavy_minus_sign:
lang-err-integration-tests/contract-ref 4.568 4.568 0 0 :heavy_minus_sign:
lang-err-integration-tests/integration-flipper 1.815 1.815 0 0 :heavy_minus_sign:
lazyvec-integration-test 4.553 4.553 0 0 :heavy_minus_sign:
mapping-integration-tests 7.919 7.919 0 0 :heavy_minus_sign:
mother 12.756 12.756 0 0 :heavy_minus_sign:
multi-contract-caller 6.155 6.155 0 0 :heavy_minus_sign:
multi-contract-caller/accumulator 1.378 1.378 0 0 :heavy_minus_sign:
multi-contract-caller/adder 1.908 1.908 0 0 :heavy_minus_sign:
multi-contract-caller/subber 1.928 1.928 0 0 :heavy_minus_sign:
multisig 21.621 21.621 0 0 :heavy_minus_sign:
payment-channel 5.653 5.653 0 0 :heavy_minus_sign:
sr25519-verification 1.148 1.148 0 0 :heavy_minus_sign:
static-buffer 1.649 1.649 0 0 :heavy_minus_sign:
trait-dyn-cross-contract-calls 2.706 2.706 0 0 :heavy_minus_sign:
trait-dyn-cross-contract-calls/contracts/incrementer 1.549 1.549 0 0 :heavy_minus_sign:
trait-erc20 7.294 7.294 0 0 :heavy_minus_sign:
trait-flipper 1.453 1.453 0 0 :heavy_minus_sign:
trait-incrementer 1.614 1.614 0 0 :heavy_minus_sign:
upgradeable-contracts/delegator 3.152 3.152 0 0 :heavy_minus_sign:
upgradeable-contracts/delegator/delegatee 1.613 1.613 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash 1.747 1.747 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash/updated-incrementer 1.726 1.726 0 0 :heavy_minus_sign:
wildcard-selector 2.852 2.852 0 0 :heavy_minus_sign:

Link to the run | Last update: Fri Jan 12 20:15:03 CET 2024