Forums : Technical Issue Help

Dear Open Hub Users,

We’re excited to announce that we will be moving the Open Hub Forum to https://community.blackduck.com/s/black-duck-open-hub. Beginning immediately, users can head over, register, get technical help and discuss issue pertinent to the Open Hub. Registered users can also subscribe to Open Hub announcements here.


On May 1, 2020, we will be freezing https://www.openhub.net/forums and users will not be able to create new discussions. If you have any questions and concerns, please email us at [email protected]

Metric++ / Cpd Lexical error

hi,
I use Sonar and the plugin MetriC++ on a platform Tomcat / Windows XP
During the execution of metric Sonar Cpd I get an error on the characters of
continuity of line (\r)
Below is the errors report, the C code in question and the pom.xml

A long string can be continued across multiple lines by using the backslash-newline line continuation feature, but the continuation of the string must start in the first position of the next line.

Is there a workaround?

Best regards

Dominique

Sonar Errors :

$ mvn -e -f Cpp_pom.xml sonar:sonar

  • Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'sonar'. [INFO] --------------------------------------------------------------------- [INFO] Building [INFO] task-segment: sonar:sonar [INFO] --------------------------------------------------------------------- [INFO] [sonar:sonar {execution: default-cli}] [INFO] Sonar host: http://aofr10xxxx:8080/sonar [INFO] Sonar version: 1.10.1 [INFO] [sonar-core:internal {execution: default-internal}] [INFO] Sonar branch: [INFO] ------------- Analyse Disnat... [INFO] Selected quality profile : MetriC++ way, language=cpp [INFO] -------------------------------------------------------------------- [INFO] Configure maven plugins... [INFO] Oracle JDAPI found [INFO] Executing sensor class org.sonar.plugins.core.sensors.AsynchronousMeasuresSensor [INFO] Executing sensor class org.sonar.plugins.metricpp.cpp.CppSourceImporter [INFO] Executing sensor class org.sonar.plugins.metricpp.flawfinder.FlawfinderSensor [INFO] Executing sensor class org.sonar.plugins.core.sensors.ProfileSensor [INFO] Executing sensor class org.sonar.plugins.core.sensors.ProjectLinksSensor [INFO] Executing sensor class org.sonar.plugins.core.sensors.VersionEventsSensor [INFO] Executing sensor class org.sonar.plugins.cpd.CpdSensor

net.sourceforge.pmd.cpd.cppast.TokenMgrError: Lexical error in file
d:\ntic\disnat\dvltc\src\dsnexportcontentieux\dsnexportcontentieux.c at
line 132, column

  1. Encountered: \r (13), after : \\' \') ,NVL(mvt44,\' \') ,NVL(mvt45,\' \') ,NVL(mvt46,\' \') ,NVL(mvt47,\' \') ,NVL(mv\" at net.sourceforge.pmd.cpd.cppast.CPPParserTokenManager.getNextToken(CPPParserT okenManager.java:1655) at net.sourceforge.pmd.cpd.CPPTokenizer.tokenize(CPPTokenizer.java:29) at net.sourceforge.pmd.cpd.CPD.add(CPD.java:106) at net.sourceforge.pmd.cpd.CPD.add(CPD.java:72) at org.sonar.plugins.cpd.CpdSensor.configureCPD(CpdSensor.java:93) at org.sonar.plugins.cpd.CpdSensor.executeCPD(CpdSensor.java:73) at org.sonar.plugins.cpd.CpdSensor.analyse(CpdSensor.java:53) at org.sonar.batch.core.SensorsExecutor.execute(SensorsExecutor.java:53) at org.sonar.batch.Batch.executeJobs(Batch.java:91) at org.sonar.batch.Batch.analyse(Batch.java:79) at org.sonar.batch.Batch.start(Batch.java:54) at org.sonar.batch.BatchMojo.executeBatch(BatchMojo.java:153) at org.sonar.batch.BatchMojo.execute(BatchMojo.java:145) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManage r.java:483) at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82) at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65) at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManage r.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLife cycleExecutor.java:678) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(De faultLifecycleExecutor.java:553) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifec ycleExecutor.java:523) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail ures(DefaultLifecycleExecutor.java:371) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Defa ultLifecycleExecutor.java:268) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle Executor.java:181) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Skipping d:\ntic\disnat\dvltc\src\dsnexportcontentieux\dsnexportcontentieux.c due to parse error

Cpp_Pom.xml

4.0.0
Dxxxx
src
Dxxxx
0.0.1

${basedir}/dvltc/src
target

org.apache.maven.plugins
maven-compiler-plugin

*/.*

false
true
true
cpp

false
false
false
false

java -cp
/usr/local/bin/CodeAnalyzerPro.jar

/usr/local/bin/rats.exe

/usr/bin/flawfinder

/user/bin/cppcheck

C Source Code

72 /* Forms Interface /
73 static int IAPSUCC = 0;
74 static int IAPFAIL = 1403;
75 static int IAPFTL = 535;
76 extern void sqliem(/
_ char , int * _/);
77
78 static char *sq0001 =
79 ' ') ,NVL(mvt44,' ') ,NVL(mvt45,' ') ,NVL(mvt46,' ') ,NVL(mvt47,' ')
,NVL(mv\
80 t48,' ') ,NVL(mvt49,' ') ,NVL(mvt50,' ') ,NVL(mvt51,' ') ,NVL(mvt52,' ')
,NVL(\
81 mvt53,' ') ,NVL(mvt54,' ') ,NVL(mvt55,' ') ,NVL(mvt56,' ') ,NVL(mvt57,'
') ,NV\
82 L(mvt58,' ') ,NVL(mvt59,' ') ,NVL(mvt60,' ') ,NVL(mvt61,' ')
,NVL(mvt62,' ') ,\
83 NVL(mvt63,' ') ,NVL(mvt64,' ') ,NVL(mvt65,' ') ,NVL(mvt66,' ')
,NVL(mvt67,' ')\
84 ,NVL(mvt68,' ') ,NVL(mvt69,' ') ,NVL(mvt70,' ') ,NVL(mvt71,' ')
,NVL(mvt72,' \
85 ') ,NVL(mvt73,' ') ,NVL(mvt74,' ') ,NVL(mvt75,' ') ,NVL(mvt76,' ')
,NVL(mvt77,\
86 ' ') ,NVL(mvt78,' ') ,NVL(mvt79,' ') ,NVL(mvt80,' ') ,NVL(mvt81,' ')
,NVL(mvt8\
87 2,' ') ,NVL(mvt83,' ') ,NVL(mvt84,' ') ,NVL(mvt85,' ') ,NVL(mvt86,' ')
,NVL(mv\
88 t87,' ') ,NVL(mvt88,' ') ,NVL(mvt89,' ') ,NVL(mvt90,' ') ,NVL(mvt91,' ')
,NVL(\
89 mvt92,' ') ,NVL(mvt93,' ') ,NVL(mvt94,' ') ,NVL(mvt95,' ') ,NVL(mvt96,'
') ,NV\
90 L(mvt97,' ') ,NVL(mvt98,' ') ,NVL(mvt99,' ') from dsn_contentieux
order by c\
91 cd,ref
;
92
93

Dce over 15 years ago