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

feat(api): anonymise newfields not specified by default #4351

Merged
merged 17 commits into from
Nov 13, 2024

Conversation

@@ -0,0 +1,806 @@
const applicationSchemaFields = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File anonymise-model-fields.js has 789 lines of code (exceeds 700 allowed). Consider refactoring.

deepObj[lastKey] = value;
}

function anonymizeNewFields(item, knownFields, schemaFields) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function anonymizeNewFields has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.

@@ -0,0 +1,837 @@
const applicationSchemaFields = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File anonymise-model-fields.js has 817 lines of code (exceeds 700 allowed). Consider refactoring.

deepObj[lastKey] = value;
}

function getAllPaths(obj, parentPath = "") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getAllPaths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.

@@ -0,0 +1,854 @@
const applicationSchemaFields = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File anonymise-model-fields.js has 832 lines of code (exceeds 700 allowed). Consider refactoring.

return paths;
}

function anonymizeNewFields(item, knownFields, schemaFields) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function anonymizeNewFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.

@@ -0,0 +1,857 @@
const applicationSchemaFields = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File anonymise-model-fields.js has 835 lines of code (exceeds 700 allowed). Consider refactoring.

@michaelgarcia75 michaelgarcia75 force-pushed the feat-3290-anonymise-newfield-bydefault branch 2 times, most recently from e557569 to 6235726 Compare September 24, 2024 10:28
@@ -1,6 +1,330 @@
const { generateAddress, generateRandomName, generateRandomEmail, generateBirthdate, getYoungLocation, generateNewPhoneNumber, starify } = require("../utils/anonymise");
const { anonymizeNonDeclaredFields } = require("../utils/anonymise-model-fields");

function anonymize(itemToAnonymize) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function anonymize has 387 lines of code (exceeds 200 allowed). Consider refactoring.

return paths;
}

function anonymizeNonDeclaredFields(item, whitelist) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function anonymizeNonDeclaredFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.

return paths;
}

function anonymizeNonDeclaredFields(item, whitelist) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function anonymizeNonDeclaredFields has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.

}

// Anonymise tous les champs d'un objet qui ne sont pas dans la whitelist
function anonymizeNonDeclaredFields(item, whitelist) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function anonymizeNonDeclaredFields has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.

Copy link

codeclimate bot commented Oct 4, 2024

Code Climate has analyzed commit ec8a144 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 45.5% (-0.1% change).

View more on Code Climate.

@@ -67,8 +399,8 @@ function anonymize(item) {
item.forgotPasswordResetToken = "";
item.invitationToken = "";
item.phase3Token = "";
item.parent1Inscription2023Token = "";
item.parent2Inscription2023Token = "";
item.parent1Inscription2023Token = crypto.randomBytes(20).toString("hex");
Copy link
Collaborator

@pitiscarf pitiscarf Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi ne pas avoir laissé une chaine de caractère vide ?
Quel interêt d'avoir une valeur aléatoire ?
les fonctions crypto peuvent ralentir l'anonymization (utilisées 2 x / jeune)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça empêche de faire certains test sur la plate-forme pour la team jeune

@@ -45,7 +45,7 @@
"aws-sdk": "^2.1248.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.3",
"bson": "^6.7.0",
"bson": "^4.7.2",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi avoir downgradé la version de bson ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'avais des erreurs avec la version upgrade je peux retest vu les modifs qu'il y a eu sur la PR depuis le temps

@michaelgarcia75 michaelgarcia75 merged commit c580227 into main Nov 13, 2024
12 of 14 checks passed
@michaelgarcia75 michaelgarcia75 deleted the feat-3290-anonymise-newfield-bydefault branch November 13, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants