Skip to content

Commit 714f2da

Browse files
committed
Schema: Rename "v1" to "legacy"
1 parent be42306 commit 714f2da

37 files changed

Lines changed: 21 additions & 21 deletions

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The map in the `arguments` field uses an argument's name as its key, and the val
184184
An annotated example of a configuration file:
185185

186186
```yaml
187-
# This is a "v1" configuration file.
187+
# This is a legacy "v1" configuration file.
188188
schema-version: v1
189189
# The list of rulesets to enable for this repository.
190190
rulesets:
@@ -275,14 +275,14 @@ max-file-size-kb: 256
275275
276276
## Configuration file schema
277277
278-
There is a JSON Schema definition for the `static-analysis.datadog.yml` in the `schema` subdirectory.
278+
There is a JSON Schema definition for the `static-analysis.datadog.yml` in the `schema/legacy` subdirectory.
279279

280280
You can use it to check the syntax of your configuration file:
281281

282-
1. Execute `npx --yes [email protected] validate -s schema/schema.json -r 'schema/*/*.json' -d path/to/your/static-analysis.datadog.yml`
282+
1. Execute `npx --yes [email protected] validate -s schema/legacy/schema.json -r 'schema/legacy/examples/*/*.json' -d path/to/your/static-analysis.datadog.yml`
283283

284-
There are some examples of valid and invalid configuration files in the [`schema/v1/examples/valid`](schema/v1/examples/valid)
285-
and [`schema/v1/examples/invalid`](schema/v1/examples/invalid) subdirectories, respectively. If you make changes to the JSON
284+
There are some examples of valid and invalid configuration files in the [`schema/legacy/examples/valid`](schema/legacy/examples/valid)
285+
and [`schema/legacy/examples/invalid`](schema/legacy/examples/invalid) subdirectories, respectively. If you make changes to the JSON
286286
Schema, you can test them against our examples:
287287

288288
1. Execute `make -C schema`

crates/cli/src/config_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::constants::DATADOG_CONFIG_FILE_WITHOUT_EXTENSION;
1+
use crate::constants::LEGACY_CONFIG_FILE_WITHOUT_EXTENSION;
22
use crate::datadog_utils::DatadogApiError::InvalidPermission;
33
use crate::datadog_utils::{
44
get_remote_configuration, print_permission_warning, should_use_datadog_backend,
@@ -19,7 +19,7 @@ pub fn read_config_file(base_path: &str) -> anyhow::Result<Option<String>> {
1919

2020
for ext in EXTENSIONS {
2121
let config_path =
22-
Path::new(base_path).join(format!("{DATADOG_CONFIG_FILE_WITHOUT_EXTENSION}.{ext}"));
22+
Path::new(base_path).join(format!("{LEGACY_CONFIG_FILE_WITHOUT_EXTENSION}.{ext}"));
2323
match std::fs::read_to_string(config_path) {
2424
Ok(contents) => {
2525
return if !contents.is_empty() {

crates/cli/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub static DATADOG_CONFIG_FILE_WITHOUT_EXTENSION: &str = "static-analysis.datadog";
1+
pub static LEGACY_CONFIG_FILE_WITHOUT_EXTENSION: &str = "static-analysis.datadog";
22

33
pub static DATADOG_HEADER_APP_KEY: &str = "dd-application-key";
44
pub static DATADOG_HEADER_API_KEY: &str = "dd-api-key";

crates/static-analysis-kernel/src/config/file_v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ mod tests {
580580
use std::path::{Path, PathBuf};
581581

582582
// Location of the configuration file examples that accompany the schema.
583-
const CFG_FILE_EXAMPLES_DIR: &str = "../../schema/v1/examples";
583+
const CFG_FILE_EXAMPLES_DIR: &str = "../../schema/legacy/examples";
584584

585585
/// Shorthand function to deserialize a string into a [`ConfigFile`].
586586
fn parse_config_file(config_contents: &str) -> anyhow::Result<ConfigFile> {

schema/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
all: test
22

3-
test: test-schema-valid test-schema-invalid test-v1-valid test-v1-invalid test-v2-valid test-v2-invalid
3+
test: test-schema-valid test-schema-invalid test-legacy-valid test-legacy-invalid test-v2-valid test-v2-invalid
44

55
examples-valid = $(1)/examples/valid/*.yml
66
examples-invalid = $(1)/examples/invalid/*.yml
77

88
test-schema-valid:
9-
npx --yes [email protected] test -s schema.json -r v1/schema.json -d "$(call examples-valid,v1)" --valid
9+
npx --yes [email protected] test -s schema.json -r legacy/schema.json -d "$(call examples-valid,legacy)" --valid
1010

1111
test-schema-invalid:
12-
npx --yes [email protected] test -s schema.json -r v1/schema.json -d "$(call examples-invalid,v1)" --invalid
12+
npx --yes [email protected] test -s schema.json -r legacy/schema.json -d "$(call examples-invalid,legacy)" --invalid
1313

14-
test-v1-valid:
15-
npx --yes [email protected] test -s v1/schema.json -d "$(call examples-valid,v1)" --valid
14+
test-legacy-valid:
15+
npx --yes [email protected] test -s legacy/schema.json -d "$(call examples-valid,legacy)" --valid
1616

17-
test-v1-invalid:
18-
npx --yes [email protected] test -s v1/schema.json -d "$(call examples-invalid,v1)" --invalid
17+
test-legacy-invalid:
18+
npx --yes [email protected] test -s legacy/schema.json -d "$(call examples-invalid,legacy)" --invalid
1919

2020
test-v2-valid:
2121
npx --yes [email protected] test -s v2/schema.json -d "$(call examples-valid,v2)" --valid
2222

2323
test-v2-invalid:
2424
npx --yes [email protected] test -s v2/schema.json -d "$(call examples-invalid,v2)" --invalid
2525

26-
.PHONY: test test-schema-valid test-schema-invalid test-v1-valid test-v1-invalid test-v2-valid test-v2-invalid
26+
.PHONY: test test-schema-valid test-schema-invalid test-legacy-valid test-legacy-invalid test-v2-valid test-v2-invalid

schema/v1/examples/invalid/disable-ignore-generated-files.yml renamed to schema/legacy/examples/invalid/disable-ignore-generated-files.yml

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

schema/v1/examples/invalid/maxfilesize-wrong-type.yml renamed to schema/legacy/examples/invalid/maxfilesize-wrong-type.yml

File renamed without changes.

0 commit comments

Comments
 (0)