Skip to content

Commit 4da2805

Browse files
committed
updated as per quality checks and fixed issue with formatting
Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
1 parent e58a6ad commit 4da2805

File tree

16 files changed

+341
-327
lines changed

16 files changed

+341
-327
lines changed

.github/copilot-instructions.md

Lines changed: 63 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,87 @@
11
# Project-specific Copilot instructions
22

33
## How to build and run
4+
45
- when working with gradle module `:tools-and-tests:tools` it is actually `:tools`. Default full build task is
56
`shadowJar` which builds all modules and creates an "all-in-one" jar `tools-and-tests/tools/build/libs/tools-0.21.0-SNAPSHOT-all.jar`.
67
- to run the block CLI tool `:tools` after building, use: `java -jar tools-and-tests/tools/build/libs/tools-0.21.0-SNAPSHOT-all.jar [args]`
78

89
## Coding style and conventions
10+
911
This provides explicit, actionable guidance for generating Java source that matches this repository's coding style and formatting rules.
1012

1113
- File header and license:
12-
- Every Java source file must start with the SPDX license header exactly as a single-line comment:
13-
// SPDX-License-Identifier: Apache-2.0
14-
- The SPDX header must be the first non-empty line in the file, followed by the `package` statement.
15-
14+
- Every Java source file must start with the SPDX license header exactly as a single-line comment:
15+
// SPDX-License-Identifier: Apache-2.0
16+
- The SPDX header must be the first non-empty line in the file, followed by the `package` statement.
1617
- Package and imports:
17-
- Always include a `package` declaration after the SPDX header.
18-
- Do not use wildcard imports (`import java.util.*`).
19-
- Preferred import ordering: java.*, javax.*, org.*, com.*, then project packages (alphabetical within each group).
20-
- Keep a single blank line between the package statement and imports, and a single blank line between imports and type declaration.
21-
18+
- Always include a `package` declaration after the SPDX header.
19+
- Do not use wildcard imports (`import java.util.*`).
20+
- Preferred import ordering: java.*, javax.*, org.*, com.*, then project packages (alphabetical within each group).
21+
- Keep a single blank line between the package statement and imports, and a single blank line between imports and type declaration.
2222
- Javadoc:
23-
- Provide Javadoc for all public classes, interfaces, enums, methods, and fields.
24-
- For short descriptions prefer a single-line Javadoc, e.g.:
25-
/** The Constants class defines the constants for the block simulator. */
26-
- For longer descriptions, use a standard block Javadoc and avoid blank lines without <p> tags if a paragraph split is required, e.g.:
27-
/**
28-
* Builds X and returns Y.
29-
*
30-
* <p>This method does ...
31-
*
32-
* @param input the input value
33-
* @return the result
34-
*/
35-
- Include `@param`, `@return`, and `@throws` tags where applicable for public APIs.
36-
- Close all HTML tags and use `<ul>`, `<li>` for lists (no Markdown lists inside Javadoc).
23+
- Provide Javadoc for all public classes, interfaces, enums, methods, and fields.
24+
- For short descriptions prefer a single-line Javadoc, e.g.:
25+
/** The Constants class defines the constants for the block simulator. */
26+
- For longer descriptions, use a standard block Javadoc and avoid blank lines without <p> tags if a paragraph split is required, e.g.:
27+
/**
28+
* Builds X and returns Y.
29+
*
30+
*
31+
32+
<p>This method does ...
33+
34+
*
35+
* @param input the input value
36+
* @return the result
37+
*/
38+
39+
- Include `@param`, `@return`, and `@throws` tags where applicable for public APIs.
40+
41+
- Close all HTML tags and use `<ul>`, `<li>` for lists (no Markdown lists inside Javadoc).
3742

3843
- Naming, modifiers, and fields:
39-
- Use long descriptive variable names rather than single-letter names (except loop indices i, j, k).
40-
- Prefer explicit types for public method signatures and fields; prefer `final` for fields that do not change.
41-
- Static constants: `public static final` with UPPER_SNAKE_CASE naming.
42-
- For utility classes, add a private constructor to prevent instantiation.
4344

45+
- Use long descriptive variable names rather than single-letter names (except loop indices i, j, k).
46+
- Prefer explicit types for public method signatures and fields; prefer `final` for fields that do not change.
47+
- Static constants: `public static final` with UPPER_SNAKE_CASE naming.
48+
- For utility classes, add a private constructor to prevent instantiation.
4449
- Formatting and style:
45-
- Indentation: 4 spaces.
46-
- Brace style: opening brace on same line as declaration (K&R).
47-
- Line length: aim for <= 120 characters.
48-
- Use single blank line to separate logical blocks inside methods.
49-
- Use descriptive boolean variable names (e.g., `isEnabled`, `colorfulLogFormatterEnabled`).
50-
50+
- Indentation: 4 spaces.
51+
- Brace style: opening brace on same line as declaration (K&R).
52+
- Line length: aim for <= 120 characters.
53+
- Use single blank line to separate logical blocks inside methods.
54+
- Use descriptive boolean variable names (e.g., `isEnabled`, `colorfulLogFormatterEnabled`).
5155
- Java version and modern APIs:
52-
- Target Java 21 compatibility.
53-
- Prefer modern JDK APIs where appropriate: use `switch` expressions for multi-branch selection, `Objects.requireNonNullElse`, java.time classes, and `HexFormat` for hex conversions.
54-
- Avoid adding third-party dependencies for simple tasks that can be done with the JDK.
55-
- Prefer `record` for simple immutable data carriers where it makes sense and public API stability allows it.
56-
56+
- Target Java 21 compatibility.
57+
- Prefer modern JDK APIs where appropriate: use `switch` expressions for multi-branch selection, `Objects.requireNonNullElse`, java.time classes, and `HexFormat` for hex conversions.
58+
- Avoid adding third-party dependencies for simple tasks that can be done with the JDK.
59+
- Prefer `record` for simple immutable data carriers where it makes sense and public API stability allows it.
5760
- Logging:
58-
- Follow existing project pattern of `java.util.logging`.
59-
- For obtaining a logger: `private static final Logger LOGGER = Logger.getLogger(MyClass.class.getName());`
60-
61+
- Follow existing project pattern of `java.util.logging`.
62+
- For obtaining a logger: `private static final Logger LOGGER = Logger.getLogger(MyClass.class.getName());`
6163
- Tests:
62-
- Place tests under the appropriate `src/test/java` module and match package naming of the production code.
63-
- Tests should be self-contained, use expressive variable names, and include descriptive test method names.
64-
64+
- Place tests under the appropriate `src/test/java` module and match package naming of the production code.
65+
- Tests should be self-contained, use expressive variable names, and include descriptive test method names.
6566
- Avoid:
66-
- Avoid using `var` in public API signatures. Use `var` only in short local contexts where the inferred type is obvious.
67-
- Avoid wildcard imports.
68-
- Avoid unnecessary suppression of warnings; if suppression is used, scope it narrowly and justify in a short comment.
69-
67+
- Avoid using `var` in public API signatures. Use `var` only in short local contexts where the inferred type is obvious.
68+
- Avoid wildcard imports.
69+
- Avoid unnecessary suppression of warnings; if suppression is used, scope it narrowly and justify in a short comment.
7070
- Examples and small templates
71-
- File header template:
72-
// SPDX-License-Identifier: Apache-2.0
73-
package org.hiero.block.example;
74-
/**
75-
* Brief single-line class description.
76-
*/
77-
public final class ExampleClass {
78-
/** Explanation of constant. */
79-
public static final String EXAMPLE_CONSTANT = "value";
80-
/** Constructor prevents instantiation. */
81-
private ExampleClass() {}
82-
}
83-
71+
- File header template:
72+
// SPDX-License-Identifier: Apache-2.0
73+
package org.hiero.block.example;
74+
/**
75+
* Brief single-line class description.
76+
*/
77+
public final class ExampleClass {
78+
/** Explanation of constant. */
79+
public static final String EXAMPLE_CONSTANT = "value";
80+
/** Constructor prevents instantiation. */
81+
private ExampleClass() {}
82+
}
8483
- Spotless and formatting note for Copilot:
85-
- The repository uses an organization-level Spotless plugin wrapper (`org.hiero.gradle.check.spotless`). Generated files should conform to the above formatting so they pass Spotless checks.
86-
- If you are adding or editing Gradle files, prefer the repository's existing Gradle plugin usage over adding new formatting plugins unless approved.
87-
84+
- The repository uses an organization-level Spotless plugin wrapper (`org.hiero.gradle.check.spotless`). Generated files should conform to the above formatting so they pass Spotless checks.
85+
- If you are adding or editing Gradle files, prefer the repository's existing Gradle plugin usage over adding new formatting plugins unless approved.
8886
- When in doubt:
89-
- Match nearby files in the same package/module: copy class-level javadoc style, ordering, and formatting from local examples.
90-
87+
- Match nearby files in the same package/module: copy class-level javadoc style, ordering, and formatting from local examples.

tools-and-tests/tools/BUILDING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Build & Run Tools CLI App
2+
23
Instructions for building and running the command-line tools subproject.
34

45
Prerequisites
@@ -8,11 +9,11 @@ Common tasks
89

910
CLI Tools build
1011
- Build fat JAR with dependencies (correct project path):
11-
- Command line: `./gradlew tools:shadowJar`
12-
- IntelliJ Gradle task: `tools [shadowJar]`
12+
- Command line: `./gradlew tools:shadowJar`
13+
- IntelliJ Gradle task: `tools [shadowJar]`
1314
- Output: `tools-and-tests/tools/build/libs/tools-0.21.0-SNAPSHOT-all.jar`
1415
- Run CLI App:
15-
- Example: `java -jar tools-and-tests/tools/build/libs/tools-0.21.0-SNAPSHOT-all.jar days --help`
16+
- Example: `java -jar tools-and-tests/tools/build/libs/tools-0.21.0-SNAPSHOT-all.jar days --help`
1617

1718
Automation note (for bots and CI)
1819
- Whenever you change any code under `tools-and-tests/tools/**`, build using the exact Gradle task above: `tools:shadowJar`.

tools-and-tests/tools/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
## Table of Contents
44

55
1. [Overview](#overview)
6-
1. [The `blocks` Subcommand](docs/blocks-commands.md)
7-
2. [The `records` Subcommand](docs/record-files-commands.md)
8-
3. [The `days` Subcommand](docs/days-commands.md)
9-
4. [The `mirror` Subcommand](docs/mirror-node-commands.md)
6+
1. [The `blocks` Subcommand](docs/blocks-commands.md)
7+
2. [The `records` Subcommand](docs/record-files-commands.md)
8+
3. [The `days` Subcommand](docs/days-commands.md)
9+
4. [The `mirror` Subcommand](docs/mirror-node-commands.md)
1010
2. [Running from command line](#running-from-command-line)
1111
3. [Help and discovery](#help-and-discovery)
1212
4. [Other Documentation](#other-documentation)
@@ -58,8 +58,8 @@ java -jar tools-and-tests/tools/build/libs/tools-0.21.0-SNAPSHOT-all.jar days do
5858

5959
If you want the README to include example invocations for any specific workflow (e.g. full record→block conversion, or downloading a year's worth of days), tell me which workflow and I'll add a short step-by-step example.
6060

61-
6261
## Other Documentation
62+
6363
Additional documentation for specific techical topics can be found in the `docs/` directory:
6464
- [Address Book Updating](docs/address-book-updating.md)
6565
- [Record Files Format Spec](docs/record-file-format.md)

0 commit comments

Comments
 (0)