Skip to content

Commit 11a46d2

Browse files
authored
Merge pull request kubernetes#77479 from danielqsj/id
fix increment-decrement lint error
2 parents 0befec7 + acbe498 commit 11a46d2

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

pkg/credentialprovider/keyring_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func (d *testProvider) LazyProvide(image string) *DockerConfigEntry {
470470

471471
// Provide implements dockerConfigProvider
472472
func (d *testProvider) Provide(image string) DockerConfig {
473-
d.Count += 1
473+
d.Count++
474474
return DockerConfig{}
475475
}
476476

pkg/registry/apps/replicaset/storage/storage_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func TestGenerationNumber(t *testing.T) {
173173
}
174174

175175
// Updates to spec should increment the generation number
176-
storedRS.Spec.Replicas += 1
176+
storedRS.Spec.Replicas++
177177
if _, _, err := storage.ReplicaSet.Update(ctx, storedRS.Name, rest.DefaultUpdatedObjectInfo(storedRS), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
178178
t.Errorf("unexpected error: %v", err)
179179
}
@@ -187,7 +187,7 @@ func TestGenerationNumber(t *testing.T) {
187187
}
188188

189189
// Updates to status should not increment either spec or status generation numbers
190-
storedRS.Status.Replicas += 1
190+
storedRS.Status.Replicas++
191191
if _, _, err := storage.ReplicaSet.Update(ctx, storedRS.Name, rest.DefaultUpdatedObjectInfo(storedRS), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
192192
t.Errorf("unexpected error: %v", err)
193193
}

pkg/registry/core/replicationcontroller/storage/storage_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func TestGenerationNumber(t *testing.T) {
176176
}
177177

178178
// Updates to spec should increment the generation number
179-
controller.Spec.Replicas += 1
179+
controller.Spec.Replicas++
180180
if _, _, err := storage.Controller.Update(ctx, controller.Name, rest.DefaultUpdatedObjectInfo(controller), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
181181
t.Errorf("unexpected error: %v", err)
182182
}
@@ -190,7 +190,7 @@ func TestGenerationNumber(t *testing.T) {
190190
}
191191

192192
// Updates to status should not increment either spec or status generation numbers
193-
controller.Status.Replicas += 1
193+
controller.Status.Replicas++
194194
if _, _, err := storage.Controller.Update(ctx, controller.Name, rest.DefaultUpdatedObjectInfo(controller), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
195195
t.Errorf("unexpected error: %v", err)
196196
}

staging/src/k8s.io/apimachinery/pkg/api/resource/math.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
194194
}
195195
if fraction {
196196
if base > 0 {
197-
value += 1
197+
value++
198198
} else {
199-
value += -1
199+
value--
200200
}
201201
}
202202
return value, !fraction

staging/src/k8s.io/client-go/util/jsonpath/jsonpath.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,17 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
9393

9494
// encounter an end node, break the current block
9595
if j.endRange > 0 && j.endRange <= j.inRange {
96-
j.endRange -= 1
96+
j.endRange--
9797
break
9898
}
9999
// encounter a range node, start a range loop
100100
if j.beginRange > 0 {
101-
j.beginRange -= 1
102-
j.inRange += 1
101+
j.beginRange--
102+
j.inRange++
103103
for k, value := range results {
104104
j.parser.Root.Nodes = nodes[i+1:]
105105
if k == len(results)-1 {
106-
j.inRange -= 1
106+
j.inRange--
107107
}
108108
nextResults, err := j.FindResults(value.Interface())
109109
if err != nil {
@@ -213,11 +213,11 @@ func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) (
213213
switch node.Name {
214214
case "range":
215215
j.stack = append(j.stack, j.cur)
216-
j.beginRange += 1
216+
j.beginRange++
217217
results = input
218218
case "end":
219219
if j.endRange < j.inRange { // inside a loop, break the current block
220-
j.endRange += 1
220+
j.endRange++
221221
break
222222
}
223223
// the loop is about to end, pop value and continue the following execution

test/e2e/network/service_latency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func runServiceLatencies(f *framework.Framework, inParallel, total int, acceptab
177177
select {
178178
case e := <-errs:
179179
e2elog.Logf("Got error: %v", e)
180-
errCount += 1
180+
errCount++
181181
case d := <-durations:
182182
output = append(output, d)
183183
}

test/e2e_node/garbage_collector_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
200200
containerCount := 0
201201
for _, containerName := range containerNames {
202202
if containerName == pod.getContainerName(i) {
203-
containerCount += 1
203+
containerCount++
204204
}
205205
}
206206
if containerCount > maxPerPodContainer+1 {
@@ -228,7 +228,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
228228
containerCount := 0
229229
for _, containerName := range containerNames {
230230
if containerName == pod.getContainerName(i) {
231-
containerCount += 1
231+
containerCount++
232232
}
233233
}
234234
if pod.restartCount > 0 && containerCount < maxPerPodContainer+1 {

0 commit comments

Comments
 (0)