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

tests: Remove numeric constants #39840

Merged
merged 713 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
713 commits
Select commit Hold shift + click to select a range
6eeb950
apigateway: De-constant numbers in test code
YakDriver Oct 23, 2024
5fa0cf9
apigatewayv2: De-constant numbers in test code
YakDriver Oct 23, 2024
7301dfb
appautoscaling: De-constant numbers in test code
YakDriver Oct 23, 2024
d366e33
appconfig: De-constant numbers in test code
YakDriver Oct 23, 2024
69fd602
appfabric: De-constant numbers in test code
YakDriver Oct 23, 2024
e5fe53a
appflow: De-constant numbers in test code
YakDriver Oct 23, 2024
a6c8188
appintegrations: De-constant numbers in test code
YakDriver Oct 23, 2024
0bd56fa
appmesh: De-constant numbers in test code
YakDriver Oct 23, 2024
8ce4d14
apprunner: De-constant numbers in test code
YakDriver Oct 23, 2024
7f57928
appstream: De-constant numbers in test code
YakDriver Oct 23, 2024
d805f48
appsync: De-constant numbers in test code
YakDriver Oct 23, 2024
2770e9d
athena: De-constant numbers in test code
YakDriver Oct 23, 2024
352ae3e
auditmanager: De-constant numbers in test code
YakDriver Oct 23, 2024
38cb928
autoscaling: De-constant numbers in test code
YakDriver Oct 23, 2024
cc585a3
autoscalingplans: De-constant numbers in test code
YakDriver Oct 23, 2024
8dd3740
backup: De-constant numbers in test code
YakDriver Oct 23, 2024
43a5c99
batch: De-constant numbers in test code
YakDriver Oct 23, 2024
41df6a0
bcmdataexports: De-constant numbers in test code
YakDriver Oct 23, 2024
1d1dbe1
bedrock: De-constant numbers in test code
YakDriver Oct 23, 2024
62a6fba
bedrockagent: De-constant numbers in test code
YakDriver Oct 23, 2024
c79b58b
budgets: De-constant numbers in test code
YakDriver Oct 23, 2024
3fb693b
ce: De-constant numbers in test code
YakDriver Oct 23, 2024
e870c54
chime: De-constant numbers in test code
YakDriver Oct 23, 2024
e44ec61
chimesdkmediapipelines: De-constant numbers in test code
YakDriver Oct 23, 2024
c40f384
chimesdkvoice: De-constant numbers in test code
YakDriver Oct 23, 2024
56ffac2
cleanrooms: De-constant numbers in test code
YakDriver Oct 23, 2024
bcf374f
cloud9: De-constant numbers in test code
YakDriver Oct 23, 2024
e0bc140
cloudformation: De-constant numbers in test code
YakDriver Oct 23, 2024
3db3ef8
cloudfront: De-constant numbers in test code
YakDriver Oct 23, 2024
a7bb0e9
cloudhsmv2: De-constant numbers in test code
YakDriver Oct 23, 2024
51ad257
cloudsearch: De-constant numbers in test code
YakDriver Oct 23, 2024
7498b4d
cloudtrail: De-constant numbers in test code
YakDriver Oct 23, 2024
cc6f675
cloudwatch: De-constant numbers in test code
YakDriver Oct 23, 2024
4682851
codeartifact: De-constant numbers in test code
YakDriver Oct 23, 2024
7cc2593
codebuild: De-constant numbers in test code
YakDriver Oct 23, 2024
5a9f270
codecatalyst: De-constant numbers in test code
YakDriver Oct 23, 2024
abc5c87
codecommit: De-constant numbers in test code
YakDriver Oct 23, 2024
d22ebde
codeguruprofiler: De-constant numbers in test code
YakDriver Oct 23, 2024
e592002
codegurureviewer: De-constant numbers in test code
YakDriver Oct 23, 2024
1171104
codepipeline: De-constant numbers in test code
YakDriver Oct 23, 2024
59eab0c
codestarconnections: De-constant numbers in test code
YakDriver Oct 23, 2024
e2983e4
codestarnotifications: De-constant numbers in test code
YakDriver Oct 23, 2024
2e9ed81
cognitoidentity: De-constant numbers in test code
YakDriver Oct 23, 2024
a6bbd8a
cognitoidp: De-constant numbers in test code
YakDriver Oct 23, 2024
eb0c301
comprehend: De-constant numbers in test code
YakDriver Oct 23, 2024
5639330
computeoptimizer: De-constant numbers in test code
YakDriver Oct 23, 2024
0066b45
configservice: De-constant numbers in test code
YakDriver Oct 23, 2024
53427bf
connect: De-constant numbers in test code
YakDriver Oct 23, 2024
ac24484
controltower: De-constant numbers in test code
YakDriver Oct 23, 2024
4708d9f
cur: De-constant numbers in test code
YakDriver Oct 23, 2024
8c33c09
customerprofiles: De-constant numbers in test code
YakDriver Oct 23, 2024
b118ce8
dataexchange: De-constant numbers in test code
YakDriver Oct 23, 2024
5e34559
datasync: De-constant numbers in test code
YakDriver Oct 23, 2024
9220d14
datazone: De-constant numbers in test code
YakDriver Oct 23, 2024
9614974
dax: De-constant numbers in test code
YakDriver Oct 23, 2024
9712d25
deploy: De-constant numbers in test code
YakDriver Oct 23, 2024
c4515d1
detective: De-constant numbers in test code
YakDriver Oct 23, 2024
bc4e162
devicefarm: De-constant numbers in test code
YakDriver Oct 23, 2024
afe9fc3
devopsguru: De-constant numbers in test code
YakDriver Oct 23, 2024
ff49948
directconnect: De-constant numbers in test code
YakDriver Oct 23, 2024
3948b4a
dlm: De-constant numbers in test code
YakDriver Oct 23, 2024
3bab36f
dms: De-constant numbers in test code
YakDriver Oct 23, 2024
dfdf0a6
docdb: De-constant numbers in test code
YakDriver Oct 23, 2024
0b1aacb
docdbelastic: De-constant numbers in test code
YakDriver Oct 23, 2024
00b8fa3
drs: De-constant numbers in test code
YakDriver Oct 23, 2024
432eb64
ds: De-constant numbers in test code
YakDriver Oct 23, 2024
22a9ed8
dynamodb: De-constant numbers in test code
YakDriver Oct 23, 2024
46cf3e3
ec2: De-constant numbers in test code
YakDriver Oct 23, 2024
a1ac4ba
ecr: De-constant numbers in test code
YakDriver Oct 23, 2024
721bc13
ecrpublic: De-constant numbers in test code
YakDriver Oct 23, 2024
e47d84a
ecs: De-constant numbers in test code
YakDriver Oct 23, 2024
802f4e7
efs: De-constant numbers in test code
YakDriver Oct 23, 2024
aa5f16d
eks: De-constant numbers in test code
YakDriver Oct 23, 2024
5c1fa8d
elasticache: De-constant numbers in test code
YakDriver Oct 23, 2024
fdd0c9a
elasticbeanstalk: De-constant numbers in test code
YakDriver Oct 23, 2024
bd0507a
elasticsearch: De-constant numbers in test code
YakDriver Oct 23, 2024
3aaf706
elastictranscoder: De-constant numbers in test code
YakDriver Oct 23, 2024
fadf323
elb: De-constant numbers in test code
YakDriver Oct 23, 2024
5dd1037
elbv2: De-constant numbers in test code
YakDriver Oct 23, 2024
5c0a1c4
emr: De-constant numbers in test code
YakDriver Oct 23, 2024
2ac92c1
emrcontainers: De-constant numbers in test code
YakDriver Oct 23, 2024
f47b169
emrserverless: De-constant numbers in test code
YakDriver Oct 23, 2024
31c92ba
events: De-constant numbers in test code
YakDriver Oct 23, 2024
9feba4e
evidently: De-constant numbers in test code
YakDriver Oct 23, 2024
3e5b1ec
finspace: De-constant numbers in test code
YakDriver Oct 23, 2024
ecad24e
firehose: De-constant numbers in test code
YakDriver Oct 23, 2024
5f5d3f9
fis: De-constant numbers in test code
YakDriver Oct 23, 2024
2c428d9
fms: De-constant numbers in test code
YakDriver Oct 23, 2024
e0310b8
fsx: De-constant numbers in test code
YakDriver Oct 23, 2024
834a8ca
gamelift: De-constant numbers in test code
YakDriver Oct 23, 2024
ea959a9
glacier: De-constant numbers in test code
YakDriver Oct 23, 2024
12811e3
globalaccelerator: De-constant numbers in test code
YakDriver Oct 23, 2024
a0ef620
glue: De-constant numbers in test code
YakDriver Oct 23, 2024
846e533
grafana: De-constant numbers in test code
YakDriver Oct 23, 2024
49592ad
guardduty: De-constant numbers in test code
YakDriver Oct 23, 2024
c981ab5
iam: De-constant numbers in test code
YakDriver Oct 23, 2024
b84e0d7
identitystore: De-constant numbers in test code
YakDriver Oct 23, 2024
ef217e2
imagebuilder: De-constant numbers in test code
YakDriver Oct 23, 2024
c7c8355
inspector: De-constant numbers in test code
YakDriver Oct 23, 2024
4d0996d
inspector2: De-constant numbers in test code
YakDriver Oct 23, 2024
82d4855
internetmonitor: De-constant numbers in test code
YakDriver Oct 23, 2024
25105b0
iot: De-constant numbers in test code
YakDriver Oct 23, 2024
e0ec013
ivs: De-constant numbers in test code
YakDriver Oct 23, 2024
ab044ae
ivschat: De-constant numbers in test code
YakDriver Oct 23, 2024
506de12
kafka: De-constant numbers in test code
YakDriver Oct 23, 2024
a909f67
kafkaconnect: De-constant numbers in test code
YakDriver Oct 23, 2024
a16c10f
kendra: De-constant numbers in test code
YakDriver Oct 23, 2024
84ea3ab
keyspaces: De-constant numbers in test code
YakDriver Oct 23, 2024
8f66e90
kinesis: De-constant numbers in test code
YakDriver Oct 23, 2024
4f87325
kinesisanalytics: De-constant numbers in test code
YakDriver Oct 23, 2024
fa7bf8d
kinesisanalyticsv2: De-constant numbers in test code
YakDriver Oct 23, 2024
c2037b0
kinesisvideo: De-constant numbers in test code
YakDriver Oct 23, 2024
fe71698
kms: De-constant numbers in test code
YakDriver Oct 23, 2024
16f48bc
lakeformation: De-constant numbers in test code
YakDriver Oct 23, 2024
2881a0b
lambda: De-constant numbers in test code
YakDriver Oct 23, 2024
dd8f90a
lexmodels: De-constant numbers in test code
YakDriver Oct 23, 2024
df1c273
lexv2models: De-constant numbers in test code
YakDriver Oct 23, 2024
5a3291e
licensemanager: De-constant numbers in test code
YakDriver Oct 23, 2024
876ee6e
lightsail: De-constant numbers in test code
YakDriver Oct 23, 2024
1b83ffc
location: De-constant numbers in test code
YakDriver Oct 23, 2024
c124b6c
logs: De-constant numbers in test code
YakDriver Oct 23, 2024
fcaaddf
m2: De-constant numbers in test code
YakDriver Oct 23, 2024
c6abb65
macie2: De-constant numbers in test code
YakDriver Oct 23, 2024
13c79d3
mediaconvert: De-constant numbers in test code
YakDriver Oct 23, 2024
318edba
medialive: De-constant numbers in test code
YakDriver Oct 23, 2024
3853f65
mediapackage: De-constant numbers in test code
YakDriver Oct 23, 2024
b9b50ba
mediastore: De-constant numbers in test code
YakDriver Oct 23, 2024
2590cee
memorydb: De-constant numbers in test code
YakDriver Oct 23, 2024
cae587f
meta: De-constant numbers in test code
YakDriver Oct 23, 2024
dc7a1d0
mq: De-constant numbers in test code
YakDriver Oct 23, 2024
690cd58
mwaa: De-constant numbers in test code
YakDriver Oct 23, 2024
402ba78
neptune: De-constant numbers in test code
YakDriver Oct 23, 2024
29919be
networkfirewall: De-constant numbers in test code
YakDriver Oct 23, 2024
1511ecb
networkmanager: De-constant numbers in test code
YakDriver Oct 23, 2024
815ef5f
networkmonitor: De-constant numbers in test code
YakDriver Oct 23, 2024
1214a07
oam: De-constant numbers in test code
YakDriver Oct 23, 2024
23ff592
opensearch: De-constant numbers in test code
YakDriver Oct 23, 2024
560c496
opensearchserverless: De-constant numbers in test code
YakDriver Oct 23, 2024
21b4d43
opsworks: De-constant numbers in test code
YakDriver Oct 23, 2024
8e3a02d
organizations: De-constant numbers in test code
YakDriver Oct 23, 2024
8411991
osis: De-constant numbers in test code
YakDriver Oct 23, 2024
21a40ba
outposts: De-constant numbers in test code
YakDriver Oct 23, 2024
806b55b
paymentcryptography: De-constant numbers in test code
YakDriver Oct 23, 2024
6c7f6d1
pinpoint: De-constant numbers in test code
YakDriver Oct 23, 2024
08a4a28
pipes: De-constant numbers in test code
YakDriver Oct 23, 2024
cc8d176
qldb: De-constant numbers in test code
YakDriver Oct 23, 2024
f5756e2
quicksight: De-constant numbers in test code
YakDriver Oct 23, 2024
f2e6e83
ram: De-constant numbers in test code
YakDriver Oct 23, 2024
3db80de
rbin: De-constant numbers in test code
YakDriver Oct 23, 2024
0a32714
rds: De-constant numbers in test code
YakDriver Oct 23, 2024
102582c
redshift: De-constant numbers in test code
YakDriver Oct 23, 2024
0045754
redshiftdata: De-constant numbers in test code
YakDriver Oct 23, 2024
ff81f8d
redshiftserverless: De-constant numbers in test code
YakDriver Oct 23, 2024
801f7fa
rekognition: De-constant numbers in test code
YakDriver Oct 23, 2024
3a420fd
resourceexplorer2: De-constant numbers in test code
YakDriver Oct 23, 2024
ec486ea
resourcegroups: De-constant numbers in test code
YakDriver Oct 23, 2024
e9ea8b8
resourcegroupstaggingapi: De-constant numbers in test code
YakDriver Oct 23, 2024
3e758a5
rolesanywhere: De-constant numbers in test code
YakDriver Oct 23, 2024
6e11970
route53: De-constant numbers in test code
YakDriver Oct 23, 2024
1bcd896
route53domains: De-constant numbers in test code
YakDriver Oct 23, 2024
29d617b
route53profiles: De-constant numbers in test code
YakDriver Oct 23, 2024
3b7d64b
route53recoverycontrolconfig: De-constant numbers in test code
YakDriver Oct 23, 2024
905d2fc
route53recoveryreadiness: De-constant numbers in test code
YakDriver Oct 23, 2024
287b8ad
route53resolver: De-constant numbers in test code
YakDriver Oct 23, 2024
8d5c0a0
rum: De-constant numbers in test code
YakDriver Oct 23, 2024
67b56d3
s3: De-constant numbers in test code
YakDriver Oct 23, 2024
2646a68
s3control: De-constant numbers in test code
YakDriver Oct 23, 2024
cbd3faf
s3outposts: De-constant numbers in test code
YakDriver Oct 23, 2024
ecd9e43
sagemaker: De-constant numbers in test code
YakDriver Oct 23, 2024
bbf346d
scheduler: De-constant numbers in test code
YakDriver Oct 23, 2024
8f370cb
schemas: De-constant numbers in test code
YakDriver Oct 23, 2024
48834c4
secretsmanager: De-constant numbers in test code
YakDriver Oct 23, 2024
3b78c09
securityhub: De-constant numbers in test code
YakDriver Oct 23, 2024
e97ee8b
securitylake: De-constant numbers in test code
YakDriver Oct 23, 2024
e21e91f
serverlessrepo: De-constant numbers in test code
YakDriver Oct 23, 2024
294043e
servicecatalog: De-constant numbers in test code
YakDriver Oct 23, 2024
ec4040f
servicediscovery: De-constant numbers in test code
YakDriver Oct 23, 2024
3bcdc34
servicequotas: De-constant numbers in test code
YakDriver Oct 23, 2024
8456faf
ses: De-constant numbers in test code
YakDriver Oct 23, 2024
de2e08a
sesv2: De-constant numbers in test code
YakDriver Oct 23, 2024
719fbc6
sfn: De-constant numbers in test code
YakDriver Oct 23, 2024
efa86e0
shield: De-constant numbers in test code
YakDriver Oct 23, 2024
1e43480
signer: De-constant numbers in test code
YakDriver Oct 23, 2024
481a489
sns: De-constant numbers in test code
YakDriver Oct 23, 2024
b359a20
sqs: De-constant numbers in test code
YakDriver Oct 23, 2024
70e615d
ssm: De-constant numbers in test code
YakDriver Oct 23, 2024
0c9d72a
ssmcontacts: De-constant numbers in test code
YakDriver Oct 23, 2024
0b54acd
ssmincidents: De-constant numbers in test code
YakDriver Oct 23, 2024
b91e70e
ssoadmin: De-constant numbers in test code
YakDriver Oct 23, 2024
a106b42
storagegateway: De-constant numbers in test code
YakDriver Oct 23, 2024
0f02074
swf: De-constant numbers in test code
YakDriver Oct 23, 2024
54ecf50
synthetics: De-constant numbers in test code
YakDriver Oct 23, 2024
eab0032
timestreaminfluxdb: De-constant numbers in test code
YakDriver Oct 23, 2024
46010e7
timestreamwrite: De-constant numbers in test code
YakDriver Oct 23, 2024
ceaa28a
transcribe: De-constant numbers in test code
YakDriver Oct 23, 2024
964ccc8
transfer: De-constant numbers in test code
YakDriver Oct 23, 2024
192ffb6
verifiedpermissions: De-constant numbers in test code
YakDriver Oct 23, 2024
37a1faa
vpclattice: De-constant numbers in test code
YakDriver Oct 23, 2024
df4a9d0
waf: De-constant numbers in test code
YakDriver Oct 23, 2024
28c2a93
wafregional: De-constant numbers in test code
YakDriver Oct 23, 2024
621ee73
wafv2: De-constant numbers in test code
YakDriver Oct 23, 2024
ec58bfe
worklink: De-constant numbers in test code
YakDriver Oct 23, 2024
6dd9350
workspaces: De-constant numbers in test code
YakDriver Oct 23, 2024
4e35bfb
xray: De-constant numbers in test code
YakDriver Oct 23, 2024
1907b62
deploy: De-constant numbers in tests
YakDriver Oct 23, 2024
8fb4ade
.ci: Revert constants to literals
YakDriver Oct 24, 2024
c9f9fd4
acctest: Revert constants to literals
YakDriver Oct 24, 2024
d269dde
amplify: Revert constants to literals
YakDriver Oct 24, 2024
37ab9d9
apigateway: Revert constants to literals
YakDriver Oct 24, 2024
f51f72e
apigatewayv2: Revert constants to literals
YakDriver Oct 24, 2024
a9fbf71
appmesh: Revert constants to literals
YakDriver Oct 24, 2024
d2c8b8e
autoscaling: Revert constants to literals
YakDriver Oct 24, 2024
5b79f01
backup: Revert constants to literals
YakDriver Oct 24, 2024
9d2f0ad
batch: Revert constants to literals
YakDriver Oct 24, 2024
2aac958
cloudfront: Revert constants to literals
YakDriver Oct 24, 2024
99a3ba3
cloudtrail: Revert constants to literals
YakDriver Oct 24, 2024
26d67ca
customerprofiles: Revert constants to literals
YakDriver Oct 24, 2024
648c987
datasync: Revert constants to literals
YakDriver Oct 24, 2024
2db55fb
ec2: Revert constants to literals
YakDriver Oct 24, 2024
5ddb37a
ecs: Revert constants to literals
YakDriver Oct 24, 2024
ce5d221
elb: Revert constants to literals
YakDriver Oct 24, 2024
0bf8961
elbv2: Revert constants to literals
YakDriver Oct 24, 2024
5c9477f
fsx: Revert constants to literals
YakDriver Oct 24, 2024
62a1480
gamelift: Revert constants to literals
YakDriver Oct 24, 2024
be8320f
globalaccelerator: Revert constants to literals
YakDriver Oct 24, 2024
550e8ba
grafana: Revert constants to literals
YakDriver Oct 24, 2024
829b25f
imagebuilder: Revert constants to literals
YakDriver Oct 24, 2024
cdc456e
inspector: Revert constants to literals
YakDriver Oct 24, 2024
fa27b5c
iot: Revert constants to literals
YakDriver Oct 24, 2024
0bb9e10
keyspaces: Revert constants to literals
YakDriver Oct 24, 2024
2b7ae90
lambda: Revert constants to literals
YakDriver Oct 24, 2024
a6ca696
lightsail: Revert constants to literals
YakDriver Oct 24, 2024
ff40bd8
logs: Revert constants to literals
YakDriver Oct 24, 2024
5380fab
medialive: Revert constants to literals
YakDriver Oct 24, 2024
2ed5928
networkfirewall: Revert constants to literals
YakDriver Oct 24, 2024
55ec22a
networkmonitor: Revert constants to literals
YakDriver Oct 24, 2024
59f6bb5
rds: Revert constants to literals
YakDriver Oct 24, 2024
452492e
rolesanywhere: Revert constants to literals
YakDriver Oct 24, 2024
209ee8d
route53: Revert constants to literals
YakDriver Oct 24, 2024
4f42965
route53resolver: Revert constants to literals
YakDriver Oct 24, 2024
2848813
s3: Revert constants to literals
YakDriver Oct 24, 2024
13556a0
s3control: Revert constants to literals
YakDriver Oct 24, 2024
0ddfb8b
sagemaker: Revert constants to literals
YakDriver Oct 24, 2024
b6e9393
securityhub: Revert constants to literals
YakDriver Oct 24, 2024
7d4079d
sqs: Revert constants to literals
YakDriver Oct 24, 2024
205fca0
vpclattice: Revert constants to literals
YakDriver Oct 24, 2024
28188f0
wafv2: Revert constants to literals
YakDriver Oct 24, 2024
9dd69f7
semgrep: Add rules to autofix/revert numeric test constants
YakDriver Oct 24, 2024
8215189
make: Increase test timeout
YakDriver Oct 24, 2024
aae6b27
Merge main into branch
YakDriver Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
79 changes: 79 additions & 0 deletions .ci/.semgrep-test-constants-temp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# All these rules can be removed once inflight PRs are merged that contain:
# - acctest.Ct0
# - acctest.Ct1
# - acctest.Ct2
# - acctest.Ct3
# - acctest.Ct4
# - acctest.Ct10
rules:
- id: literal-Ct0-string-test-constant-temp
languages: [go]
message: Use the string literal "0" for the constant `acctest.Ct0` in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern: "acctest.Ct0"
fix: '"0"'
severity: ERROR
options:
constant_propagation: false

- id: literal-Ct1-string-test-constant-temp
languages: [go]
message: Use the string literal "1" for the constant `acctest.Ct1` in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern: "acctest.Ct1"
fix: '"1"'
severity: ERROR
options:
constant_propagation: false

- id: literal-Ct2-string-test-constant-temp
languages: [go]
message: Use the string literal "2" for the constant `acctest.Ct2` in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern: "acctest.Ct2"
fix: '"2"'
severity: ERROR
options:
constant_propagation: false

- id: literal-Ct3-string-test-constant-temp
languages: [go]
message: Use the string literal "3" for the constant `acctest.Ct3` in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern: "acctest.Ct3"
fix: '"3"'
severity: ERROR
options:
constant_propagation: false

- id: literal-Ct4-string-test-constant-temp
languages: [go]
message: Use the string literal "4" for the constant `acctest.Ct4` in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern: "acctest.Ct4"
fix: '"4"'
severity: ERROR
options:
constant_propagation: false

- id: literal-Ct10-string-test-constant-temp
languages: [go]
message: Use the string literal "10" for the constant `acctest.Ct10` in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern: "acctest.Ct10"
fix: '"10"'
severity: ERROR
options:
constant_propagation: false
80 changes: 4 additions & 76 deletions .ci/.semgrep-test-constants.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,14 @@
# Generated by internal/generate/acctestconsts/main.go; DO NOT EDIT.
rules:
- id: literal-0-string-test-constant
- id: literal-12Digit-string-test-constant
languages: [go]
message: Use the constant `acctest.Ct0` for the string literal "0" in test files
message: Use the constant `acctest.Ct12Digit` for the string literal "123456789012" in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern-either:
- pattern: '"0"'
- pattern: 'acctest.CtZero'
pattern: '"123456789012"'
severity: ERROR
fix: "acctest.Ct0"
options:
constant_propagation: false

- id: literal-1-string-test-constant
languages: [go]
message: Use the constant `acctest.Ct1` for the string literal "1" in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern-either:
- pattern: '"1"'
- pattern: 'acctest.CtOne'
severity: ERROR
fix: "acctest.Ct1"
options:
constant_propagation: false

- id: literal-10-string-test-constant
languages: [go]
message: Use the constant `acctest.Ct10` for the string literal "10" in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern-either:
- pattern: '"10"'
- pattern: 'acctest.CtTen'
severity: ERROR
fix: "acctest.Ct10"
options:
constant_propagation: false

- id: literal-2-string-test-constant
languages: [go]
message: Use the constant `acctest.Ct2` for the string literal "2" in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern-either:
- pattern: '"2"'
- pattern: 'acctest.CtTwo'
severity: ERROR
fix: "acctest.Ct2"
options:
constant_propagation: false

- id: literal-3-string-test-constant
languages: [go]
message: Use the constant `acctest.Ct3` for the string literal "3" in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern-either:
- pattern: '"3"'
- pattern: 'acctest.CtThree'
severity: ERROR
fix: "acctest.Ct3"
options:
constant_propagation: false

- id: literal-4-string-test-constant
languages: [go]
message: Use the constant `acctest.Ct4` for the string literal "4" in test files
paths:
include:
- "internal/service/**/*_test.go"
pattern-either:
- pattern: '"4"'
- pattern: 'acctest.CtFour'
severity: ERROR
fix: "acctest.Ct4"
fix: "acctest.Ct12Digit"
options:
constant_propagation: false

Expand Down
5 changes: 3 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ semgrep-constants: semgrep-validate ## Fix constants with Semgrep --autofix
@semgrep $(SEMGREP_ARGS) --autofix \
$(if $(filter-out $(origin PKG), undefined),--include $(PKG_NAME),) \
--config .ci/.semgrep-constants.yml \
--config .ci/.semgrep-test-constants.yml
--config .ci/.semgrep-test-constants.yml \
--config .ci/.semgrep-test-constants-temp.yml

semgrep-docker: semgrep-validate ## Run Semgrep (Legacy, use caution)
@echo "make: Legacy target, use caution..."
Expand Down Expand Up @@ -601,7 +602,7 @@ t: prereq-go fmt-check ## Run acceptance tests (similar to testacc)

test: prereq-go fmt-check ## Run unit tests
@echo "make: Running unit tests..."
$(GO_VER) test -count $(TEST_COUNT) $(TEST) $(TESTARGS) -timeout=5m
$(GO_VER) test -count $(TEST_COUNT) $(TEST) $(TESTARGS) -timeout=15m

test-compile: prereq-go ## Test package compilation
@if [ "$(TEST)" = "./..." ]; then \
Expand Down
7 changes: 1 addition & 6 deletions internal/acctest/consts.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
0,0
1,1
10,10
2,2
3,3
4,4
123456789012,12Digit
FALSE,FalseCaps
TRUE,TrueCaps
basic,Basic
Expand Down
7 changes: 1 addition & 6 deletions internal/acctest/consts_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions internal/acctest/generate/const_or_quote_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/generate/acctestconsts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {

d := g.NewGoFileDestination(constsFilename)

if err := d.WriteTemplate("constantlist", constsTmpl, td); err != nil {
if err := d.BufferTemplate("constantlist", constsTmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", constsFilename, err)
}

Expand All @@ -69,7 +69,7 @@ func main() {

d = g.NewGoFileDestination(constOrQuoteFilename)

if err := d.WriteTemplate("constsOrQuote", constOrQuoteTmpl, td); err != nil {
if err := d.BufferTemplate("constsOrQuote", constOrQuoteTmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", constOrQuoteFilename, err)
}

Expand All @@ -82,7 +82,7 @@ func main() {

d = g.NewUnformattedFileDestination(semgrepFilename)

if err := d.WriteTemplate("semgrep-constants", semgrepTmpl, td); err != nil {
if err := d.BufferTemplate("semgrep-constants", semgrepTmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", semgrepFilename, err)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/generate/allowsubcats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func main() {

d := g.NewUnformattedFileDestination(filename)

if err := d.WriteTemplate("allowsubcats", tmpl, td); err != nil {
if err := d.BufferTemplate("allowsubcats", tmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", filename, err)
}

Expand Down
6 changes: 3 additions & 3 deletions internal/generate/attrconsts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func main() {

d := g.NewGoFileDestination(constsFilename)

if err := d.WriteTemplate("constantlist", tmpl, td); err != nil {
if err := d.BufferTemplate("constantlist", tmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", constsFilename, err)
}

Expand All @@ -72,7 +72,7 @@ func main() {

d = g.NewGoFileDestination(constOrQuoteFilename)

if err := d.WriteTemplate("constOrQuote", constOrQuoteTmpl, td); err != nil {
if err := d.BufferTemplate("constOrQuote", constOrQuoteTmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", constOrQuoteFilename, err)
}

Expand All @@ -85,7 +85,7 @@ func main() {

d = g.NewUnformattedFileDestination(semgrepFilename)

if err := d.WriteTemplate("semgrep-constants", semgrepTmpl, td); err != nil {
if err := d.BufferTemplate("semgrep-constants", semgrepTmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", semgrepFilename, err)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/generate/awsclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {

d := g.NewGoFileDestination(filename)

if err := d.WriteTemplate("awsclient", tmpl, td); err != nil {
if err := d.BufferTemplate("awsclient", tmpl, td); err != nil {
g.Fatalf("generating file (%s): %s", filename, err)
}

Expand Down
Loading
Loading