Skip to content

Commit

Permalink
Moved pre_validate and more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSouther committed Oct 17, 2023
1 parent d76b1de commit 505e5d1
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 128 deletions.
42 changes: 19 additions & 23 deletions .github/linters/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
<?xml version="1.0" ?>

<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.2//EN"
"https://checkstyle.org/dtds/configuration_1_2.dtd">

<module name="Checker">
<module name="TreeWalker">
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.2//EN" "https://checkstyle.org/dtds/configuration_1_2.dtd">

<module name="IllegalCatch"/>
<module name="EmptyStatement"/>
<module name="AvoidStarImport"/>
<module name="UnusedImports"/>
<module name="ParameterAssignment"/>
<module name="LocalVariableName"/>
<module name="NoLineWrap"/>
<module name="SingleSpaceSeparator"/>
<module name="MethodName"/>
<module name="MemberName"/>
<module name="LocalVariableName"/>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="DeclarationOrder"/>
<module name="Checker">
<module name="TreeWalker">
<module name="IllegalCatch" />
<module name="EmptyStatement" />
<module name="AvoidStarImport" />
<module name="UnusedImports" />
<module name="ParameterAssignment" />
<module name="LocalVariableName" />
<module name="NoLineWrap" />
<module name="SingleSpaceSeparator" />
<module name="MethodName" />
<module name="MemberName" />
<module name="LocalVariableName" />
<module name="LeftCurly" />
<module name="RightCurly" />
<module name="DeclarationOrder" />
</module>
</module>
</module>
1 change: 0 additions & 1 deletion .github/pre_validate/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .github/pre_validate/words.py

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/pre-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Miscellaneous pre-validation checks
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -29,4 +29,4 @@ jobs:
python-version: 3.8 #install the python needed
- name: Run Python script to vet code examples # Runs a single command using the runners shell
run: |
python .github/pre_validate/pre_validate.py --q
python3 .tools/pre_validate/pre_validate.py --q
6 changes: 3 additions & 3 deletions .github/workflows/validate-doc-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
python -m pip install yamale
python -m pip install yamllint
- name: Lint with yamllint
run: yamllint --format standard -c .tools/validation/.yamllint.yaml .doc_gen/metadata/.
run: yamllint --format standard -c .tools/validation/.yamllint.yaml .doc_gen/metadata
- name: Lint with yamllint
run: yamllint --format standard -c .tools/validation/.yamllint.yaml .doc_gen/metadata/curated/.
run: yamllint --format standard -c .tools/validation/.yamllint.yaml .doc_gen/metadata/curated
- name: Validate metadata with yamale
run: python .tools/validation/validate_doc_metadata.py .doc_gen
run: python .tools/validation/validate_doc_metadata.py --doc-gen .doc_gen
1 change: 0 additions & 1 deletion .tools/readmes/.gitignore → .tools/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
__pycache__
.venv
venv
1 change: 0 additions & 1 deletion .tools/images/render-blurbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
with open(sdk_metadata, "r") as file:
metadata = yaml.safe_load(file)
for language in metadata.keys():
metadata[language]
shortname = metadata[language]["property"]
template = env.get_template("template.txt")
print(template.render(language=language, shortname=shortname))
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -59,40 +59,41 @@

# Folders to skip.
IGNORE_FOLDERS = {
".doc_gen",
".pytest_cache",
".tools",
".venv",
"__pycache__",
"bin",
"cdk.out",
"node_modules",
"dist",
"node_modules",
"obj",
"target",
"venv",
".venv",
"bin",
"obj",
".doc_gen",
}

# Files to skip.
IGNORE_FILES = {
"AssemblyInfo.cs",
".moviedata.json",
".travis.yml",
"AssemblyInfo.cs",
"moviedata.json",
".moviedata.json",
"movies.json",
"package-lock.json",
}

# Sample files.
EXPECTED_SAMPLE_FILES = {
"README.md",
"movies.json",
"speech_sample.mp3",
"chat_sfn_state_machine.json",
"market_2.jpg",
"spheres_2.jpg",
"movies.json",
"sample_cert.pem",
"sample_private_key.pem",
"sample_saml_metadata.xml",
"speech_sample.mp3",
"spheres_2.jpg",
}

# Media file types.
Expand All @@ -109,13 +110,35 @@
"AKIAEXAMPLEACCESSKEY",
"AKIAIOSFODNN7EXAMPLE",
"APKAEIBAERJR2EXAMPLE",
"AWSEC2/latest/APIReference/OperationList",
"AppStreamUsageReportsCFNGlueAthenaAccess",
"examples/blob/main/applications/feedback",
"CancelExportTaskExample/CancelExportTask",
"CertificateTransparencyLoggingPreference",
"ChangeMessageVisibilityBatchRequestEntry",
"CreateCollectionExample/CreateCollection",
"CreateExportTaskExample/CreateExportTask",
"DeleteCollectionExample/DeleteCollection",
"DescribeDbClusterParameterGroupsResponse",
"DescribeOrderableDBInstanceOptionsOutput",
"DynamodbRubyExampleCreateUsersTableStack",
"GetIdentityVerificationAttributesRequest",
"KMSWithContextEncryptionMaterialsExample",
"KinesisStreamSourceConfiguration=kinesis",
"ListOrganizationalUnitsForParentResponse",
"ListTagsExample/ListTagsExample/ListTags",
"ListTagsForVaultExample/ListTagsForVault",
"SynthesizeSpeechExample/SynthesizeSpeech",
"TargetTrackingScalingPolicyConfiguration",
"TerminateInstanceInAutoScalingGroupAsync",
"VectorEnrichmentJobDataSourceConfigInput",
"amazondynamodb/latest/developerguide/DAX",
"apigateway/latest/developerguide/welcome",
"aws/acm/model/DescribeCertificateRequest",
"aws/cloudtrail/model/LookupEventsRequest",
"aws/codebuild/model/BatchGetBuildsResult",
"aws/codecommit/model/DeleteBranchRequest",
"aws/codecommit/model/ListBranchesRequest",
"aws/dynamodb/model/BatchWriteItemRequest",
"aws/dynamodb/model/ProvisionedThroughput",
"aws/ec2/model/CreateSecurityGroupRequest",
"aws/ec2/model/DeleteSecurityGroupRequest",
Expand All @@ -129,87 +152,58 @@
"aws/iam/model/GetServerCertificateResult",
"aws/kinesis/model/GetShardIteratorResult",
"aws/kinesis/model/PutRecordsRequestEntry",
"aws/kms/model/ScheduleKeyDeletionRequest",
"aws/monitoring/model/DeleteAlarmsRequest",
"aws/neptune/model/CreateDBClusterRequest",
"aws/neptune/model/DeleteDBClusterRequest",
"aws/neptune/model/ModifyDBClusterRequest",
"aws/kms/model/ScheduleKeyDeletionRequest",
"KMSWithContextEncryptionMaterialsExample",
"CertificateTransparencyLoggingPreference",
"ChangeMessageVisibilityBatchRequestEntry",
"aws/rds/model/DescribeDBInstancesRequest",
"aws/rds/model/DescribeDBSnapshotsRequest",
"cloudwatch/commands/PutMetricDataCommand",
"com/amazondynamodb/latest/developerguide",
"com/apigateway/latest/developerguide/set",
"com/autoscaling/ec2/APIReference/Welcome",
"com/awssupport/latest/APIReference/index",
"com/firehose/latest/APIReference/Welcome",
"com/greengrass/latest/developerguide/lra",
"com/greengrass/latest/developerguide/sns",
"com/pinpoint/latest/apireference/welcome",
"com/redshift/latest/APIReference/Welcome",
"com/rekognition/latest/dg/considerations",
"com/samples/JobStatusNotificationsSample",
"com/transcribe/latest/APIReference/index",
"com/v1/documentation/api/latest/guide/s3",
"com/workdocs/latest/APIReference/Welcome",
"devicefarm/latest/developerguide/welcome",
"examples/blob/main/applications/feedback",
"generate_presigned_url_and_upload_object",
"KinesisStreamSourceConfiguration=kinesis",
"ListOrganizationalUnitsForParentResponse",
"iam/commands/GetAccessKeyLastUsedCommand",
"iam/commands/GetServerCertificateCommand",
"nFindProductsWithNegativePriceWithConfig",
"preview/examples/cognitoidentityprovider",
"preview/examples/cognitoidentityprovider",
"preview/examples/lambda/src/bin/scenario",
"role/AmazonSageMakerGeospatialFullAccess",
"s3_client_side_encryption_sym_master_key",
"serial/CORE_THING_NAME/write/dev/serial1",
"TargetTrackingScalingPolicyConfiguration",
"targetTrackingScalingPolicyConfiguration",
"upload_files_using_managed_file_uploader",
"videoMetaData=celebrityRecognitionResult",
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"com/v1/documentation/api/latest/guide/s3",
"iam/commands/GetServerCertificateCommand",
"iam/commands/GetAccessKeyLastUsedCommand",
"iam/commands/GetAccessKeyLastUsedCommand",
"iam/commands/GetServerCertificateCommand",
"cloudwatch/commands/PutMetricDataCommand",
"ses/commands/VerifyDomainIdentityCommand",
"ses/commands/DeleteReceiptRuleSetCommand",
"ses/commands/DeleteReceiptRuleSetCommand",
"service/FeedbackSentimentAnalyzer/README",
"ses/commands/CreateReceiptRuleSetCommand",
"ses/commands/DeleteReceiptRuleSetCommand",
"ses/commands/VerifyDomainIdentityCommand",
"ses/commands/VerifyDomainIdentityCommand",
"com/amazondynamodb/latest/developerguide",
"DynamodbRubyExampleCreateUsersTableStack",
"com/rekognition/latest/dg/considerations",
"ListTagsForVaultExample/ListTagsForVault",
"TerminateInstanceInAutoScalingGroupAsync",
"GetIdentityVerificationAttributesRequest",
"com/transcribe/latest/APIReference/index",
"CancelExportTaskExample/CancelExportTask",
"CreateExportTaskExample/CreateExportTask",
"ListTagsExample/ListTagsExample/ListTags",
"SynthesizeSpeechExample/SynthesizeSpeech",
"com/autoscaling/ec2/APIReference/Welcome",
"CreateCollectionExample/CreateCollection",
"DeleteCollectionExample/DeleteCollection",
"com/awssupport/latest/APIReference/index",
"DescribeDbClusterParameterGroupsResponse",
"DeleteCollectionExample/DeleteCollection",
"aws/rds/model/DescribeDBInstancesRequest",
"com/apigateway/latest/developerguide/set",
"com/pinpoint/latest/apireference/welcome",
"src/main/java/com/example/s3/S3BucketOps",
"src/main/java/com/example/s3/ListObjects",
"amazondynamodb/latest/developerguide/DAX",
"apigateway/latest/developerguide/welcome",
"devicefarm/latest/developerguide/welcome",
"AWSEC2/latest/APIReference/OperationList",
"src/main/java/com/example/dynamodb/Query",
"com/firehose/latest/APIReference/Welcome",
"src/main/java/com/example/iam/CreateRole",
"src/main/java/com/example/iam/CreateUser",
"src/main/java/com/example/iam/DeleteUser",
"src/main/java/com/example/iam/UpdateUser",
"src/main/java/com/example/kms/ListGrants",
"com/redshift/latest/APIReference/Welcome",
"src/main/java/com/example/s3/ListObjects",
"src/main/java/com/example/s3/S3BucketOps",
"src/main/java/com/example/sns/ListOptOut",
"src/main/java/com/example/sns/ListTopics",
"src/main/java/com/example/sqs/SQSExample",
"DescribeOrderableDBInstanceOptionsOutput",
"preview/examples/cognitoidentityprovider",
"preview/examples/lambda/src/bin/scenario",
"aws/dynamodb/model/BatchWriteItemRequest",
"aws/rds/model/DescribeDBInstancesRequest",
"aws/rds/model/DescribeDBSnapshotsRequest",
"role/AmazonSageMakerGeospatialFullAccess",
"VectorEnrichmentJobDataSourceConfigInput",
"com/workdocs/latest/APIReference/Welcome",
"service/FeedbackSentimentAnalyzer/README",
"targetTrackingScalingPolicyConfiguration",
"upload_files_using_managed_file_uploader",
"videoMetaData=celebrityRecognitionResult",
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
}


Expand Down
8 changes: 8 additions & 0 deletions .tools/pre_validate/words.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from urllib.request import urlopen
import json

GOOD_WORDS = {"throat", "dummy", "dp", "jerry"}
DATA = urlopen(
"https://raw.githubusercontent.com/zacanger/profane-words/5ad6c62fa5228293bc610602eae475d50036dac2/words.json"
)
WORDS = set(json.load(DATA)).difference(GOOD_WORDS)
File renamed without changes.
Loading

0 comments on commit 505e5d1

Please sign in to comment.