Skip to content

Commit

Permalink
fully case sensitive checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bm1549 committed Nov 26, 2024
1 parent de097ed commit 0e42535
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/dd-trace/test/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2274,39 +2274,40 @@ describe('Config', () => {
//
// To fix this, you can either
// 1) Update dd-go (above) to include the proper config rules
// 2) Update TELEMETRY_IGNORE_LIST below to include the config that should not be sent to telemetry
// 2) Update TELEMETRY_IGNORE_LIST below to add configs that are not sent to telemetry

function getKeysInDotNotation(obj, parentKey = '') {

Check failure on line 2279 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Missing space before function parentheses
const keys = [];
const keys = []

for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
const fullKey = parentKey ? `${parentKey}.${key}` : key;
const fullKey = parentKey ? `${parentKey}.${key}` : key

if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {
keys.push(...getKeysInDotNotation(obj[key], fullKey));
keys.push(...getKeysInDotNotation(obj[key], fullKey))
} else {
keys.push(fullKey);
keys.push(fullKey)
}
}
}

return keys;
return keys
}

// anything that should never be in telemetry should be added here
// anything that is not sent via telemetry/handled separately should be added here
const TELEMETRY_IGNORE_LIST = [
'apikey',
'apiKey', // this is not sent to telemetry (needs confirmation)

Check failure on line 2299 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 8 spaces but found 10

Check failure on line 2299 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected trailing comma
]

const config = new Config()

const libraryTelemetryKeys = getKeysInDotNotation(config).sort().map((s) => s.toLowerCase());
const libraryTelemetryKeys = getKeysInDotNotation(config).sort();

Check failure on line 2304 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon

const telemetryRules = JSON.parse(CONFIG_NORM_RULES);

Check failure on line 2306 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon
const backendTelemetryKeys = Object.keys(telemetryRules);

Check failure on line 2307 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon

const missingTelemetryKeys = libraryTelemetryKeys.filter(element => !backendTelemetryKeys.includes(element) && !TELEMETRY_IGNORE_LIST.includes(element));
const missingTelemetryKeys = libraryTelemetryKeys
.filter(element => !backendTelemetryKeys.includes(element) && !TELEMETRY_IGNORE_LIST.includes(element));

Check failure on line 2310 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 8 spaces but found 10

Check failure on line 2310 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon

expect(missingTelemetryKeys).to.be.empty;

Check failure on line 2312 in packages/dd-trace/test/config.spec.js

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon
})
Expand Down

0 comments on commit 0e42535

Please sign in to comment.