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

[WIP]Add yaml linting and auto-sorting #2502

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .github/actions/lint_code/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ runs:
run: |
npm install
npm run lint
- name: 'Run YAML lint'
shell: bash
run: source venv/bin/activate && yamllint manifests

4 changes: 4 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends: default

rules:
line-length: disable # disabled untill we finalize the schema
12 changes: 12 additions & 0 deletions docs/edit/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ black .

Et voila, all your files are correctly formated :tada:

## Manifest files
### Using Docker
As to the manifest files, it can be tedious to order the files/folders by hand. So here are some easy steps to format them:
### Using a virtualenv

Same steps as before for the setup, now, just run :

```bash
./format-yaml.sh
```

All your manifests are correctly formated
3 changes: 3 additions & 0 deletions format-yaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
python manifests/parser/live-checker.py manifests
yamllint manifests/
7 changes: 4 additions & 3 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
set -eu

readonly BLACK_VERSION=19.10b0
readonly IMAGE=black:${BLACK_VERSION}
readonly IMAGE=formatter-black-yaml:${BLACK_VERSION}
#name of the image changed to take into account images built earlier

if [[ -z "$(docker images -q "${IMAGE}")" ]]; then
echo "Building ${IMAGE}"
docker build -t "${IMAGE}" - <<EOF
FROM python:3.10
RUN pip install click==7.1.2 black==${BLACK_VERSION}
RUN pip install click==7.1.2 black==${BLACK_VERSION} pyyaml==6.0.0 yamllint==1.26.3
EOF
fi

Expand All @@ -28,4 +29,4 @@ else
fi

# shellcheck disable=SC2086
exec docker run -it --rm $user_arg --workdir "$(pwd)" -v "$(pwd):$(pwd)" "${IMAGE}" black "$@"
exec docker run -it --rm $user_arg --workdir "$(pwd)" -v "$(pwd):$(pwd)" "${IMAGE}" bash -c "echo 'test' && black $@ && ./format-yaml.sh"
10 changes: 6 additions & 4 deletions manifests/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ tests/:
test_ssrf.py: irrelevant (ASM is not implemented in C++)
test_trust_boundary_violation.py: irrelevant (ASM is not implemented in C++)
test_unvalidated_redirect.py: irrelevant (ASM is not implemented in C++)
test_unvalidated_redirect_forward.py: irrelevant (ASM is not implemented in C++)
test_unvalidated_redirect_forward.py: irrelevant (ASM is not implemented in
C++)
test_weak_cipher.py: irrelevant (ASM is not implemented in C++)
test_weak_hash.py: irrelevant (ASM is not implemented in C++)
test_weak_randomness.py: irrelevant (ASM is not implemented in C++)
Expand Down Expand Up @@ -103,9 +104,9 @@ tests/:
Test_SNS_Propagation: missing_feature (Endpoint not implemented)
test_sqs.py:
Test_SQS_PROPAGATION_VIA_AWS_XRAY_HEADERS:
"*": missing_feature (Endpoint not implemented)
'*': missing_feature (Endpoint not implemented)
Test_SQS_PROPAGATION_VIA_MESSAGE_ATTRIBUTES:
"*": missing_feature (Endpoint not implemented)
'*': missing_feature (Endpoint not implemented)
test_db_integrations_sql.py:
Test_MsSql: missing_feature
Test_MySql: missing_feature
Expand All @@ -124,7 +125,8 @@ tests/:
Test_DsmSNS: missing_feature
Test_DsmSQS: missing_feature
parametric/:
test_dynamic_configuration.py: missing_feature (float DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS not supported)
test_dynamic_configuration.py: missing_feature (float DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS
not supported)
test_otel_api_interoperability.py: irrelevant (library does not implement OpenTelemetry)
test_otel_sdk_interoperability.py: irrelevant (library does not implement OpenTelemetry)
test_otel_span_methods.py: irrelevant (library does not implement OpenTelemetry)
Expand Down
26 changes: 13 additions & 13 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tests/:
test_api_security_rc.py:
Test_API_Security_RC_ASM_DD_processors: v2.50.0
Test_API_Security_RC_ASM_DD_scanners: v2.50.0
Test_API_Security_RC_ASM_processor_overrides_and_custom_scanner: missing_feature # waf does not support it yet
Test_API_Security_RC_ASM_processor_overrides_and_custom_scanner: missing_feature
test_apisec_sampling.py:
Test_API_Security_sampling: v2.46.0
test_schemas.py:
Expand Down Expand Up @@ -54,7 +54,7 @@ tests/:
TestReflectionInjection: v2.48.0
test_sql_injection.py:
TestSqlInjection:
'*': v2.23.0
'*': v2.23.0
test_ssrf.py:
TestSSRF: v2.36.0
test_trust_boundary_violation.py:
Expand Down Expand Up @@ -89,7 +89,7 @@ tests/:
TestHeaderName: missing_feature
test_header_value.py:
TestHeaderValue:
'*': v2.39.0
'*': v2.39.0
test_kafka_key.py:
TestKafkaKey: missing_feature
test_kafka_value.py:
Expand Down Expand Up @@ -120,7 +120,7 @@ tests/:
Test_Ssrf_BodyXml: v2.51.0
Test_Ssrf_UrlQuery: v2.51.0
test_stack_traces.py:
Test_StackTrace: v2.51.0
Test_StackTrace: v2.51.0
waf/:
test_addresses.py:
Test_BodyJson: v2.8.0
Expand Down Expand Up @@ -184,7 +184,8 @@ tests/:
Test_Blocking_request_uri: v2.32.0
Test_Blocking_response_headers: v2.32.0
Test_Blocking_response_status: v2.32.0
Test_Suspicious_Request_Blocking: missing_feature (v2.29.0, but test is not implemented)
Test_Suspicious_Request_Blocking: missing_feature (v2.29.0, but test is not
implemented)
test_client_ip.py:
Test_StandardTagsClientIp: v2.20.0
test_conf.py:
Expand Down Expand Up @@ -246,15 +247,15 @@ tests/:
Test_SNS_Propagation: missing_feature (Endpoint not implemented)
test_sqs.py:
Test_SQS_PROPAGATION_VIA_AWS_XRAY_HEADERS:
"*": v0.1 # version unknown
'*': v0.1
Test_SQS_PROPAGATION_VIA_MESSAGE_ATTRIBUTES:
"*": v2.48.0
'*': v2.48.0
test_db_integrations_sql.py:
Test_MsSql: missing_feature
Test_MySql: missing_feature
Test_Postgres: missing_feature
test_dbm.py:
Test_Dbm: v0.1 # missing version
Test_Dbm: v0.1
test_dsm.py:
Test_DsmContext_Extraction_Base64: missing_feature
Test_DsmContext_Injection_Base64: missing_feature
Expand Down Expand Up @@ -295,9 +296,6 @@ tests/:
Test_Trace_Sampling_Tags_Feb2024_Revision: missing_feature
Test_Trace_Sampling_With_W3C: missing_feature
test_tracer.py:
# The dotnet parametric app generates trace chunks in a way that differs from the other languages
# This causes the sci tests to fail. Before enabling these tests we must ensure that the first span in the
# trace chunk is always the local root span.
Test_TracerSCITagging: missing_feature
test_tracer_flare.py:
TestTracerFlareV1: missing_feature
Expand All @@ -307,9 +305,11 @@ tests/:
Test_RemoteConfigurationUpdateSequenceASMDD: v2.15.0
Test_RemoteConfigurationUpdateSequenceASMDDNoCache: irrelevant (cache is implemented)
Test_RemoteConfigurationUpdateSequenceFeatures: v2.15.0
Test_RemoteConfigurationUpdateSequenceFeaturesNoCache: irrelevant (cache is implemented)
Test_RemoteConfigurationUpdateSequenceFeaturesNoCache: irrelevant (cache is
implemented)
Test_RemoteConfigurationUpdateSequenceLiveDebugging: v2.15.0
Test_RemoteConfigurationUpdateSequenceLiveDebuggingNoCache: irrelevant (cache is implemented)
Test_RemoteConfigurationUpdateSequenceLiveDebuggingNoCache: irrelevant (cache
is implemented)
test_data_integrity.py:
Test_LibraryHeaders: v2.46.0
test_distributed.py:
Expand Down
60 changes: 31 additions & 29 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ tests/:
test_otel.py:
Test_Otel_Span:
'*': missing_feature (missing /e2e_otel_span endpoint on weblog)
net-http: v0.1 # real version not known
net-http: v0.1
test_single_span.py:
Test_SingleSpan:
'*': missing_feature (missing /e2e_otel_span endpoint on weblog)
chi: v0.1 # real version not known
chi: v0.1
appsec/:
api_security/:
test_api_security_rc.py:
Test_API_Security_RC_ASM_DD_processors: missing_feature
Test_API_Security_RC_ASM_DD_scanners: missing_feature
Test_API_Security_RC_ASM_processor_overrides_and_custom_scanner: missing_feature # waf does not support it yet
Test_API_Security_RC_ASM_processor_overrides_and_custom_scanner: missing_feature
test_apisec_sampling.py:
Test_API_Security_sampling:
'*': v1.60.0-dev
Expand Down Expand Up @@ -287,7 +287,7 @@ tests/:
Test_Standardization: missing_feature
Test_StandardizationBlockMode: missing_feature
test_reports.py:
Test_ExtraTagsFromRule:
Test_ExtraTagsFromRule:
'*': v1.62.0
Test_HttpClientIP:
'*': v1.34.0
Expand Down Expand Up @@ -347,26 +347,26 @@ tests/:
crossed_integrations/:
test_kafka.py:
Test_Kafka:
"*": irrelevant
net-http: v0.1 # real version not known
'*': irrelevant
net-http: v0.1
test_kinesis.py:
Test_Kinesis_PROPAGATION_VIA_MESSAGE_ATTRIBUTES:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
test_rabbitmq.py:
Test_RabbitMQ_Trace_Context_Propagation:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
test_sns_to_sqs.py:
Test_SNS_Propagation:
"*": irrelevant
'*': irrelevant
net-http: missing_feature
test_sqs.py:
Test_SQS_PROPAGATION_VIA_AWS_XRAY_HEADERS:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
Test_SQS_PROPAGATION_VIA_MESSAGE_ATTRIBUTES:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
test_db_integrations_sql.py:
Test_MsSql: missing_feature
Expand All @@ -375,33 +375,33 @@ tests/:
test_dbm.py:
Test_Dbm: missing_feature
test_dsm.py:
Test_DsmContext_Extraction_Base64:
"*": irrelevant
net-http: v0.1 # real version unknown
Test_DsmContext_Injection_Base64:
"*": irrelevant
net-http: v0.1 # real version unknown
Test_DsmContext_Extraction_Base64:
'*': irrelevant
net-http: v0.1
Test_DsmContext_Injection_Base64:
'*': irrelevant
net-http: v0.1
Test_DsmHttp: missing_feature
Test_DsmKafka:
"*": irrelevant
net-http: v0.1 # real version unknown
'*': irrelevant
net-http: v0.1
Test_DsmKinesis:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
Test_DsmRabbitmq:
"*": irrelevant
Test_DsmRabbitmq:
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
Test_DsmRabbitmq_FanoutExchange:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
Test_DsmRabbitmq_TopicExchange:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
Test_DsmSNS:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
Test_DsmSQS:
"*": irrelevant
'*': irrelevant
net-http: missing_feature (Endpoint not implemented)
parametric/:
test_dynamic_configuration.py:
Expand All @@ -420,7 +420,7 @@ tests/:
Test_TelemetryInstallSignature: missing_feature
Test_TelemetrySCAEnvVar: v1.63.0-rc.1
test_trace_sampling.py:
Test_Trace_Sampling_Basic: v1.37.0 # TODO what is the earliest version?
Test_Trace_Sampling_Basic: v1.37.0
Test_Trace_Sampling_Globs: v1.60.0
Test_Trace_Sampling_Globs_Feb2024_Revision: v1.64.0-dev
Test_Trace_Sampling_Resource: v1.60.0
Expand All @@ -436,9 +436,11 @@ tests/:
Test_RemoteConfigurationUpdateSequenceASMDD: missing_feature
Test_RemoteConfigurationUpdateSequenceASMDDNoCache: irrelevant (cache is implemented)
Test_RemoteConfigurationUpdateSequenceFeatures: v1.44.1
Test_RemoteConfigurationUpdateSequenceFeaturesNoCache: irrelevant (cache is implemented)
Test_RemoteConfigurationUpdateSequenceFeaturesNoCache: irrelevant (cache is
implemented)
Test_RemoteConfigurationUpdateSequenceLiveDebugging: missing_feature
Test_RemoteConfigurationUpdateSequenceLiveDebuggingNoCache: irrelevant (cache is implemented)
Test_RemoteConfigurationUpdateSequenceLiveDebuggingNoCache: irrelevant (cache
is implemented)
test_data_integrity.py:
Test_LibraryHeaders: v1.60.0.dev0
test_distributed.py:
Expand Down
Loading