Skip to content

Commit

Permalink
fix(classification): improve php datatype detections (#1340)
Browse files Browse the repository at this point in the history
* fix(php): add missing cases to object detector

* fix(classification): improve php datatype detections

* test: update kpi snapshots
  • Loading branch information
didroe authored Oct 18, 2023
1 parent c805626 commit 40b9c81
Show file tree
Hide file tree
Showing 9 changed files with 355 additions and 62 deletions.
44 changes: 39 additions & 5 deletions internal/classification/schema/.snapshots/TestJava
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
([]testhelper.ClassificationResult) (len=36) {
([]testhelper.ClassificationResult) (len=38) {
(testhelper.ClassificationResult) {
Name: (string) (len=25) "RepositorySystemHookEvent",
Decision: (classify.ClassificationDecision) {
Expand Down Expand Up @@ -109,6 +109,23 @@
}
}
},
(testhelper.ClassificationResult) {
Name: (string) (len=29) "QueryRobotDialogDetailRequest",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=7) "invalid",
Reason: (string) (len=19) "only_db_identifiers"
},
Properties: (map[string]testhelper.ClassificationResult) (len=1) {
(string) (len=10) "setOwnerId": (testhelper.ClassificationResult) {
Name: (string) (len=10) "setOwnerId",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=5) "valid",
Reason: (string) (len=25) "known_database_identifier"
},
Properties: (map[string]testhelper.ClassificationResult) <nil>
}
}
},
(testhelper.ClassificationResult) {
Name: (string) (len=15) "RSADigestSigner",
Decision: (classify.ClassificationDecision) {
Expand Down Expand Up @@ -286,6 +303,23 @@
}
}
},
(testhelper.ClassificationResult) {
Name: (string) (len=20) "UserOAuthAccessToken",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=5) "valid",
Reason: (string) (len=34) "valid_object_with_valid_properties"
},
Properties: (map[string]testhelper.ClassificationResult) (len=1) {
(string) (len=13) "getClientName": (testhelper.ClassificationResult) {
Name: (string) (len=13) "getClientName",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=5) "valid",
Reason: (string) (len=13) "known_pattern"
},
Properties: (map[string]testhelper.ClassificationResult) <nil>
}
}
},
(testhelper.ClassificationResult) {
Name: (string) (len=13) "UserQueryImpl",
Decision: (classify.ClassificationDecision) {
Expand Down Expand Up @@ -443,8 +477,8 @@
(string) (len=9) "getUserId": (testhelper.ClassificationResult) {
Name: (string) (len=9) "getUserId",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=7) "invalid",
Reason: (string) (len=16) "invalid_property"
State: (classify.ValidationState) (len=5) "valid",
Reason: (string) (len=25) "known_database_identifier"
},
Properties: (map[string]testhelper.ClassificationResult) <nil>
},
Expand Down Expand Up @@ -547,8 +581,8 @@
(string) (len=9) "setUserId": (testhelper.ClassificationResult) {
Name: (string) (len=9) "setUserId",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=7) "invalid",
Reason: (string) (len=16) "invalid_property"
State: (classify.ValidationState) (len=5) "valid",
Reason: (string) (len=25) "known_database_identifier"
},
Properties: (map[string]testhelper.ClassificationResult) <nil>
},
Expand Down
6 changes: 3 additions & 3 deletions internal/classification/schema/.snapshots/TestJavaKPI
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(testhelper.KPI) {
DetectionsCount: (int) 6230,
ValidDetectionsCount: (int) 126,
ValidObjectDetectionsCount: (int) 34,
ValidFieldDetectionsCount: (int) 92,
ValidDetectionsCount: (int) 131,
ValidObjectDetectionsCount: (int) 35,
ValidFieldDetectionsCount: (int) 96,
ExpectedValidDetectionsCount: (int) 137,
ExpectedValidObjectDetectionsCount: (int) 37,
ExpectedValidFieldDetectionsCount: (int) 100,
Expand Down
4 changes: 2 additions & 2 deletions internal/classification/schema/.snapshots/TestPHP
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@
(string) (len=7) "getName": (testhelper.ClassificationResult) {
Name: (string) (len=7) "getName",
Decision: (classify.ClassificationDecision) {
State: (classify.ValidationState) (len=7) "invalid",
Reason: (string) (len=16) "invalid_property"
State: (classify.ValidationState) (len=5) "valid",
Reason: (string) (len=22) "valid_extended_pattern"
},
Properties: (map[string]testhelper.ClassificationResult) <nil>
},
Expand Down
4 changes: 2 additions & 2 deletions internal/classification/schema/.snapshots/TestPHPKPI
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(testhelper.KPI) {
DetectionsCount: (int) 353,
ValidDetectionsCount: (int) 118,
ValidDetectionsCount: (int) 119,
ValidObjectDetectionsCount: (int) 27,
ValidFieldDetectionsCount: (int) 91,
ValidFieldDetectionsCount: (int) 92,
ExpectedValidDetectionsCount: (int) 143,
ExpectedValidObjectDetectionsCount: (int) 33,
ExpectedValidFieldDetectionsCount: (int) 110,
Expand Down
Loading

0 comments on commit 40b9c81

Please sign in to comment.