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

Fix Spotless PreCommit #34048

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/beam_PreCommit_Spotless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
uses: ./.github/actions/gradle-command-self-hosted-action
with:
gradle-command: spotlessCheck checkStyleMain checkStyleTest :buildSrc:spotlessCheck
arguments: -PdisableSpotlessApply
- name: Upload test report
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ tasks.register("checkSetup") {

// if not disabled make spotlessApply dependency of compileJava and compileTestJava
val disableSpotlessCheck: String by project
val isSpotlessDisabled = project.hasProperty("disableSpotlessCheck") &&
disableSpotlessCheck == "true"
val isSpotlessDisabled = (project.hasProperty("disableSpotlessCheck") &&
disableSpotlessCheck == "true") || project.hasProperty("disableSpotlessApply")
if (!isSpotlessDisabled) {
subprojects {
afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ public void process(ProcessContext c) {}

// And digging to check whether the window is ready
when(mockEvaluationContext.createSideInputReader(anyList())).thenReturn(mockSideInputReader);
when(mockSideInputReader.isReady(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(false);
when(mockSideInputReader.isReady(ArgumentMatchers.any(), ArgumentMatchers.any()))
.thenReturn(false);

IntervalWindow firstWindow = new IntervalWindow(new Instant(0), new Instant(9));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ public void testPartialGroupByKeyWithCombinerAndSideInputs() throws Exception {
ImmutableList.of(
WindowedValue.valueInGlobalWindow(KV.of("hi", 4)),
WindowedValue.valueInGlobalWindow(KV.of("there", 5))));
when(mockSideInputFetcher.storeIfBlocked(ArgumentMatchers.<WindowedValue<KV<String, Integer>>>any()))
when(mockSideInputFetcher.storeIfBlocked(
ArgumentMatchers.<WindowedValue<KV<String, Integer>>>any()))
.thenReturn(false, false, false, true);

pgbkParDoFn.startBundle(receiver);
Expand Down Expand Up @@ -360,7 +361,8 @@ public void testCreateWithCombinerAndStreamingSideInputs() throws Exception {

when(mockSideInputReader.isEmpty()).thenReturn(false);
when(mockStreamingStepContext.stateInternals()).thenReturn((StateInternals) mockStateInternals);
when(mockStateInternals.state(ArgumentMatchers.<StateNamespace>any(), ArgumentMatchers.<StateTag>any()))
when(mockStateInternals.state(
ArgumentMatchers.<StateNamespace>any(), ArgumentMatchers.<StateTag>any()))
.thenReturn(mockState);
when(mockState.read()).thenReturn(Maps.newHashMap());

Expand Down Expand Up @@ -394,7 +396,8 @@ public void testCoderSizeEstimationWithNonLazyObserver() throws Exception {
return null;
})
.when(mockCoder)
.registerByteSizeObserver(ArgumentMatchers.eq("apple"), ArgumentMatchers.<ElementByteSizeObserver>any());
.registerByteSizeObserver(
ArgumentMatchers.eq("apple"), ArgumentMatchers.<ElementByteSizeObserver>any());
CoderSizeEstimator<String> estimator = new CoderSizeEstimator(mockCoder);
assertEquals(5, estimator.estimateSize("apple"));
}
Expand All @@ -410,7 +413,8 @@ public void testCoderSizeEstimationWithLazyObserver() throws Exception {
return null;
})
.when(mockCoder)
.registerByteSizeObserver(ArgumentMatchers.eq("apple"), ArgumentMatchers.<ElementByteSizeObserver>any());
.registerByteSizeObserver(
ArgumentMatchers.eq("apple"), ArgumentMatchers.<ElementByteSizeObserver>any());

// Encode the input to the output stream
doAnswer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ public RemoteEnvironment createEnvironment(Environment environment, String worke
String containerId = null;
InstructionRequestHandler instructionHandler = null;
try {
LOG.info("Running Docker command: image={}, opts={}, args={}", containerImage, dockerOptsBuilder.build(), argsBuilder.build());
LOG.info(
"Running Docker command: image={}, opts={}, args={}",
containerImage,
dockerOptsBuilder.build(),
argsBuilder.build());
containerId = docker.runImage(containerImage, dockerOptsBuilder.build(), argsBuilder.build());
LOG.debug("Created Docker Container with Container ID {}", containerId);
// Wait on a client from the gRPC server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,11 @@ public class BigQueryIO {
private static final String DATASET_REGEXP = "[-\\w.]{1,1024}";

/**
* Regular expression that matches BigQuery Table IDs.
* Supports Unicode characters in categories:
* - L (letter)
* - M (mark)
* - N (number)
* As well as:
* - Underscore (_)
* - Dash (-)
* - Dollar sign ($)
* - At sign (@)
* - Space
* Regular expression that matches BigQuery Table IDs. Supports Unicode characters in categories:
* - L (letter) - M (mark) - N (number) As well as: - Underscore (_) - Dash (-) - Dollar sign ($)
* - At sign (@) - Space
*
* The pattern requires 1-1024 characters matching these categories.
* <p>The pattern requires 1-1024 characters matching these categories.
*/
private static final String TABLE_REGEXP = "[-_\\p{L}\\p{N}\\p{M}$@ ]{1,1024}";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down
Loading