10000 Fix 14 DeadCode findings: · coderabbit-test/bazel@9997b3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9997b3d

Browse files
Googlercopybara-github
authored andcommitted
Fix 14 DeadCode findings:
* actual appears to be dead and not tested. (4 times) * toolchainTypes appears to be dead and not tested. (3 times) * forToolchainType appears to be dead and not tested. * hasToolchainType appears to be dead and not tested. * resolvedToolchainContexts appears to be dead and not tested. * resolvedToolchains appears to be dead and not tested. * ruleClasses appears to be dead and not tested. * starlarkDefinedAspects appears to be dead and not tested. * toolchainCollections appears to be dead and not tested. PiperOrigin-RevId: 555396453 Change-Id: Ib498d1e73ed557a31f3826efac08dd778225fd5a
1 parent b6d9b95 commit 9997b3d

File tree

5 files changed

+0
-61
lines changed

5 files changed

+0
-61
lines changed

src/test/java/com/google/devtools/build/lib/analysis/testing/ExecGroupSubject.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import com.google.common.truth.FailureMetadata;
1919
import com.google.common.truth.IterableSubject;
20-
import com.google.common.truth.MapSubject;
2120
import com.google.common.truth.StringSubject;
2221
import com.google.common.truth.Subject;
2322
import com.google.devtools.build.lib.cmdline.Label;
@@ -42,10 +41,6 @@ protected ExecGroupSubject(FailureMetadata failureMetadata, ExecGroup subject) {
4241
this.actual = subject;
4342
}
4443

45-
public MapSubject toolchainTypes() {
46-
return check("toolchainTypes()").that(actual.toolchainTypesMap());
47-
}
48-
4944
public ToolchainTypeRequirementSubject toolchainType(String toolchainTypeLabel) {
5045
return toolchainType(Label.parseCanonicalUnchecked(toolchainTypeLabel));
5146
}

src/test/java/com/google/devtools/build/lib/analysis/testing/ResolvedToolchainContextSubject.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.common.truth.Subject;
2121
import com.google.devtools.build.lib.analysis.ResolvedToolchainContext;
2222
import com.google.devtools.build.lib.cmdline.Label;
23-
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
2423

2524
/** A Truth {@link Subject} for {@link ResolvedToolchainContext}. */
2625
public class ResolvedToolchainContextSubject extends ToolchainContextSubject {
@@ -32,12 +31,6 @@ public static ResolvedToolchainContextSubject assertThat(
3231
return assertAbout(RESOLVED_TOOLCHAIN_CONTEXT_SUBJECT_FACTORY).that(resolvedToolchainContext);
3332
}
3433

35-
/** Static method for getting the subject factory (for use with assertAbout()). */
36-
public static Factory<ResolvedToolchainContextSubject, ResolvedToolchainContext>
37-
resolvedToolchainContexts() {
38-
return RESOLVED_TOOLCHAIN_CONTEXT_SUBJECT_FACTORY;
39-
}
40-
4134
static final Factory<ResolvedToolchainContextSubject, ResolvedToolchainContext>
4235
RESOLVED_TOOLCHAIN_CONTEXT_SUBJECT_FACTORY = ResolvedToolchainContextSubject::new;
4336

@@ -51,11 +44,6 @@ private ResolvedToolchainContextSubject(
5144
this.actual = subject;
5245
}
5346

54-
public ToolchainInfoSubject forToolchainType(String toolchainTypeLabel)
55-
throws LabelSyntaxException {
56-
return forToolchainType(Label.parseCanonical(toolchainTypeLabel));
57-
}
58-
5947
public ToolchainInfoSubject forToolchainType(Label toolchainType) {
6048
return check("forToolchainType(%s)", toolchainType)
6149
.about(toolchainInfos())

src/test/java/com/google/devtools/build/lib/analysis/testing/RuleClassSubject.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.common.base.Functions;
2020
import com.google.common.collect.ImmutableMap;
2121
import com.google.common.truth.FailureMetadata;
22-
import com.google.common.truth.MapSubject;
2322
import com.google.common.truth.Subject;
2423
import com.google.devtools.build.lib.analysis.config.ToolchainTypeRequirement;
2524
import com.google.devtools.build.lib.cmdline.Label;
@@ -35,19 +34,10 @@ public static RuleClassSubject assertThat(RuleClass ruleClass) {
3534
return assertAbout(RuleClassSubject::new).that(ruleClass);
3635
}
3736

38-
/** Static method for getting the subject factory (for use with assertAbout()). */
39-
public static Subject.Factory<RuleClassSubject, RuleClass> ruleClasses() {
40-
return RuleClassSubject::new;
41-
}
42-
43-
// Instance fields.
44-
45-
private final RuleClass actual;
4637
private final Map<Label, ToolchainTypeRequirement> toolchainTypesMap;
4738

4839
protected RuleClassSubject(FailureMetadata failureMetadata, RuleClass subject) {
4940
super(failureMetadata, subject);
50-
this.actual = subject;
5141
this.toolchainTypesMap = makeToolchainTypesMap(subject);
5242
}
5343

@@ -57,10 +47,6 @@ private static ImmutableMap<Label, ToolchainTypeRequirement> makeToolchainTypesM
5747
.collect(toImmutableMap(ToolchainTypeRequirement::toolchainType, Functions.identity()));
5848
}
5949

60-
public MapSubject toolchainTypes() {
61-
return check("toolchainTypes()").that(toolchainTypesMap);
62-
}
63-
6450
public ToolchainTypeRequirementSubject toolchainType(String toolchainTypeLabel) {
6551
return toolchainType(Label.parseCanonicalUnchecked(toolchainTypeLabel));
6652
}

src/test/java/com/google/devtools/build/lib/analysis/testing/StarlarkDefinedAspectSubject.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.common.base.Functions;
2020
import com.google.common.collect.ImmutableMap;
2121
import com.google.com 3419 mon.truth.FailureMetadata;
22-
import com.google.common.truth.MapSubject;
2322
import com.google.common.truth.Subject;
2423
import com.google.devtools.build.lib.analysis.config.ToolchainTypeRequirement;
2524
import com.google.devtools.build.lib.cmdline.Label;
@@ -36,21 +35,11 @@ public static StarlarkDefinedAspectSubject assertThat(
3635
return assertAbout(StarlarkDefinedAspectSubject::new).that(starlarkDefinedAspect);
3736
}
3837

39-
/** Static method for getting the subject factory (for use with assertAbout()). */
40-
public static Subject.Factory<StarlarkDefinedAspectSubject, StarlarkDefinedAspect>
41-
starlarkDefinedAspects() {
42-
return StarlarkDefinedAspectSubject::new;
43-
}
44-
45-
// Instance fields.
46-
47-
private final StarlarkDefinedAspect actual;
4838
private final Map<Label, ToolchainTypeRequirement> toolchainTypesMap;
4939

5040
protected StarlarkDefinedAspectSubject(
5141
FailureMetadata failureMetadata, StarlarkDefinedAspect subject) {
5242
super(failureMetadata, subject);
53-
this.actual = subject;
5443
this.toolchainTypesMap = makeToolchainTypesMap(subject);
5544
}
5645

@@ -60,10 +49,6 @@ private static ImmutableMap<Label, ToolchainTypeRequirement> makeToolchainTypesM
6049
.collect(toImmutableMap(ToolchainTypeRequirement::toolchainType, Functions.identity()));
6150
}
6251

63-
public MapSubject toolchainTypes() {
64-
return check("getToolchainTypes()").that(toolchainTypesMap);
65-
}
66-
6752
public ToolchainTypeRequirementSubject toolchainType(String toolchainTypeLabel) {
6853
return toolchainType(Label.parseCanonicalUnchecked(toolchainTypeLabel));
6954
}
@@ -78,9 +63,5 @@ public void hasToolchainType(String toolchainTypeLabel) {
7863
toolchainType(toolchainTypeLabel).isNotNull();
7964
}
8065

81-
public void hasToolchainType(Label toolchainType) {
82-
toolchainType(toolchainType).isNotNull();
83-
}
84-
8566
// TODO(blaze-team): Add more useful methods.
8667
}

src/test/java/com/google/devtools/build/lib/analysis/testing/ToolchainCollectionSubject.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import static com.google.devtools.build.lib.analysis.testing.To DE21 olchainContextSubject.toolchainContexts;
1818

1919
import com.google.common.truth.FailureMetadata;
20-
import com.google.common.truth.IterableSubject;
2120
import com.google.common.truth.Subject;
2221
import com.google.devtools.build.lib.analysis.ToolchainCollection;
2322
import com.google.devtools.build.lib.packages.ExecGroup;
@@ -31,12 +30,6 @@ public static ToolchainCollectionSubject assertThat(ToolchainCollection<?> toolc
3130
return assertAbout(ToolchainCollectionSubject::new).that(toolchainCollection);
3231
}
3332

34-
/** Static method for getting the subject factory (for use with assertAbout()). */
35-
public static Subject.Factory<ToolchainCollectionSubject, ToolchainCollection<?>>
36-
toolchainCollections() {
37-
return ToolchainCollectionSubject::new;
38-
}
39-
4033
// Instance fields.
4134

4235
private final ToolchainCollection<?> actual;
@@ -59,10 +52,6 @@ public ToolchainContextSubject defaultToolchainContext() {
5952
.that(actual.getDefaultToolchainContext());
6053
}
6154

62-
public IterableSubject resolvedToolchains() {
63-
return check("getResolvedToolchains()").that(actual.getResolvedToolchains());
64-
}
65-
6655
public void hasExecGroup(String execGroup) {
6756
check("hasToolchainContext(%s)", execGroup)
6857
.that(actual.getToolchainContext(execGroup))

0 commit comments

Comments
 (0)
0