Example #1
0
    def report(self):
        """Execute the SonarQube Scanner.

        Returns according to the successful of the analysis:

            * ``GNAThub.EXEC_SUCCESS``: on successful execution and analysis
            * ``GNAThub.EXEC_FAILURE``: on any error
        """
        return GNAThub.EXEC_SUCCESS if GNAThub.Run(
            self.name, self.__cmd_line(), workdir=SonarQube.workdir()
        ).status == 0 else GNAThub.EXEC_FAILURE
Example #2
0
    def report(self):
        """Execute the SonarQube Scanner.

        Returns according to the successful of the analysis:

            * ``GNAThub.EXEC_SUCCESS``: on successful execution and analysis
            * ``GNAThub.EXEC_FAILURE``: on any error
        """
        return GNAThub.EXEC_SUCCESS if GNAThub.Run(
            self.name, self.__cmd_line(),
            workdir=SonarQube.workdir()).status == 0 else GNAThub.EXEC_FAILURE
Example #3
0
    def __cmd_line():
        """Return command line for sonar scanner execution.

        :return: the SonarQube Scanner command line
        :rtype: collections.Iterable[str]
        """
        # Enable verbose and debugging output with -e and -X. This is handy for
        # debugging in case of issue in the SonarScanner step.

        sonarqube_conf = SonarQube.configuration()
        if platform.system() == 'Windows':
            if (" " in sonarqube_conf):
                sonarqube_conf = "/".join(sonarqube_conf.split("\\"))
                sonarqube_conf = sonarqube_conf.replace(' ', "\ ")
                sonarqube_conf = '\"' + SonarQube.configuration() + '\"'

        cmdline = [
            'sonar-scanner', '-e', '-X',
            '-Dproject.settings={}'.format(sonarqube_conf)
        ]
        return cmdline
Example #4
0
    def run(self):
        """Generate SonarQube Scanner configuration file."""

        self.info('generate %s' % SonarQube.CONFIGURATION)
        try:
            SonarScannerProperties(self.log).write(SonarQube.configuration())
        except IOError as why:
            self.log.exception(
                'SonarQube Scanner configuration generation failed')
            self.error(str(why))
            return GNAThub.EXEC_FAILURE
        else:
            return GNAThub.EXEC_SUCCESS
Example #5
0
    def run(self):
        """Generate SonarQube Scanner configuration file."""

        self.info('generate %s' % SonarQube.CONFIGURATION)
        try:
            SonarScannerProperties(self.log).write(SonarQube.configuration())
        except IOError as why:
            self.log.exception(
                'SonarQube Scanner configuration generation failed')
            self.error(str(why))
            return GNAThub.EXEC_FAILURE
        else:
            return GNAThub.EXEC_SUCCESS
Example #6
0
    def __cmd_line():
        """Return command line for sonar scanner execution.

        :return: the SonarQube Scanner command line
        :rtype: collections.Iterable[str]
        """
        # Enable verbose and debugging output with -e and -X. This is handy for
        # debugging in case of issue in the SonarScanner step.
        cmdline = [
            'sonar-scanner', '-e', '-X',
            '-Dproject.settings={}'.format(SonarQube.configuration())
        ]
        if platform.system() == 'Windows':
            return ['cmd', '/c', ' '.join(cmdline)]
        return cmdline
Example #7
0
    def __cmd_line():
        """Return command line for sonar scanner execution.

        :return: the SonarQube Scanner command line
        :rtype: collections.Iterable[str]
        """
        # Enable verbose and debugging output with -e and -X. This is handy for
        # debugging in case of issue in the SonarScanner step.
        cmdline = [
            'sonar-scanner', '-e', '-X',
            '-Dproject.settings={}'.format(SonarQube.configuration())
        ]
        if platform.system() == 'Windows':
            return ['cmd', '/c', ' '.join(cmdline)]
        return cmdline
Example #8
0
 def setup(self):
     super(SonarConfig, self).setup()
     SonarQube.make_workdir()
Example #9
0
 def setup(self):
     # Do not call the super method: we do not need a database session to be
     # opened.
     SonarQube.make_workdir()
Example #10
0
 def setup(self):
     # Do not call the super method: we do not need a database session to be
     # opened.
     SonarQube.make_workdir()
Example #11
0
 def setup(self):
     super(SonarConfig, self).setup()
     SonarQube.make_workdir()