stellio-hub / stellio-context-broker

Stellio is an NGSI-LD compatible context broker
https://stellio.readthedocs.io
Apache License 2.0
25 stars 11 forks source link

feat: precommit with detekt #1181

Closed thomasBousselin closed 1 week ago

github-actions[bot] commented 2 weeks ago

Test Results

   57 files  +  7     57 suites  +7   1m 22s :stopwatch: +24s   974 tests +144    974 :white_check_mark: +144  0 :zzz: ±0  0 :x: ±0  1 013 runs  +144  1 013 :white_check_mark: +144  0 :zzz: ±0  0 :x: ±0 

Results for commit 483f9ca2. ± Comparison against base commit 27154b5e.

This pull request removes 187 and adds 177 tests. Note that renamed tests count towards both. ``` "@id": "https://uri… "@type": "@json", … "@value": "/A/B" "@value": "/C/D" "@value": 20 "… { …, withTemporalValues=true, withAudit=false, expectation={ "@type": "https://uri.etsi.org/ngsi-ld/DateTime", … ``` ``` com.egm.stellio.search.util.PatchAttributeTests ‑ [1] source={ "attribute": { "type": "Property", "value": 12.0, "observedAt": "2024-04-14T12:34:56Z" } }, target={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM" } }, expected={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM", "observedAt": "2024-04-14T12:34:56Z" } } com.egm.stellio.search.util.PatchAttributeTests ‑ [1] source={ "attribute": { "type": "Property", "value": 12.0, "observedAt": "2024-04-14T12:34:56Z", "subAttribute": { "type": "Property", "value": "subAttribute" } } }, target={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM", "subAttribute": { "type": "Property", "value": "newSubAttributeValue" } } }, expected={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM", "observedAt": "2024-04-14T12:34:56Z", "subAttribute": { "type": "Property", "value": "newSubAttributeValue" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [2] source={ "attribute": { "type": "Property", "value": { "en": "car", "fr": "voiture" } } }, target={ "attribute": { "type": "Property", "value": { "fr": "vélo", "es": "bicicleta" } } }, expected={ "attribute": { "type": "Property", "value": { "en": "car", "fr": "vélo", "es": "bicicleta" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [2] source={ "incoming": { "type": "JsonProperty", "json": { "id": 1, "b": null, "c": 12.4 }, "observedAt": "2022-12-24T14:01:22.066Z", "subAttribute": { "type": "Property", "value": "subAttribute" } } }, target={ "incoming": { "type": "JsonProperty", "json": { "id": 2, "b": "something" }, "observedAt": "2023-12-24T14:01:22.066Z" } }, expected={ "incoming": { "type": "JsonProperty", "json": { "id": 2, "b": "something" }, "observedAt": "2023-12-24T14:01:22.066Z", "subAttribute": { "type": "Property", "value": "subAttribute" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [3] source={ "attribute": { "type": "Property", "value": [ "car", "voiture" ] } }, target={ "attribute": { "type": "Property", "value": [ "vélo", "bicicleta" ] } }, expected={ "attribute": { "type": "Property", "value": [ "vélo", "bicicleta" ] } } com.egm.stellio.search.util.PatchAttributeTests ‑ [3] source={ "attribute": { "type": "VocabProperty", "vocab": "stellio" } }, target={ "attribute": { "type": "VocabProperty", "vocab": "egm" } }, expected={ "attribute": { "type": "VocabProperty", "vocab": "egm" } } com.egm.stellio.search.util.PatchAttributeTests ‑ [4] source={ "attribute": { "type": "Relationship", "object": "urn:ngsi-ld:Entity:01" } }, target={ "attribute": { "type": "Relationship", "object": "urn:ngsi-ld:Entity:02" } }, expected={ "attribute": { "type": "Relationship", "object": "urn:ngsi-ld:Entity:02" } } com.egm.stellio.search.util.PatchAttributeTests ‑ [5] source={ "attribute": { "type": "LanguageProperty", "languageMap": { "en": "train", "fr": "train" } } }, target={ "attribute": { "type": "LanguageProperty", "languageMap": { "fr": "TGV", "es": "tren" } } }, expected={ "attribute": { "type": "LanguageProperty", "languageMap": { "en": "train", "fr": "TGV", "es": "tren" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [6] source={ "incoming": { "type": "JsonProperty", "json": { "a": 1, "b": "thing" } } }, target={ "incoming": { "type": "JsonProperty", "json": { "a": 2, "c": "other thing" } } }, expected={ "incoming": { "type": "JsonProperty", "json": { "a": 2, "b": "thing", "c": "other thing" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [7] source={ "attribute": { "type": "VocabProperty", "vocab": "stellio" } }, target={ "attribute": { "type": "VocabProperty", "vocab": "egm" } }, expected={ "attribute": { "type": "VocabProperty", "vocab": "egm" } } … ```

:recycle: This comment has been updated with latest results.

bobeal commented 2 weeks ago

Did a try and:

$ git commit --file=/var/folders/86/8jzxb8dd63z_584pglf2tj7m0000gn/T/78C121CB-CB73-4D48-A410-0992A5D24F4D

detekt check.............................................................Failed
- hook id: detekt
- exit code: 1

Executable `/Users/bobeal/egm/dev/datahub/stellio-context-broker/config/detekt/detekt.sh` is not executable
thomasBousselin commented 2 weeks ago

I did git update-index --chmod=+x .\config\detekt\detekt_auto_correct.sh who is supposed to make the file executable.

bobeal commented 2 weeks ago

Looked good when tried today. Remember you wanted to add one last improvement.

thomasBousselin commented 2 weeks ago

Sadly the return code from auto-correct and unexpected error is the same (1). So the idea of looping only when there was an auto correct is not possible. I will just reduce the max number of iteration instead.

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud