Sonar projects fail in Jenkins on generated files

classic Classic list List threaded Threaded
6 messages Options
tux
Reply | Threaded
Open this post in threaded view
|

Sonar projects fail in Jenkins on generated files

tux
Hello from the Netherlands

We've been using Sonar for a long time now, and after the upgrade to
Sonar-5.0.1 (I skipped 5.0), we see the analysis crashes on generated
files.

We have a big java project that builds in a chain of tasks where it
generated (java) source files that are to be used later in the build
process based on configurations and/or used database types. The java
files that are generated are not committed in git, our VCS.

That project now fails:

[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project
basisgemeente-parent: Unable to blame file
src/main/java/nl/messagedesign/dbuam0100gen/InitialisatieMetamodelDbUAM0100.java.
No blame info at line 1. Is file commited? -> [Help 1]

Of course, these files are not committed in git, but we *DO* want them
analyzed so the generator can be improved.

This still worked in Sonar-4.5.2

--
H.Merijn Brand    [hidden email]   (072) 567 13 51
PROCURA B.V.    http://www.procura.nl    KvK 37140650
Ban de e-mail disclaimers:  http://tinyurl.com/kmne65

attachment0 (501 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sonar projects fail in Jenkins on generated files

topagae
Having this problem as well. Issue is that Sonar automatically fails it if it isn't committed. I'd suggest not generating them if you can

On Mon, Mar 2, 2015 at 10:12 AM, H.Merijn Brand <[hidden email]> wrote:
Hello from the Netherlands

We've been using Sonar for a long time now, and after the upgrade to
Sonar-5.0.1 (I skipped 5.0), we see the analysis crashes on generated
files.

We have a big java project that builds in a chain of tasks where it
generated (java) source files that are to be used later in the build
process based on configurations and/or used database types. The java
files that are generated are not committed in git, our VCS.

That project now fails:

[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project
basisgemeente-parent: Unable to blame file
src/main/java/nl/messagedesign/dbuam0100gen/InitialisatieMetamodelDbUAM0100.java.
No blame info at line 1. Is file commited? -> [Help 1]

Of course, these files are not committed in git, but we *DO* want them
analyzed so the generator can be improved.

This still worked in Sonar-4.5.2

--
H.Merijn Brand    [hidden email]   (072) 567 13 51
PROCURA B.V.    http://www.procura.nl    KvK 37140650
Ban de e-mail disclaimers:  http://tinyurl.com/kmne65

Reply | Threaded
Open this post in threaded view
|

AW: [sonar-user] Sonar projects fail in Jenkins on generated files

Christian Schulz-2

It would be also possible to disable the scm sensor for that component.

It is not a real solution but this should prevent failing the analysis.

 

Von: Chris Lee [mailto:[hidden email]]
Gesendet: Montag, 2. März 2015 22:24
An: [hidden email]
Betreff: Re: [sonar-user] Sonar projects fail in Jenkins on generated files

 

Having this problem as well. Issue is that Sonar automatically fails it if it isn't committed. I'd suggest not generating them if you can

 

On Mon, Mar 2, 2015 at 10:12 AM, H.Merijn Brand <[hidden email]> wrote:

Hello from the Netherlands

We've been using Sonar for a long time now, and after the upgrade to
Sonar-5.0.1 (I skipped 5.0), we see the analysis crashes on generated
files.

We have a big java project that builds in a chain of tasks where it
generated (java) source files that are to be used later in the build
process based on configurations and/or used database types. The java
files that are generated are not committed in git, our VCS.

That project now fails:

[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project
basisgemeente-parent: Unable to blame file
src/main/java/nl/messagedesign/dbuam0100gen/InitialisatieMetamodelDbUAM0100.java.
No blame info at line 1. Is file commited? -> [Help 1]

Of course, these files are not committed in git, but we *DO* want them
analyzed so the generator can be improved.

This still worked in Sonar-4.5.2

--
H.Merijn Brand    [hidden email]   (072) 567 13 51
PROCURA B.V.    http://www.procura.nl    KvK 37140650
Ban de e-mail disclaimers:  http://tinyurl.com/kmne65

 

Reply | Threaded
Open this post in threaded view
|

Re: Sonar projects fail in Jenkins on generated files

Timothy McNally
I have run into the same issue and posted a question previously. Here is the response from Julien HENRY @ sonarsource
This is not possible in 5.0. We have relaxed this constrint in upcoming 5.1 but still in most cases we think analysis of generated code is useless.

On Mon, Mar 2, 2015 at 11:39 PM, Christian Schulz <[hidden email]> wrote:

It would be also possible to disable the scm sensor for that component.

It is not a real solution but this should prevent failing the analysis.

 

Von: Chris Lee [mailto:[hidden email]]
Gesendet: Montag, 2. März 2015 22:24
An: [hidden email]
Betreff: Re: [sonar-user] Sonar projects fail in Jenkins on generated files

 

Having this problem as well. Issue is that Sonar automatically fails it if it isn't committed. I'd suggest not generating them if you can

 

On Mon, Mar 2, 2015 at 10:12 AM, H.Merijn Brand <[hidden email]> wrote:

Hello from the Netherlands

We've been using Sonar for a long time now, and after the upgrade to
Sonar-5.0.1 (I skipped 5.0), we see the analysis crashes on generated
files.

We have a big java project that builds in a chain of tasks where it
generated (java) source files that are to be used later in the build
process based on configurations and/or used database types. The java
files that are generated are not committed in git, our VCS.

That project now fails:

[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project
basisgemeente-parent: Unable to blame file
src/main/java/nl/messagedesign/dbuam0100gen/InitialisatieMetamodelDbUAM0100.java.
No blame info at line 1. Is file commited? -> [Help 1]

Of course, these files are not committed in git, but we *DO* want them
analyzed so the generator can be improved.

This still worked in Sonar-4.5.2

--
H.Merijn Brand    [hidden email]   (072) 567 13 51
PROCURA B.V.    http://www.procura.nl    KvK 37140650
Ban de e-mail disclaimers:  http://tinyurl.com/kmne65

 

Reply | Threaded
Open this post in threaded view
|

Re: Sonar projects fail in Jenkins on generated files

topagae
You never know who wrote the code to generate the code. Could be bad code. Why not analyze it?

On Tue, Mar 3, 2015 at 9:33 AM, Timothy McNally <[hidden email]> wrote:
I have run into the same issue and posted a question previously. Here is the response from Julien HENRY @ sonarsource
This is not possible in 5.0. We have relaxed this constrint in upcoming 5.1 but still in most cases we think analysis of generated code is useless.

On Mon, Mar 2, 2015 at 11:39 PM, Christian Schulz <[hidden email]> wrote:

It would be also possible to disable the scm sensor for that component.

It is not a real solution but this should prevent failing the analysis.

 

Von: Chris Lee [mailto:[hidden email]]
Gesendet: Montag, 2. März 2015 22:24
An: [hidden email]
Betreff: Re: [sonar-user] Sonar projects fail in Jenkins on generated files

 

Having this problem as well. Issue is that Sonar automatically fails it if it isn't committed. I'd suggest not generating them if you can

 

On Mon, Mar 2, 2015 at 10:12 AM, H.Merijn Brand <[hidden email]> wrote:

Hello from the Netherlands

We've been using Sonar for a long time now, and after the upgrade to
Sonar-5.0.1 (I skipped 5.0), we see the analysis crashes on generated
files.

We have a big java project that builds in a chain of tasks where it
generated (java) source files that are to be used later in the build
process based on configurations and/or used database types. The java
files that are generated are not committed in git, our VCS.

That project now fails:

[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project
basisgemeente-parent: Unable to blame file
src/main/java/nl/messagedesign/dbuam0100gen/InitialisatieMetamodelDbUAM0100.java.
No blame info at line 1. Is file commited? -> [Help 1]

Of course, these files are not committed in git, but we *DO* want them
analyzed so the generator can be improved.

This still worked in Sonar-4.5.2

--
H.Merijn Brand    [hidden email]   (072) 567 13 51
PROCURA B.V.    http://www.procura.nl    KvK 37140650
Ban de e-mail disclaimers:  http://tinyurl.com/kmne65

 


Reply | Threaded
Open this post in threaded view
|

Re: Sonar projects fail in Jenkins on generated files

Julien HENRY

2015-03-03 19:58 GMT+01:00 Chris Lee <[hidden email]>:
Could be bad code. Why not analyze it?

Because most of the time generated code do not follow same coding practice than hand-written code. Efficiency can be preferred to maintainability. Naming convention/formatting can be different. No documentation.

As I said in 5.1 it will no more fail on uncommited files, but some SQ features will not be available because of missing blame (like auto-assignment of issues).

++