Giter Club home page Giter Club logo

gulp-sonar's People

Contributors

ashleyconnor avatar carloshpds avatar machellerogden avatar nandoofz avatar nuphoff avatar prayerslayer avatar roxus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-sonar's Issues

Can we exclude files?

Just wondering if there is a way to exclude files? the sources property in the options only allows for which files to include. This can get messy if I have to include all the files since there are only a few i want to exclude.

Fix missing dependencies and folder

When I run gulp-sonar I get an error that node couldn't find the module through2, because it is missing in your package.json.

Also when gulp-sonar tries to write its sonar-runner.properties it fails miserably because the directory conf is missing.

PR will follow.

Cryptic Sonar Log Output in Jenkins

I have this cryptic output in jenkins when then sonar is running.

[13:33:06] Using gulpfile /var/jenkins_home/workspace/webapp/webapp_build/gulpfile.js
[13:33:06] Starting 'sonar'...
[13:33:06] <Buffer 53 6f 6e 61 72 51 75 62 65 20 52 75 6e 6e 65 72 20 32 2e 34 0a>
[13:33:06] <Buffer 4a 61 76 61 20 31 2e 38 2e 30 5f 37 32 2d 69 6e 74 65 72 6e 61 6c 20 4f 72 61 63 6c 65 20 43 6f 72 70 6f 72 61 74 69 6f 6e 20 28 36 34 2d 62 69 74 29 ... >
[13:33:07] <Buffer 49 4e 46 4f 3a 20 57 6f 72 6b 20 64 69 72 65 63 74 6f 72 79 3a 20 2f 76 61 72 2f 6a 65 6e 6b 69 6e 73 5f 68 6f 6d 65 2f 77 6f 72 6b 73 70 61 63 65 2f ... >
[13:33:07] <Buffer 49 4e 46 4f 3a 20 53 6f 6e 61 72 51 75 62 65 20 53 65 72 76 65 72 20 35 2e 36>
[13:33:07] <Buffer 0a

when I redirect to sonar runner output to file and take a look at the file I see correct message.

This is my config

const gulp      = require('gulp');
const sonar     = require('gulp-sonar');
const filter    = require('gulp-filter');
const util      = require('gulp-util');


var pkg = require('../package.json');

gulp.task('sonar', function () {

    var options = {
        sonar: {
            host: {
                url: process.env.SONAR_HOST_URL
            },
            jdbc: {
                url: process.env.SONAR_JDBC_URL,
                username: process.env.SONAR_JDBC_USERNAME,
                password: process.env.SONAR_JDBC_PASSWORD
            },
            projectKey: pkg.name,
            projectName: pkg.name,
            projectVersion: pkg.version,
            // comma-delimited string of source directories 
            sources: 'app,tests, e2e-tests',
            language: 'js',
            sourceEncoding: 'UTF-8',
            /*javascript: {
                lcov: {
                    reportPath: 'test-reports/coverage'
                }
            },
            genericcoverage: {
                unitTestReportPaths: 'test-reports'
            },*/
            exec: {
                // All these properties will be send to the child_process.exec method (see: https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback ) 
                // Increase the amount of data allowed on stdout or stderr (if this value is exceeded then the child process is killed, and the gulp-sonar will fail). 
                maxBuffer : 1024*4096
            }
        }
    };

    // gulp source doesn't matter, all files are referenced in options object above 
    return gulp.src('README.md', { read: false })
        .pipe(sonar(options))

        .on('error', util.log);
});

Sonar failing because directory contais spaces

As referenced in issue #12 the fix prevents some bugs from happening when sonar is executed if the directory contains spaces, but it seems that it was merged more than one year ago and not released.

So my question is: why it was not released? If not, will it be? And if it was, why the fix was removed?

Cannot find JS plugin

[09:20:18] ERROR: Error during Sonar runner execution

[09:20:18] 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)

[09:20:18]  at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
[09:20:18] 
    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)

[09:20:18]  at org.sonar.runner.Main.executeTask(Main.java:70)
[09:20:18] 
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: You must install a plugin that supports the language 'js'
[09:20:18] 

[09:20:18] Return code: 1.

/Users/ … /node_modules/gulp-sonar/index.js:73
                        throw new PluginError('gulp-sonar', format('Return code: %d.', code));
                        ^
Error: Return code: 1.

Configuration from gulpfile:


            var options = {
                sonar: {
                    host: {
                        url: 'https://internal/sonar/'
                    },
                    /*
                    jdbc: {
                        url: 'jdbc:mysql://localhost:3306/sonar',
                        username: 'sonar',
                        password: 'sonar'
                    },
                    */
                    projectKey: 'com.stuff:2.0.0-rc1',
                    projectName: 'Stuff 2.0',
                    projectVersion: '2.0.0-rc1',
                    // comma-delimited string of source directories
                    sources: 'dist/js,test/',
                    language: 'js',
                    sourceEncoding: 'UTF-8',
                    javascript: {
                        lcov: {
                            reportPath: 'reports/sonar/lcov/lcov.info'
                        }
                    },
                    exec: {
                        // All these properties will be send to the child_process.exec method (see: https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback )
                        // Increase the amount of data allowed on stdout or stderr (if this value is exceeded then the child process is killed, and the gulp-sonar will fail).
                        maxBuffer: 1024 * 1024
                    }
                }
            };

I tried setting language to 'javascript', but had the same problem. Setting it to 'java' successfully created a report and uploaded to our Sonar server, but of course everything was 0.

How can I augment a property on the gulp command line?

In the Maven SonarQube plugin and the command-line "sonar-scanner" tool, I can set the "sonar.branch" property, and that will use the legacy branching mechanism in SonarQube to use a project with the branch name appended to the project key and name, with a space between.

This Gulp plugin doesn't appear to do that, so I guess I'll have to dynamically set the project key and name properties to reflect the branch in use. I see how the "projectKey" and "projectName" properties are set in the "gulpfile.js" file, but I will need to set these properties on the "gulp sonarscan" command line. In fact, I have to more than set them, I have to simply append a value to them. How can I do this from the "gulp sonarscan" command line?

Unsupported major.minor version 52.0

I'm getting this error:

java.lang.UnsupportedClassVersionError:
org/sonarsource/scanner/cli/Main : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.sonarsource.scanner.cli.Main. Program will exit.

Then I tried to logging the SONAR_SCANNER_COMMAND and running it manually and everything went fine.

Breaking when exit code equals null

Using gulp-sonar in a c++ project using c++ community plugin for SonarQube, the execution breaks because the code on exit process is null

Return code 1 in gulp-sonar 3.0.0

I have gulp-sonar 3.0.0 with Sonarqube 5.3 and JavaScript plugin version 2.10.we get the following error in our build scripts:

11:42:44] 11:42:44.510 ERROR: Error during SonarQube Scanner execution

[11:42:44] java.lang.IllegalStateException: Report processing is taking longer than the configured wait limit.
at org.sonar.plugins.buildbreaker.QualityGateBreaker.getAnalysisId(QualityGateBreaker.java:165)
at org.sonar.plugins.buildbreaker.QualityGateBreaker.execute(QualityGateBreaker.java:108)

[11:42:44] Return code: 1.

/development/workspace/<PROJECT_NAME>/node_modules/gulp-sonar/index.js:74
throw new PluginError('gulp-sonar', format('Return code: %d.', code));
^
Error: Return code: 1.

Prerequisite

What are the prerequisites required in order to run it successfully? Do I need sonar runner installed on my system?
I want to run it along with my gulp build to catch JS Sonar violations beforehand.

TS sonar options supported?

i am using gulp-sonar to run on typescript files.
Are there ways for me to use options such as ts.tslint.typeCheck and ts.tslint.projectPath?
for example

sonar: { 
ts: {
              tslintpath: TSLINTPATH,
              tslint: {
                projectPath: 'tsconfig.json',
                configPath: 'tslint.json',
                typeCheck: true
              },
....

the projectPath, configPath and typeCheck options are used as SonarTsPlugin described to resolve a warning issue with a TS rule. Pablissimo/SonarTsPlugin#158

I see the debug info when I run gulp-sonar is that the command to execute tslint is:
Executing TsLint with command: /node_modules/tslint/bin/tslint --format json --config tslint.json followed by the list of files. So it seems to be ignoring the ts.tslint rules I have.

The expected/preferred command to run with those parameters defined would be:
/node_modules/tslint/bin/tslint --type-check --project tsconfig.json -c tslint.json

anyway I can achieve this using gulp-sonar still?

Return code 1 after upgrade to 2.1.2

After the release of version 2.1.2 we get the following error in our build scripts:

<Buffer 27 73 68 27 20 69 73 20 6e 6f 74 20 72 65 63 6f 67 6e 69 7a 65 64 20 61 73 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 6f 72 20 65 78 74 65 72 6e 61 6c 20 ... >
Return code: 1.
D:\work\86\s\node_modules\gulp-sonar\index.js:84
             throw new PluginError('gulp-sonar', format('Return code: %d.', code));
             ^
Error: Return code: 1.

Works fine with version 2.1.0. But fails with version 2.1.1 / 2.1.2. Sonar version is 5.6, JavaScript plugin 2.14 (Analysis is for a JS file).

SonarQube 6.3 with proxy

Is this package working with the latest version of SonarQube (version 6.3)? If yes, I would like to know how to set a proxy for Sonar where I only need the host url because there is no configuration for jdbc, user and password.

Thank's

Documentation of configuration

Hello

Can you explain in a tiny doc the aim of each of the configuration options ? I did not understand why we have to configure a jdbc access ? What' s the purpose of this conf ?

Thank you

Help needed: "ReferenceError: sonar is not defined" error

I put exactly the same code for sonar task in my gulpfile.js file:

gulp.task('sonar', function () {
    var options = {
        sonar: {
            host: {
                url: 'http://localhost:9000'
            },
            projectKey: 'conn-ui',
            projectName: 'Conn App UI',
            //projectVersion: '1.0.0',
            // comma-delimited string of source directories 
            sources: 'app/js,app/lib',
            language: 'js',
            sourceEncoding: 'UTF-8',
            javascript: {
                lcov: {
                    reportPath: 'test/sonar_report/lcov.info'
                }
            },
            exec: {
                // All these properties will be send to the child_process.exec method (see: https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback ) 
                // Increase the amount of data allowed on stdout or stderr (if this value is exceeded then the child process is killed, and the gulp-sonar will fail). 
                maxBuffer : 1024*1024
            }
        }
    };

    // gulp source doesn't matter, all files are referenced in options object above 
    return gulp.src('thisFileDoesNotExist.js', { read: false })
        .pipe(sonar(options))
        .on('error', util.log);
});

However I always get the following error messages when I invoke gulp sonar command:

using args { _: [ 'sonar' ], env: 'local-java', e: 'local-java' }
[15:36:54] Using gulpfile ~/p/conn/ui/app/gulpfile.js
[15:36:54] Starting 'sonar'...
[15:36:54] 'sonar' errored after 7.8 ms
[15:36:54] ReferenceError: sonar is not defined
    at Gulp.<anonymous> (/home/luog/p/conn/ui/app/gulpfile.js:495:15)
    at module.exports (/home/luog/p/conn/ui/app/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/home/luog/p/conn/ui/app/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/home/luog/p/conn/ui/app/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/home/luog/p/conn/ui/app/node_modules/orchestrator/index.js:134:8)
    at /usr/lib/node_modules/gulp/bin/gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Function.Module.runMain (module.js:449:11)
    at startup (node.js:148:18)
    at node.js:405:3

Do you know where I am wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.