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

chore: Add missing javadocs in Consensus Service #15299

Merged
merged 10 commits into from
Sep 18, 2024

Conversation

petreze
Copy link
Contributor

@petreze petreze commented Sep 2, 2024

Description:
This PR adds missing javadocs to Consensus Service

Related issue(s):

Fixes #15283

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Petar Tonev <[email protected]>
@petreze petreze added this to the v0.55 milestone Sep 2, 2024
@petreze petreze self-assigned this Sep 2, 2024
@petreze petreze requested a review from a team September 2, 2024 12:06
@petreze petreze requested review from a team as code owners September 2, 2024 12:06
@petreze petreze requested review from netopyr and dalvizu September 2, 2024 12:06
Copy link

codacy-production bot commented Sep 2, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (60b03c5) 109328 67535 61.77%
Head commit (e428cd4) 109328 (+0) 67535 (+0) 61.77% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#15299) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.23%. Comparing base (60b03c5) to head (e428cd4).
Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop   #15299   +/-   ##
==========================================
  Coverage      58.23%   58.23%           
  Complexity     21611    21611           
==========================================
  Files           2784     2784           
  Lines         109511   109511           
  Branches       11197    11197           
==========================================
  Hits           63773    63773           
  Misses         41866    41866           
  Partials        3872     3872           
Files with missing lines Coverage Δ
...p/service/consensus/impl/ConsensusServiceImpl.java 100.00% <ø> (ø)
...app/service/consensus/impl/WritableTopicStore.java 100.00% <ø> (ø)
...sus/impl/handlers/ConsensusCreateTopicHandler.java 81.96% <ø> (ø)
...sus/impl/handlers/ConsensusDeleteTopicHandler.java 77.50% <ø> (ø)
...us/impl/handlers/ConsensusGetTopicInfoHandler.java 55.55% <ø> (ø)
...ice/consensus/impl/handlers/ConsensusHandlers.java 100.00% <ø> (ø)
...s/impl/handlers/ConsensusSubmitMessageHandler.java 92.85% <ø> (ø)
...sus/impl/handlers/ConsensusUpdateTopicHandler.java 65.44% <ø> (ø)
...e/consensus/impl/schemas/V0490ConsensusSchema.java 100.00% <ø> (ø)
...a/node/app/service/consensus/ConsensusService.java 33.33% <ø> (ø)
... and 1 more

Impacted file tree graph

# Conflicts:
#	hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusHandlers.java
Copy link
Member

@mhess-swl mhess-swl left a comment

Choose a reason for hiding this comment

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

Are these comments required by one of the tools we use? Most of the added javadocs don't really add anything helpful, leading me to believe we're trying to appease Codacy (or some other linter) more than actually improving the code.

For example, indicating default injection over a constructor with // Dagger 2 or // Exists for injection:

    /**
     * Default constructor for injection.
     */
    @Inject
    public ConsensusUpdateTopicHandler() {
        // Exists for injection

The javadoc is just three extra lines that duplicates the existing comment.

Another example is re-wording a file/class name into a sentence form:

/**
 * Unit tests of Consensus Service
 */
public class ConsensusServiceImplTest {

or

/**
 * Util class used in unit tests for Consensus Service
 */
public final class ConsensusTestUtils {

As a general rule, if a javadoc doesn't add any extra information, personally I would prefer not to have the javadoc at all. It's redundant reading. What are your thoughts, though? Are there advantages I'm not thinking about?

Copy link
Contributor Author

@petreze petreze left a comment

Choose a reason for hiding this comment

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

@mhess-swl
There is built in tool inside the IDE that scans for missing javadocs. I agree that some of those suggestions are quite useless or not that much of a win but I see that there are similar javadocs in other services after this refactoring

@petreze petreze requested a review from mhess-swl September 12, 2024 13:24
Copy link
Collaborator

@tinker-michaelj tinker-michaelj left a comment

Choose a reason for hiding this comment

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

LGTM, tyvm @petreze !

@petreze petreze merged commit 55b01b5 into develop Sep 18, 2024
46 checks passed
@petreze petreze deleted the 15283-add-javadocs-consensus-service branch September 18, 2024 14:08
netopyr added a commit that referenced this pull request Sep 19, 2024
* develop: (22 commits)
  test: New HAPI test for TokenAirdrop transaction (#15348)
  test: unit test verifySyncInvalidEd25519() is not stable (#15534)
  chore: add `TracerBinding` interface for `TransactionExecutors`. (#15480)
  chore: Add missing javadocs in Consensus Service (#15299)
  fix: Validate `CustomFees` input arrays in `UpdateTokenCustomFeesDecoder` (#15520)
  feat: migrate event serialization to protobuf (#15417)
  fix: 15494: Improve VirtualLeafRecord serialization to bytes during flushes (#15512)
  docs: tss block signing proposal (#15160)
  fix: 15438: Eliminate busy loop in HalfDiskHashMap.endWriting() (#15439)
  build: cleanup settings.gradle.kts / remove build.gradle.kts (#15470)
  test: fix CryptographyTests (#15529)
  fix: recreate block hash from state (#15444)
  docs: Proposal Process Update - Specify post-acceptance non-material update procedure (#15447)
  chore: testnet event hashing (#15432)
  fix: 15167: Remove timeout from reconnect/rehash Iterators (#15468)
  chore: remove snapshot ops (#15462)
  feat: Add TokenUpdateNFTs as a smart contract operation v2 (#15445)
  feat: introduce PbjRecordHasher and RosterUtils.hash(Roster) (#15457)
  fix: Precision loss for gas calculation of HTS system contracts v2 (#15446)
  chore: correct the variable name in roster.proto (#15465)
  ...

# Conflicts:
#	hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaOperations.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add missing Javadocs in Consensus Service
4 participants