Open csrvsk opened 1 year ago
Hi Filepe,
Please check it and let me know if you have any fix for this issue.
Thanks Shiva
Hi,
You can use the ZPA Toolkit to check how the parser process your code, for example:
If that's your situation, you could subscribe to DdlGrammar.CREATE_TABLE
and use node.getFirstChild(PlSqlGrammar.UNIT_NAME).getTokenOriginalValue()
to get the table name.
Hi Filepe,
As you said, I did subscribed to DdlGrammer.CREATE_TABLE and used node.getFirstChild(PlSqlGrammar.UNIT_NAME).getTokenOriginalValue() to get the table name. Seems like it didn't work.
I am still getting the same error as before.
C:\myfiles\zpa-Latest>gradlew build -p plsql-custom-rules Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc." Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Task :compileJava FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'. Could not find org.sonar.plsqlopen:sonar-plsql-open-plugin:2.4.0. Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/sonar/plsqlopen/sonar-plsql-open-plugin/2.4.0/sonar-plsql-open-plugin-2.4.0.pom
- file:/C:/Users/ShivaKumar.Vardhamaa/.m2/repository/org/sonar/plsqlopen/sonar-plsql-open-plugin/2.4.0/sonar-plsql-open-plugin-2.4.0.pom
- https://s01.oss.sonatype.org/content/repositories/snapshots/org/sonar/plsqlopen/sonar-plsql-open-plugin/2.4.0/sonar-plsql-open-plugin-2.4.0.pom Required by: project :
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
BUILD FAILED in 12s 1 actionable task: 1 executed
C:\myfiles\zpa-Latest>
Not sure what went wrong in this
Thanks vsk
sonar-plsql-open-plugin:2.4.0
Unfortunately, the version you are using is very old and I’m unable to provide support for it. I suggest that you update the plugin to the latest version on the SonarQube server and follow the instructions at Create a plugin with custom rules.
Hi Filepe,
Plugin compatibility has been fixed by build.gradle file by replacing the following line //implementation("org.sonar.plsqlopen:sonar-plsql-open-plugin:2.4.0")
with this
"implementation("com.felipebz.zpa:sonar-zpa-plugin:3.0.0")"
But I am still getting the following error:
It says: C:\myfiles\zpa-Latest>gradlew build -p plsql-custom-rules Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
Task :compileJava FAILED C:\myfiles\zpa-Latest\plsql-custom-rules\src\main\java\com\company\plsql\TableNamingCheck.java:13: error: cannot find symbol import org.sonar.plugins.plsqlopen.api.DdlGrammar.CREATE_TABLE; ^ symbol: class CREATE_TABLE location: class DdlGrammar 1 error
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compileJava'.
Compilation failed; see the compiler error output for details.
Try:
Run with --info option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 1s 1 actionable task: 1 executed C:\myfiles\zpa-Latest>"
Please advise how to fix this issue.
Thanks vsk
Hi Filepe,
Latest error is
" C:\myfiles\zpa-Latest>gradlew clean build -p plsql-custom-rules Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
Task :compileTestJava FAILED C:\myfiles\zpa-Latest\plsql-custom-rules\src\test\java\com\company\plsql\PlSqlCustomRulesDefinitionTest.java:6: error: cannot find symbol import org.sonar.api.SonarEdition; ^ symbol: class SonarEdition location: package org.sonar.api C:\myfiles\zpa-Latest\plsql-custom-rules\src\test\java\com\company\plsql\PlSqlCustomRulesDefinitionTest.java:11: error: package org.sonarsource.sonarqube does not exist import org.sonarsource.sonarqube.*; ^ C:\myfiles\zpa-Latest\plsql-custom-rules\src\test\java\com\company\plsql\PlSqlCustomRulesDefinitionTest.java:20: error: cannot find symbol Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(6, 0), SonarQubeSide.SERVER, SonarEdition.COMMUNITY)); ^ symbol: variable SonarEdition location: class PlSqlCustomRulesDefinitionTest 3 errors
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compileTestJava'.
Compilation failed; see the compiler error output for details.
Try:
Run with --info option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 7s 5 actionable tasks: 4 executed, 1 up-to-date
C:\myfiles\zpa-Latest> "
Thanks vsk
Hi,
C:\myfiles\zpa-Latest\plsql-custom-rules\src\test\java\com\company\plsql\PlSqlCustomRulesDefinitionTest.java:11: error: package org.sonarsource.sonarqube does not exist import org.sonarsource.sonarqube.*;
This line doesn't exist in the example: https://github.com/felipebz/zpa/blob/8103d9b7fcc7ed7e1f7116a41b165614a063922a/plsql-custom-rules/src/test/java/com/company/plsql/PlSqlCustomRulesDefinitionTest.java#L3-L12
C:\myfiles\zpa-Latest\plsql-custom-rules\src\test\java\com\company\plsql\PlSqlCustomRulesDefinitionTest.java:6: error: cannot find symbol import org.sonar.api.SonarEdition;
C:\myfiles\zpa-Latest\plsql-custom-rules\src\test\java\com\company\plsql\PlSqlCustomRulesDefinitionTest.java:20: error: cannot find symbol Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(6, 0), SonarQubeSide.SERVER, SonarEdition.COMMUNITY));
And these errors indicate that's you're using the wrong version of the SonarQube API. You said before that you changed the dependency to implementation("com.felipebz.zpa:sonar-zpa-plugin:3.0.0")
, but if we look at the 3.0.0 example:
SonarEdition
didn't exist at that time.
It seems that's something wrong your build file and and it's quite hard for me to help you without knowing exactly what files you changed, what versions you're using.... I suggest you to get the whole plsql-custom-rules
folder from here, don't change anything and try to build this project as is.
Hi Felipe,
Thanks for the advise.
As you said I used the latest 3.2.1 code from (https://codeload.github.com/felipebz/zpa/zip/refs/tags/3.2.1) you shared.
It helped a lot. As of now, I used the following logic,
`package com.company.plsql;
import org.sonar.plugins.plsqlopen.api.DdlGrammar; import org.sonar.plugins.plsqlopen.api.annotations.Priority; import org.sonar.plugins.plsqlopen.api.annotations.Rule; import org.sonar.plugins.plsqlopen.api.annotations.ActivatedByDefault; import org.sonar.plugins.plsqlopen.api.annotations.ConstantRemediation; import org.sonar.plugins.plsqlopen.api.checks.PlSqlCheck; import org.sonar.plugins.plsqlopen.api.sslr.AstNode;
import java.util.regex.Pattern; import java.util.logging.Logger;
@Rule( name = "Table Naming Conventions", description = "Ensure tables follow the defined naming conventions.", key = "TableNamingCheck", priority = Priority.MAJOR ) @ConstantRemediation("10min") @ActivatedByDefault public class TableNamingCheck extends PlSqlCheck {
private final static Logger LOGGER = Logger.getLogger(TableNamingCheck.class.getName());
private static final Pattern TABLE_PATTERN = Pattern.compile("^([A-Z0-9]{2,3})_([A-Z0-9_]+)(_TN|_TABLE_TN|_TABLE)?$");
@Override
public void init() {
subscribeTo(DdlGrammar.CREATE_TABLE);
}
@Override
public void visitNode(AstNode node) {
// Check for a CREATE_TABLE child node similar to the commented code
if (node.hasDirectChildren(DdlGrammar.CREATE_TABLE)) {
// Fetch the first child of type CREATE_TABLE
AstNode createTableNode = node.getFirstChild(DdlGrammar.CREATE_TABLE);
// Assuming tableNameNode is actually what you meant to use as createTableNode
AstNode tableNameNode = createTableNode; // Or some other logic to get the table name node
// Log the table name being evaluated (added logging)
String tableName = tableNameNode.getTokenOriginalValue().toUpperCase();
LOGGER.info("Evaluating table name: " + tableName);
if (tableNameNode != null) {
// You can keep the following checks the same as the uncommented code
if (!TABLE_PATTERN.matcher(tableName).matches()) {
addIssue(node, "Table name does not follow the naming conventions.");
return;
}
// Additional checks for exceptions
}
}
}
}`
As of now
`Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
PlSqlCustomRulesDefinitionTest > test() STANDARD_OUT java.lang.Class
PlSqlCustomRulesDefinitionTest > test() FAILED org.opentest4j.AssertionFailedError: expected: <2> but was: <1> at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150) at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145) at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:527) at app//com.company.plsql.PlSqlCustomRulesDefinitionTest.test(PlSqlCustomRulesDefinitionTest.java:23)
TableNameCheckTest > testExceptions() STANDARD_OUT Running testExceptions
TableNameCheckTest > testIncorrectNamingConvention() STANDARD_OUT Running testIncorrectNamingConvention
TableNameCheckTest > testCorrectNamingConvention() STANDARD_OUT Running testCorrectNamingConvention
6 tests completed, 1 failed Finished generating test XML results (0.009 secs) into: C:\myfiles\zpa-3.2.1\plsql-custom-rules\build\test-results\test Generating HTML test report... Finished generating test html results (0.019 secs) into: C:\myfiles\zpa-3.2.1\plsql-custom-rules\build\reports\tests\test
FAILURE: Build failed with an exception.`
It is giving me this error, even though I have updated the size from 1 to 2,
`public class PlSqlCustomRulesDefinitionTest {
@Test
public void test() {
Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(8, 9), SonarQubeSide.SERVER, SonarEdition.COMMUNITY));
PlSqlCustomRulesPlugin plugin = new PlSqlCustomRulesPlugin();
plugin.define(context);
assertEquals(2, context.getExtensions().size());
//assertEquals(1, context.getExtensions().size());
}
}`
Not sure what am I missing.
Please advise.
Thanks vsk
Hi Felipe,
I am able to compile the plugin. But now the issue is - getting errors in integration test saying that, some of the json files were not found even though they exist.
Please check the following logs & advise how to fix.
PlSqlRulingTest > pljson() FAILED org.opentest4j.AssertionFailedError: Expected issues on src\integrationTest\resources\expected\pljson\CollapsibleIfStatementsCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\InequalityUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\ComparisonWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\InsertWithoutColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\DeclareSectionWithoutDeclarationsCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\ComparisonWithBooleanCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\CharacterDatatypeUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\SelectAllColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\ColumnsShouldHaveTableNameCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\ToDateWithoutFormatCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\ExplicitInParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\VariableInitializationWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\EmptyStringAssignmentCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\VariableInitializationWithFunctionCallCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\IfWithExitCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\FunctionWithOutParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\QueryWithoutExceptionHandlingCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\UnusedVariableCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\VariableHidingCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\DbmsOutputPutCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\UnnecessaryElseCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\DeadCodeCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\SameBranchCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\UnusedParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\pljson\UnnecessaryNullStatementCheck.json were not found at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:42) at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:147) at app//org.junit.jupiter.api.AssertionsKt.fail(Assertions.kt:27) at app//org.junit.jupiter.api.AssertionsKt.fail$default(Assertions.kt:26) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze(PlSqlRulingTest.kt:211) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze$default(PlSqlRulingTest.kt:170) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.pljson(PlSqlRulingTest.kt:47)
PlSqlRulingTest > alexandria_plsql_utils() FAILED org.opentest4j.AssertionFailedError: Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\EmptyBlockCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\ParsingErrorCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\CollapsibleIfStatementsCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\InequalityUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\ComparisonWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\InsertWithoutColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\NvlWithNullParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\ComparisonWithBooleanCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\CharacterDatatypeUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\SelectAllColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\ExplicitInParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\VariableInitializationWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\UselessParenthesisCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\EmptyStringAssignmentCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\VariableInitializationWithFunctionCallCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\IfWithExitCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\FunctionWithOutParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\QueryWithoutExceptionHandlingCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\UnusedVariableCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\VariableHidingCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\DbmsOutputPutCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\UnnecessaryElseCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\DeadCodeCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\ConcatenationWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\SameBranchCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\UnusedParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\CommitRollbackCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\UnnecessaryNullStatementCheck.json were not found Expected issues on src\integrationTest\resources\expected\alexandria-plsql-utils\UnnecessaryAliasInQueryCheck.json were not found at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:42) at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:147) at app//org.junit.jupiter.api.AssertionsKt.fail(Assertions.kt:27) at app//org.junit.jupiter.api.AssertionsKt.fail$default(Assertions.kt:26) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze(PlSqlRulingTest.kt:211) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze$default(PlSqlRulingTest.kt:170) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.alexandria_plsql_utils(PlSqlRulingTest.kt:42)
PlSqlRulingTest > utPLSQL2() FAILED org.opentest4j.AssertionFailedError: Expected issues on src\integrationTest\resources\expected\utPLSQL2\EmptyBlockCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\ParsingErrorCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\InequalityUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\InsertWithoutColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\CharacterDatatypeUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\SelectAllColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\ColumnsShouldHaveTableNameCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\ExplicitInParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\VariableInitializationWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\VariableInitializationWithFunctionCallCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\IfWithExitCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\FunctionWithOutParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\RaiseStandardExceptionCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\QueryWithoutExceptionHandlingCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\UnusedVariableCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\VariableHidingCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\DbmsOutputPutCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\UnnecessaryElseCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\DeadCodeCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\SameBranchCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\UnusedParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\CommitRollbackCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\UnnecessaryNullStatementCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\UnnecessaryAliasInQueryCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\UnhandledUserDefinedExceptionCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL2\CursorBodyInPackageSpecCheck.json were not found at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:42) at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:147) at app//org.junit.jupiter.api.AssertionsKt.fail(Assertions.kt:27) at app//org.junit.jupiter.api.AssertionsKt.fail$default(Assertions.kt:26) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze(PlSqlRulingTest.kt:211) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze$default(PlSqlRulingTest.kt:170) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.utPLSQL2(PlSqlRulingTest.kt:52)
PlSqlRulingTest > utPLSQL3() FAILED org.opentest4j.AssertionFailedError: Expected issues on src\integrationTest\resources\expected\utPLSQL3\EmptyBlockCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\ParsingErrorCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\CollapsibleIfStatementsCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\InequalityUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\ComparisonWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\InsertWithoutColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\CharacterDatatypeUsageCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\SelectAllColumnsCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\ToDateWithoutFormatCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\ExplicitInParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\VariableInitializationWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\IdenticalExpressionCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\VariableInitializationWithFunctionCallCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\IfWithExitCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\FunctionWithOutParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\AddParenthesesInNestedExpressionCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\RaiseStandardExceptionCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\QueryWithoutExceptionHandlingCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnusedVariableCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\VariableHidingCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\DbmsOutputPutCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnnecessaryElseCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\ConcatenationWithNullCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnusedParameterCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\CommitRollbackCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnnecessaryNullStatementCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnnecessaryAliasInQueryCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnhandledUserDefinedExceptionCheck.json were not found Expected issues on src\integrationTest\resources\expected\utPLSQL3\UnnecessaryLikeCheck.json were not found at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:42) at app//org.junit.jupiter.api.Assertions.fail(Assertions.java:147) at app//org.junit.jupiter.api.AssertionsKt.fail(Assertions.kt:27) at app//org.junit.jupiter.api.AssertionsKt.fail$default(Assertions.kt:26) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze(PlSqlRulingTest.kt:211) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.analyze$default(PlSqlRulingTest.kt:170) at app//org.sonar.plsqlopen.it.PlSqlRulingTest.utPLSQL3(PlSqlRulingTest.kt:57)
Thanks vsk
Hi Felipe,
Please let me know if you have any update on this.
Thanks vsk
Hi Felipe,
I am testing your plugin downloaded and without making any changes. When I ran "gradlew integrationTest" it is failing with the following logs.
I thought it was failing tests because of files i have added to create my custom rule. But it seems like that is not the issue at all.
Above logs were produced with zpa plugin version 3.2.0. source code - integration test, without making any chnags to actual source code.
Please find these logs and let me know, what are we missing here and how to fix it..
Thanks vsk
Hi Felipe,
Please let me know if there is a possibility to fix this error, as it is a blocker for us proceed to experiment on implementing new custom rules using your plugin. Because the basic plugin also having issues passing the integrationTest.
Any update from your end would help us.
Thanks vsk
I am trying to write a custom rule to implement TableName check,
But I am facing compilation errors. Please suggest how to achieve this.
ERROR: C:\myfiles\zpa-Latest>gradlew build -p plsql-custom-rules Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compileJava'.
Try:
BUILD FAILED in 4s 1 actionable task: 1 executed
Here is my custom rule class
package com.company.plsql;
import java.util.regex.Pattern; import org.sonar.plugins.plsqlopen.api.annotations.Priority; import org.sonar.plugins.plsqlopen.api.annotations.Rule; import org.sonar.plugins.plsqlopen.api.DmlGrammar; import org.sonar.plugins.plsqlopen.api.annotations.ActivatedByDefault; import org.sonar.plugins.plsqlopen.api.annotations.ConstantRemediation; import org.sonar.plugins.plsqlopen.api.checks.PlSqlCheck; import org.sonar.plugins.plsqlopen.api.sslr.AstNode; import org.sonar.plugins.plsqlopen.api.PlSqlGrammar; import org.sonar.plugins.plsqlopen.api.DmlGrammar;
@Rule( name = "Table Naming Conventions", description = "Ensure tables follow the defined naming conventions.", key = "TableNamingCheck", priority = Priority.MAJOR ) @ConstantRemediation("10min") @ActivatedByDefault public class TableNamingCheck extends PlSqlCheck {
}
NOTE: I also tried with PlSqlGrammar.TABLE_DECLARATION; But still got the same error.
Please suggest an alternative way to achieve this.