Skip to content

Conversation

Copy link

Copilot AI commented Jul 19, 2025

This PR synchronizes the checkstyle configuration with the one used by the upstream opentelemetry-java-instrumentation project to maintain consistency in code style and quality standards.

Key Changes to checkstyle.xml

Added new rules from OpenTelemetry:

  • OpenTelemetryAssertions import rules: Enforce static imports for OpenTelemetryAssertions and general Assertions classes
  • RequireEmptyLineBeforeBlockTagGroup: Ensure proper Javadoc formatting
  • SuppressionCommentFilter: Enable CHECKSTYLE:OFF/CHECKSTYLE:ON comment-based suppressions
  • SystemOut detection: New Regexp rule to prevent usage of System.out.print, System.err.print, printStackTrace(), and Thread.dumpStack()
  • Updated ConstantName rule: Enforce logger fields to be named logger instead of LOGGER, LOG, or log

Removed/modified rules:

  • Removed LeftCurly and RightCurly modules: These conflict with Google Java Format
  • Commented out AbbreviationAsWordInName: Handled by Error Prone instead
  • Commented out CommentsIndentation: Conflicts with Google Java Format
  • Updated RecordTypeParameterName: Changed format to ^[A-Z]+[0-9]?$ for consistency
  • Updated SuppressionSingleFilter paths: Adapted to match ApplicationInsights-Java structure

Fixed Checkstyle Violations

Fixed 16 files with logger naming violations (renamed LOGGER to logger):

  • SnippetConfiguration.java, DllFileUtils.java, EtwProvider.java
  • NotificationObserver.java, GcCollectionSample.java
  • AlertingSubsystem.java, AlertPipelines.java, SingleAlertPipeline.java
  • CodeOptimizerDiagnosticEngineJfr.java, CalibratorDefault.java
  • LinuxProcessCpuStats.java, LinuxProcessIoStats.java, LinuxProcessDumper.java
  • TwoStepProcReader.java, OperatingSystemDetector.java, SystemStatsProvider.java
  • CodeOptimizerDiagnosticsJfrInit.java, DiagnosticsLoggerProxy.java

Additional Changes

  • Added missing plugin version: Added version for com.github.ben-manes.versions plugin in settings.gradle.kts
  • Suppressed SystemOut violation: Added suppression comment for intentionally commented development utility code in TelemetryClientClassFileTransformer.java

Verification

✅ All checkstyle checks now pass across the entire codebase:

./gradlew checkstyleMain --continue
# BUILD SUCCESSFUL - 59 actionable tasks: 1 executed, 58 up-to-date

The configuration maintains compatibility with the existing Checkstyle 8.37 version while adopting the latest standards from the upstream project.

Fixes #88.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Sync checkstyle configuration with opentelemetry-java-instrumentation Sync checkstyle configuration with opentelemetry-java-instrumentation Jul 19, 2025
Copilot AI requested a review from trask July 19, 2025 17:16
Copilot finished work on behalf of trask July 19, 2025 17:16
Copilot AI requested a review from trask July 19, 2025 17:36
Copilot finished work on behalf of trask July 19, 2025 17:36
…ights/agent/internal/classicsdk/TelemetryClientClassFileTransformer.java
@trask trask marked this pull request as ready for review July 19, 2025 17:48
@trask trask merged commit c01b016 into main Jul 19, 2025
1 check passed
trask added a commit that referenced this pull request Jul 19, 2025
trask added a commit that referenced this pull request Jul 21, 2025
…#89)

* Initial plan

* Sync checkstyle configuration with OpenTelemetry

Co-authored-by: trask <[email protected]>

* Fix checkstyle violations from sync: logger naming and system.out.println

Co-authored-by: trask <[email protected]>

* Complete checkstyle sync - fix all remaining logger naming violations

Co-authored-by: trask <[email protected]>

* Address review comments: remove backup file and relocate plugin version declarations

Co-authored-by: trask <[email protected]>

* Update agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/classicsdk/TelemetryClientClassFileTransformer.java

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: trask <[email protected]>
Co-authored-by: Trask Stalnaker <[email protected]>
trask added a commit that referenced this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync checkstyle configuration with opentelemetry-java-instrumentation

2 participants