From 104dc71082eab32b10ac7e16999d88daa913112d Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Thu, 17 Aug 2023 11:31:18 +0200 Subject: [PATCH 01/10] fix: Hopefully fixed the build of the cpp-example on windows systems --- example/client-cpp-example/src/CMakeLists.txt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/example/client-cpp-example/src/CMakeLists.txt b/example/client-cpp-example/src/CMakeLists.txt index 6e9e60e089a8..b3b117c5dda7 100644 --- a/example/client-cpp-example/src/CMakeLists.txt +++ b/example/client-cpp-example/src/CMakeLists.txt @@ -33,12 +33,6 @@ IF (DEFINED BOOST_INCLUDEDIR) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) ENDIF() -# Add the libs for thrift -IF(MSVC) - SET(THRIFT_STATIC_LIB "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib") -ELSE() - SET(THRIFT_STATIC_LIB "${CMAKE_SOURCE_DIR}/thrift/lib/libthrift.a") -ENDIF() # Add the libs for the cpp-client LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/lib) @@ -46,8 +40,8 @@ ADD_EXECUTABLE(SessionExample SessionExample.cpp) ADD_EXECUTABLE(AlignedTimeseriesSessionExample AlignedTimeseriesSessionExample.cpp) IF(MSVC) - TARGET_LINK_LIBRARIES(SessionExample iotdb_session thriftmd) - TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample iotdb_session thriftmd) + TARGET_LINK_LIBRARIES(SessionExample iotdb_session "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib) + TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample iotdb_session "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib) ELSE() TARGET_LINK_LIBRARIES(SessionExample iotdb_session pthread) TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample iotdb_session pthread) From e1c6f722e95736e64527b64758c7659f2eb6c379 Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Tue, 7 Nov 2023 22:31:47 +0100 Subject: [PATCH 02/10] fix: Increase the timeout even more to finally make the build succeed. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cd3ba4c85997..49d95a32a602 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline { } options { - timeout(time: 4, unit: 'HOURS') + timeout(time: 8, unit: 'HOURS') // When we have test-fails e.g. we don't need to run the remaining steps skipStagesAfterUnstable() } From 24f78424f5d7c72e1b6757166e95a5ec20c40407 Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Thu, 14 Mar 2024 22:02:37 +0100 Subject: [PATCH 03/10] fix: Fix the build. --- .../src/test/java/org/apache/iotdb/tool/WriteCsvFileTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iotdb-client/cli/src/test/java/org/apache/iotdb/tool/WriteCsvFileTest.java b/iotdb-client/cli/src/test/java/org/apache/iotdb/tool/WriteCsvFileTest.java index 4b491f18cc88..c5b271916936 100644 --- a/iotdb-client/cli/src/test/java/org/apache/iotdb/tool/WriteCsvFileTest.java +++ b/iotdb-client/cli/src/test/java/org/apache/iotdb/tool/WriteCsvFileTest.java @@ -38,7 +38,7 @@ public void writeCsvFileTest() { List row3 = new ArrayList<>(Arrays.asList(3, "100", "hello world!!!", false)); ArrayList> records = new ArrayList<>(Arrays.asList(row1, row2, row3)); - assertTrue(AbstractCsvTool.writeCsvFile(headerNames, records, "./test0.csv")); - assertTrue(AbstractCsvTool.writeCsvFile(null, records, "./test1.csv")); + assertTrue(AbstractCsvTool.writeCsvFile(headerNames, records, "./target/test0.csv")); + assertTrue(AbstractCsvTool.writeCsvFile(null, records, "./target/test1.csv")); } } From e21c528710c41285829440e0309dddd6214e10a0 Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Wed, 21 Aug 2024 16:56:32 +0200 Subject: [PATCH 04/10] feat: Added some jqassistant checks to the build --- .jqassistant.yml | 26 ++++++++++ jqassistant/logging.xml | 102 +++++++++++++++++++++++++++++++++++++ jqassistant/singletons.xml | 82 +++++++++++++++++++++++++++++ pom.xml | 13 +++++ 4 files changed, 223 insertions(+) create mode 100644 .jqassistant.yml create mode 100644 jqassistant/logging.xml create mode 100644 jqassistant/singletons.xml diff --git a/.jqassistant.yml b/.jqassistant.yml new file mode 100644 index 000000000000..f2d93459928f --- /dev/null +++ b/.jqassistant.yml @@ -0,0 +1,26 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# documentation https://jqassistant.github.io/jqassistant/2.4.0/ +jqassistant: + analyze: + groups: + - logging + - singleton + execute-applied-concepts: true diff --git a/jqassistant/logging.xml b/jqassistant/logging.xml new file mode 100644 index 000000000000..d368190f428f --- /dev/null +++ b/jqassistant/logging.xml @@ -0,0 +1,102 @@ + + + + + + + + Log4j and Commons Logging must not be used as dependencies. + (artifact:Artifact), + shortestPath((artifact)-[:DEPENDS_ON*]->(invalidDependency:Artifact)) + WHERE + invalidDependency.group = unwantedDependency.group + and invalidDependency.name = unwantedDependency.name + RETURN + artifact.fqn as Artifact, invalidDependency.fqn as InvalidDependency + ]]> + + + + + + Slf4j logger must be used for logging + (method:Method)-[invocation:INVOKES]->(:Method)<-[:DECLARES]-(logger:Type:Logger) + WHERE NOT + logger:Slf4j + RETURN + type as Type, invocation as Invocation, logger as InvalidLogger + ORDER BY + invocation.lineNumber + ]]> + + + + Identifies the loggers used in the application + + + + + Identifies the Slf4j loggers used in the application + + + + + Identifies the Logback loggers used in the application + + + diff --git a/jqassistant/singletons.xml b/jqassistant/singletons.xml new file mode 100644 index 000000000000..89651f325eff --- /dev/null +++ b/jqassistant/singletons.xml @@ -0,0 +1,82 @@ + + + + + + + + + + No singletons should be used. + (method:Method)-[invocation:INVOKES]->(:Method)<-[:DECLARES]-(singleton:Type:Singleton) + WHERE NOT + singleton:Singleton + RETURN + type as Type, invocation as Invocation, singleton as SingletonDefinition + ORDER BY + invocation.lineNumber + ]]> + + + + Identifies singletons as a general concept. + + + + + + Identifies singletons that are accessed by a public static getInstance() method that returns the type of the main class. + (instance:Field)-[:OF_TYPE]->(singleton) WHERE instance.static = true + SET + singleton:Singleton:GetInstance + RETURN + singleton + ORDER BY + singleton.fqn + ]]> + + + + Identifies singletons that are accessed by a public static property of the type of the main class. + (instance:Field)-[:OF_TYPE]->(singleton) + SET + singleton:Singleton:PublicProperty + RETURN + singleton + ORDER BY + singleton.fqn + ]]> + + diff --git a/pom.xml b/pom.xml index a9ad6a420872..4b1b6fc4bbea 100644 --- a/pom.xml +++ b/pom.xml @@ -1016,6 +1016,19 @@ ${spotless.skip} + + com.buschmais.jqassistant + jqassistant-maven-plugin + 2.5.0-M1 + + + + scan + analyze + + + + org.eluder.coveralls coveralls-maven-plugin From 6905c8e2875dd1ace87dae7ad3048758d308e0d6 Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Wed, 21 Aug 2024 17:45:41 +0200 Subject: [PATCH 05/10] feat: Updated the definition of some singleton concepts --- jqassistant/singletons.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jqassistant/singletons.xml b/jqassistant/singletons.xml index 89651f325eff..d44020206769 100644 --- a/jqassistant/singletons.xml +++ b/jqassistant/singletons.xml @@ -24,7 +24,7 @@ - + No singletons should be used. - + Identifies singletons that are accessed by a public static getInstance() method that returns the type of the main class. (instance:Field)-[:OF_TYPE]->(singleton) WHERE instance.static = true + (singleton:Class:Type)-[:DECLARES]->(method:Method) -[:RETURNS]-> (singleton) WHERE method.name = "getInstance" AND method.static = true AND method.visibility = "public" SET - singleton:Singleton:GetInstance + singleton:Singleton:PublicStaticMethod RETURN singleton ORDER BY @@ -70,9 +70,9 @@ Identifies singletons that are accessed by a public static property of the type of the main class. (instance:Field)-[:OF_TYPE]->(singleton) + (singleton:Class:Type)-[:DECLARES*]->(instance:Field)-[:OF_TYPE]->(singleton) WHERE instance.static = true AND instance.visibility = "public" SET - singleton:Singleton:PublicProperty + singleton:Singleton:PublicStaticProperty RETURN singleton ORDER BY From 4f8b6c0518179c9d8325fe5133266428a5888659 Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Wed, 21 Aug 2024 18:47:16 +0200 Subject: [PATCH 06/10] feat: Added a singleton client concept --- .jqassistant.yml | 1 - jqassistant/logging.xml | 102 ------------------------------------- jqassistant/singletons.xml | 56 +++++++++++++++++--- 3 files changed, 49 insertions(+), 110 deletions(-) delete mode 100644 jqassistant/logging.xml diff --git a/.jqassistant.yml b/.jqassistant.yml index f2d93459928f..afa9eccbf209 100644 --- a/.jqassistant.yml +++ b/.jqassistant.yml @@ -21,6 +21,5 @@ jqassistant: analyze: groups: - - logging - singleton execute-applied-concepts: true diff --git a/jqassistant/logging.xml b/jqassistant/logging.xml deleted file mode 100644 index d368190f428f..000000000000 --- a/jqassistant/logging.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - Log4j and Commons Logging must not be used as dependencies. - (artifact:Artifact), - shortestPath((artifact)-[:DEPENDS_ON*]->(invalidDependency:Artifact)) - WHERE - invalidDependency.group = unwantedDependency.group - and invalidDependency.name = unwantedDependency.name - RETURN - artifact.fqn as Artifact, invalidDependency.fqn as InvalidDependency - ]]> - - - - - - Slf4j logger must be used for logging - (method:Method)-[invocation:INVOKES]->(:Method)<-[:DECLARES]-(logger:Type:Logger) - WHERE NOT - logger:Slf4j - RETURN - type as Type, invocation as Invocation, logger as InvalidLogger - ORDER BY - invocation.lineNumber - ]]> - - - - Identifies the loggers used in the application - - - - - Identifies the Slf4j loggers used in the application - - - - - Identifies the Logback loggers used in the application - - - diff --git a/jqassistant/singletons.xml b/jqassistant/singletons.xml index d44020206769..9e3b822de873 100644 --- a/jqassistant/singletons.xml +++ b/jqassistant/singletons.xml @@ -26,12 +26,14 @@ + + No singletons should be used. (method:Method)-[invocation:INVOKES]->(:Method)<-[:DECLARES]-(singleton:Type:Singleton) - WHERE NOT - singleton:Singleton + (type:Type) -[:DECLARES]-> (method:Method) -[invocation:INVOKES]-> (:Method) <-[:DECLARES]- (singleton:Type:Singleton) + WHERE + singleton:SingletonClient RETURN type as Type, invocation as Invocation, singleton as SingletonDefinition ORDER BY @@ -39,6 +41,7 @@ ]]> + Identifies singletons as a general concept. Identifies singletons that are accessed by a public static getInstance() method that returns the type of the main class. (method:Method) -[:RETURNS]-> (singleton) WHERE method.name = "getInstance" AND method.static = true AND method.visibility = "public" + (singleton:Class:Type) -[:DECLARES]-> (method:Method) -[:RETURNS]-> (singleton) WHERE method.name = "getInstance" AND method.static = true AND method.visibility = "public" SET - singleton:Singleton:PublicStaticMethod + method:Singleton:PublicStaticMethod RETURN singleton ORDER BY @@ -70,13 +73,52 @@ Identifies singletons that are accessed by a public static property of the type of the main class. (instance:Field)-[:OF_TYPE]->(singleton) WHERE instance.static = true AND instance.visibility = "public" + (singleton:Class:Type) -[:DECLARES*]-> (field:Field) -[:OF_TYPE]-> (singleton) WHERE field.static = true AND field.visibility = "public" SET - singleton:Singleton:PublicStaticProperty + field:Singleton:PublicStaticField RETURN singleton ORDER BY singleton.fqn ]]> + + Identifies singleton client as a general concept. + + + + + Identifies classes that accesses a singleton via public static getInstance() method. + (whatever) -[:INVOKES]-> (s:Singleton) + SET + client:SingletonClient:PublicStaticMethod + RETURN + client + ORDER BY + client.fqn + ]]> + + + + Identifies classes that accesses a singleton via public static property. + (whatever) -[:READS]-> (s:Singleton) + SET + client:SingletonClient:PublicStaticField + RETURN + client + ORDER BY + client.fqn + ]]> + From c006a637ef44787743c7179849011ee230bb943a Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Wed, 21 Aug 2024 18:47:24 +0200 Subject: [PATCH 07/10] feat: Added a singleton client concept --- singletons.adoc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 singletons.adoc diff --git a/singletons.adoc b/singletons.adoc new file mode 100644 index 000000000000..45fda56fcc4d --- /dev/null +++ b/singletons.adoc @@ -0,0 +1,34 @@ + + +== Expressions + +List names of classes and methods or properties for accessing the singleton (Uses the "singleton" concept): + + MATCH (parent:Type:Class) -[:DECLARES*]-> (s:Singleton) RETURN parent.fqn, s.name + +List all classes, that access a singleton via public static property: + + MATCH (client:Type:Class) -[:DECLARES*]-> (whatever) -[:READS]->(s:Singleton) RETURN DISTINCT client.fqn ORDER BY client.fqn + +List all classes, that access a singleton via public static method: + + MATCH (client:Type:Class) -[:DECLARES*]-> (whatever) -[:INVOKES]->(s:Singleton) RETURN DISTINCT client.fqn ORDER BY client.fqn From 633723c971e9cf6b49ec8636f7f918bb6151143f Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Thu, 22 Aug 2024 11:18:22 +0200 Subject: [PATCH 08/10] feat: Added new USES_SINGLETON relationships between Singletons and their clients. --- jqassistant/singletons.xml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/jqassistant/singletons.xml b/jqassistant/singletons.xml index 9e3b822de873..822915301cf0 100644 --- a/jqassistant/singletons.xml +++ b/jqassistant/singletons.xml @@ -41,7 +41,7 @@ ]]> - + Identifies singletons as a general concept. - + + Identifies singletons that are accessed by a public static getInstance() method that returns the type of the main class. + Identifies singletons that are accessed by a public static property of the type of the main class. @@ -82,6 +84,7 @@ singleton.fqn ]]> + Identifies singleton client as a general concept. + + + Identifies classes that accesses a singleton via public static getInstance() method. (whatever) -[:INVOKES]-> (s:Singleton) + (client:Type:Class) -[:DECLARES*]-> (whatever) -[:INVOKES]-> (singleton:Singleton) SET client:SingletonClient:PublicStaticMethod + CREATE + (client) -[:USES_SINGLETON]-> (singleton) RETURN client ORDER BY client.fqn ]]> + + + Identifies classes that accesses a singleton via public static property. (whatever) -[:READS]-> (s:Singleton) + (client:Type:Class) -[:DECLARES*]-> (whatever) -[:READS]-> (singleton:Singleton) SET client:SingletonClient:PublicStaticField + CREATE + (client) -[:USES_SINGLETON]-> (singleton) RETURN client ORDER BY From 8381f976dc58deb13346ff645aa0da719214555e Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Thu, 22 Aug 2024 11:47:20 +0200 Subject: [PATCH 09/10] feat: Polished the reports and queries a bit. --- jqassistant/singletons.xml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/jqassistant/singletons.xml b/jqassistant/singletons.xml index 822915301cf0..8bbc52d29221 100644 --- a/jqassistant/singletons.xml +++ b/jqassistant/singletons.xml @@ -56,11 +56,10 @@ - Identifies singletons that are accessed by a public static getInstance() method that returns the type of the main class. (method:Method) -[:RETURNS]-> (singleton) WHERE method.name = "getInstance" AND method.static = true AND method.visibility = "public" + (singleton:Class:Type) -[:DECLARES]-> (method:Method) -[:RETURNS]-> (singleton) WHERE NOT (method) -[:HAS]-> (:Parameter) AND method.static = true AND method.visibility = "public" SET method:Singleton:PublicStaticMethod RETURN @@ -91,12 +90,15 @@ MATCH (client:Type:SingletonClient) RETURN - client + DISTINCT client ORDER BY client.fqn ]]> - + @@ -107,15 +109,18 @@ (client:Type:Class) -[:DECLARES*]-> (whatever) -[:INVOKES]-> (singleton:Singleton) SET client:SingletonClient:PublicStaticMethod - CREATE + MERGE (client) -[:USES_SINGLETON]-> (singleton) RETURN - client + DISTINCT client, singleton ORDER BY client.fqn ]]> - + @@ -126,10 +131,10 @@ (client:Type:Class) -[:DECLARES*]-> (whatever) -[:READS]-> (singleton:Singleton) SET client:SingletonClient:PublicStaticField - CREATE + MERGE (client) -[:USES_SINGLETON]-> (singleton) RETURN - client + DISTINCT client, singleton ORDER BY client.fqn ]]> From 4198888da789b57b97be2415bff10ade1774fd5a Mon Sep 17 00:00:00 2001 From: Christofer Dutz Date: Thu, 22 Aug 2024 14:06:13 +0200 Subject: [PATCH 10/10] feat: Moved the execution into a separate profile --- pom.xml | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 4b1b6fc4bbea..9e61abf566a1 100644 --- a/pom.xml +++ b/pom.xml @@ -1016,19 +1016,6 @@ ${spotless.skip} - - com.buschmais.jqassistant - jqassistant-maven-plugin - 2.5.0-M1 - - - - scan - analyze - - - - org.eluder.coveralls coveralls-maven-plugin @@ -1919,5 +1906,33 @@ false + + + with-architectural-analysis + + + + com.buschmais.jqassistant + jqassistant-maven-plugin + 2.5.0-M1 + + + + + scan + + analyze + + + + + + +