Hi,
thanks for the ClearCase support with SQ 5.x.
I run locale analysis with activated SCM ClearCase plug-in and some of my targets could not be stored in SQ DB. I noticed that a checked-out file will create an exception and I have to disable SCM support for local analysis.
I am not sure whether https://jira.sonarsource.com/browse/SONARSCCLC-2 will solve this issue but I guess the option '-nco' could be used to handle this situation.
http://www.paperlined.org/dev/reference/clearcase_v4.0/annotate.html
HANDLING OF CHECKED-OUT VERSIONS. Default: An error occurs if you specify a checked-out version. (The type manager can annotate checked-in versions only.)
- -nco
- If you specify a checked-out version, annotate uses the version from which it was checked out.
Best regards
Bert
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: The ClearCase annotate command [cleartool annotate -out - -fmt VERSION:%Ln@@@USER:%u@@@DATE:%Nd@@@ -nheader -f src/resource.h] failed: cleartool: Error: Operation "annotate" unavailable for manager "_ms_word"
(Operation pathname was: "C:\IBM\RationalSDLC\ClearCase\lib\mgrs\_ms_word\annotate")
V:\XXX\sources\XXX>Test.bat
V:\XXX\sources\XXX>cleartool annotate \swapp\sources\XXX\XXXDisplayManagement\src\XXXHelper.h
cleartool: Error: You may not annotate a checked-out version (use no checkouts option): "\swapp\sources\XXX\XXXDisplayManagement\src\XXXHelper.h".
V:\XXX\sources\XXX>echo 1
1
V:\XXX\sources\XXX>cleartool annotate \swapp\sources\XXX\XXXDisplayManagement\src\XXXDisplayExceptions.cpp
Annotated result written to "\swapp\sources\XXX\XXXDisplayManagement\src\XXXDisplayExceptions.cpp.ann".
V:\XXX\sources\XXX>echo 0
0
10:24:33 ERROR: Caused by: The ClearCase annotate command [cleartool annotate -out - -fmt VERSION:%Ln@@@USER:%u@@@DATE:%Nd@@@ -nheader -f local/version.cs] failed: cleartool: Error: Not a vob object: "local/version.cs".
It would be beneficial if the plug in did not attempt to annotate files that were not a clearcase element - this could perhaps be done with a simple check at the start of the blame method (I don't have a java development environment otherwise I would just write the code and submit a pull request!)
private void blame(FileSystem fs, InputFile inputFile, BlameOutput output) {
String filename = inputFile.relativePath();
// new method to check if the file is a VOB object if (!IsVOBObject(filename) return; |
If it is not a VOB object, there will be no versioning info attached
What do you think? Maybe there is an alternative better way though?
Sorry for putting code in a post, as above, I don't have a java dev environment set up to build this,
thanks, Stu
I could not find any documentation on cleartool error codes but I found a short description of the CAL (ClearCase access library) which is not promising at all (see
http://www-01.ibm.com/support/docview.wss?uid=swg21149702). An additional command will increase the duration for the analysis and parsing stderr for "You may not annotate a checked-out version" might also be helpful.
Option 2 for me. Would not want to introduce performance issues or any other potential for errors. I think the likelihood of the error messages changing between versions of clearcase is reasonably low, and I don't believe the application is localised. We could always store the acceptable error messages in an external file that can be easily updated (or localised) if required.
Great stuff - this all works for me now and fixes my issue!
For some reason all of our annotations come out as the guy who did the merge, but I think this may be a problem our end with our clearcase config, so I'll go and investigate further
23:49:32.518 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@6d1c20f[id=2576,key=XXXX:XXXX:Dev,qualifier=TRK], with key batch-XXXX:XXXX:Dev
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 7:10.987s
Final Memory: 68M/3524M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: The ClearCase annotate command [cleartool annotate -out - -fmt VERSION:%Ln@@@USER:%u@@@DATE:%Nd@@@ -nheader -f src/XXXX.h] failed: cleartool: Error: You may not annotate a checked-out version (use no checkouts option): "src/XXXX.h".
at org.sonar.plugins.scm.clearcase.ClearCaseBlameCommand.blame(ClearCaseBlameCommand.java:70)
at org.sonar.plugins.scm.clearcase.ClearCaseBlameCommand.blame(ClearCaseBlameCommand.java:53)
at org.sonar.batch.scm.ScmSensor.execute(ScmSensor.java:84)
at org.sonar.batch.scan.SensorWrapper.analyse(SensorWrapper.java:59)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:59)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:51)
at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:120)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
...