Skip to content

#### Entity relationship diagram for Counter contract storage #149

@Dargon789

Description

@Dargon789

Reviewer's Guide

This PR enriches the documentation pipeline by adding variant‐table support, refactors provider‐selection and sorting routines to use more robust pattern and comparison methods, applies a minor regex fix for test redactions, adds missing comment‐conversion helpers, bumps a dependency, and layers in comprehensive CI scaffolding—including multiple GitHub workflows, issue templates, and a new “counter” example project.

Entity relationship diagram for Counter contract storage

erDiagram
    COUNTER {
        uint256 number
    }
Loading

Class diagram for new and updated documentation writer types

classDiagram
    class BufWriter {
        +try_write_variant_table(params: EnumDefinition, comments: Comments)
        +try_write_properties_table(params, comments)
        +try_write_events_table(params, comments)
    }
    class Comments {
        +From<Vec<Comment>>
    }
    class EnumDefinition {
        values
    }
    class Comment {
        tag
        match_first_word(name)
    }
    BufWriter --> EnumDefinition
    BufWriter --> Comments
    Comments <|-- Comment
    EnumDefinition "1" -- "*" Comment : values
Loading

Class diagram for Counter Solidity contract

classDiagram
    class Counter {
        +number: uint256
        +setNumber(newNumber: uint256)
        +increment()
    }
Loading

Class diagram for CounterScript Solidity contract

classDiagram
    class CounterScript {
        +counter: Counter
        +setUp()
        +run()
    }
    CounterScript --> Counter
Loading

File-Level Changes

Change Details Files
Add variant table rendering in documentation
  • Define VARIANTS_TABLE_HEADERS and separator
  • Implement try_write_variant_table in BufWriter
  • Invoke try_write_variant_table after writing enum sections
crates/doc/src/writer/buf_writer.rs
crates/doc/src/writer/as_doc.rs
Refactor VerificationProviderType to use matches! macros and simplify key checks
  • Replace is_sourcify/is_etherscan calls with matches!
  • Always use Sourcify when specified and enforce API key only for Etherscan
  • Remove helper methods and redundant key existence checks
crates/verify/src/provider.rs
Standardize comparisons to use partial_cmp with unwrap fallback
  • Swap total_cmp for partial_cmp(...).unwrap_or(Ordering::Equal) in snapshot sorting and pct formatting
  • Apply same pattern in suggestions and contract matching
crates/forge/src/cmd/snapshot.rs
crates/cli/src/utils/suggestions.rs
crates/common/src/contracts.rs
Adjust test redactions to expect ETH symbol
  • Update regex in test-utils to match “ETH” only
crates/test-utils/src/util.rs
Add missing Comments conversion helper and minor syntax fixes
  • Implement From<Vec> for Comments
  • Add missing semicolons on return statements in comment parser
crates/doc/src/parser/comment.rs
Bump dependency and add CI/workflow scaffolding with example project
  • Downgrade derive_more to 1.0
  • Update actions/setup-python to v4 and pip install
  • Add CodeQL, Jekyll, Docker, APIsec, and CircleCI configs
  • Introduce GitHub issue templates (bug, feature, custom)
  • Include a new “counter” example with source, test, script, README, and foundry.toml
Cargo.toml
.github/workflows/nextest.yml
.github/workflows/codeql.yml
.github/workflows/jekyll.yml
counter/.github/workflows/test.yml
.github/workflows/docker-image.yml
.github/ISSUE_TEMPLATE/bug_report.md
.github/ISSUE_TEMPLATE/feature_request.md
.github/ISSUE_TEMPLATE/custom.md
.circleci/config.yml
.github/workflows/apisec-scan.yml
.deps/remix-tests/remix_tests.sol
.deps/remix-tests/remix_accounts.sol
counter/README.md
counter/test/Counter.t.sol
counter/script/Counter.s.sol
counter/src/Counter.sol
counter/foundry.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Originally posted by @sourcery-ai[bot] in #145 (comment)

Sub-issues

Metadata

Metadata

Assignees

Labels

P-highT-bugdependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentationgithub_actionsPull requests that update GitHub Actions codegood first issueGood for newcomers

Projects

Status

Backlog

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions