ソースを参照

SONAR-14493 Add tutorial for .NET Core in Jenkins.

tags/8.8.0.42792
Mathieu Suen 3年前
コミット
b385d43a60
19個のファイルの変更699行の追加197行の削除
  1. 1
    1
      server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx
  2. 0
    6
      server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap
  3. 34
    59
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx
  4. 60
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx
  5. 57
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetFramework.tsx
  6. 60
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsMSBuild.tsx
  7. 66
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsScanner.tsx
  8. 36
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx
  9. 35
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx
  10. 30
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsMSBuild-test.tsx
  11. 30
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsScanner-test.tsx
  12. 17
    87
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap
  13. 61
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetCore-test.tsx.snap
  14. 33
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetFramework-test.tsx.snap
  15. 67
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsMSBuild-test.tsx.snap
  16. 75
    0
      server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsScanner-test.tsx.snap
  17. 1
    3
      server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx
  18. 1
    29
      server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap
  19. 35
    12
      sonar-core/src/main/resources/org/sonar/l10n/core.properties

+ 1
- 1
server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx ファイルの表示

@@ -69,7 +69,7 @@ export function JenkinsfileStep(props: JenkinsfileStepProps) {
name="buildtool"
onCheck={value => setBuildTool(value as BuildToolsWithoutCFamily)}
optionLabelKey="onboarding.build"
options={Object.values(BuildTools)}
options={Object.keys(BUILDTOOL_COMPONENT_MAP)}
/>
</li>
{buildTool !== undefined &&

+ 0
- 6
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/JenkinsfileStep-test.tsx.snap ファイルの表示

@@ -18,7 +18,6 @@ exports[`should render correctly for .NET 1`] = `
Array [
"maven",
"gradle",
"cfamily",
"dotnet",
"other",
]
@@ -140,7 +139,6 @@ exports[`should render correctly for Gradle 1`] = `
Array [
"maven",
"gradle",
"cfamily",
"dotnet",
"other",
]
@@ -262,7 +260,6 @@ exports[`should render correctly for Maven 1`] = `
Array [
"maven",
"gradle",
"cfamily",
"dotnet",
"other",
]
@@ -384,7 +381,6 @@ exports[`should render correctly for Other 1`] = `
Array [
"maven",
"gradle",
"cfamily",
"dotnet",
"other",
]
@@ -506,7 +502,6 @@ exports[`should render correctly with no branches 1`] = `
Array [
"maven",
"gradle",
"cfamily",
"dotnet",
"other",
]
@@ -637,7 +632,6 @@ exports[`should render correctly: initial content 1`] = `
Array [
"maven",
"gradle",
"cfamily",
"dotnet",
"other",
]

+ 34
- 59
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx ファイルの表示

@@ -18,73 +18,48 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import CodeSnippet from '../../../common/CodeSnippet';
import SentenceWithFilename from '../../components/SentenceWithFilename';
import SentenceWithHighlights from '../../components/SentenceWithHighlights';
import { translate } from 'sonar-ui-common/helpers/l10n';
import RenderOptions from '../../components/RenderOptions';
import { OSs } from '../../types';
import DotNetCore from './DotNetCore';
import DotNetFramework from './DotNetFramework';

export interface DotNetProps {
component: T.Component;
}

const jenkinsfileSnippet = (key: string) => `node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def msbuildHome = tool 'Default MSBuild'
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\""
bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild"
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end"
}
}
export interface DotNetCoreFrameworkProps {
component: T.Component;
os: OSDotNet;
}
`;

export type OSDotNet = OSs.Linux | OSs.Windows;

const DotNetFlavor = { win_core: DotNetCore, win_msbuild: DotNetFramework, linux_core: DotNetCore };
const DotOS: { [key in keyof typeof DotNetFlavor]: OSDotNet } = {
win_core: OSs.Windows,
win_msbuild: OSs.Windows,
linux_core: OSs.Linux
};

export default function DotNet({ component }: DotNetProps) {
const [flavorComponent, setFlavorComponet] = React.useState<keyof typeof DotNetFlavor>();
const DotNetTutorial = flavorComponent && DotNetFlavor[flavorComponent];
return (
<li className="abs-width-600">
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<Alert className="spacer-top" variant="info">
<p className="text-middle">
<SentenceWithHighlights
highlightKeys={['default_msbuild', 'default_scanner', 'in_jenkins']}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace"
/>
<HelpTooltip
className="little-spacer-left"
overlay={
<>
<p className="spacer-bottom">
<SentenceWithHighlights
highlightKeys={['path']}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1"
/>
</p>
<p className="spacer-bottom">
<SentenceWithHighlights
highlightKeys={['path', 'name']}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2"
/>
</p>
<p>
<SentenceWithHighlights
highlightKeys={['path', 'name']}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3"
/>
</p>
</>
}
/>
</p>
</Alert>
<CodeSnippet snippet={jenkinsfileSnippet(component.key)} />
</li>
<>
<li>
{translate('onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent')}
<RenderOptions
checked={flavorComponent}
name="flavorComponent"
optionLabelKey="onboarding.build.dotnet"
onCheck={value => setFlavorComponet(value as keyof typeof DotNetFlavor)}
options={Object.keys(DotNetFlavor)}
/>
</li>
{DotNetTutorial && flavorComponent && (
<DotNetTutorial component={component} os={DotOS[flavorComponent]} />
)}
</>
);
}

+ 60
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx ファイルの表示

@@ -0,0 +1,60 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import CodeSnippet from '../../../common/CodeSnippet';
import SentenceWithFilename from '../../components/SentenceWithFilename';
import { OSs } from '../../types';
import { DotNetCoreFrameworkProps, OSDotNet } from './DotNet';
import DotNetPrereqsScanner from './DotNetPrereqsScanner';

const OSS_DEP: { [key in OSDotNet]: { shell: string; pathSeparator: string } } = {
[OSs.Linux]: { shell: 'sh', pathSeparator: '/' },
[OSs.Windows]: { shell: 'bat', pathSeparator: '\\\\' }
};

const jenkinsfileSnippet = (key: string, shell: OSDotNet) => `node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
${OSS_DEP[shell].shell} "dotnet \${scannerHome}${OSS_DEP[shell].pathSeparator}SonarScanner.MSBuild.dll begin /k:\\"${key}\\""
${OSS_DEP[shell].shell} "dotnet build"
${OSS_DEP[shell].shell} "dotnet \${scannerHome}${OSS_DEP[shell].pathSeparator}SonarScanner.MSBuild.dll end"
}
}
}
`;

export default function DotNetCore({ component, os }: DotNetCoreFrameworkProps) {
return (
<>
<DotNetPrereqsScanner />
<li className="abs-width-600">
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<CodeSnippet snippet={jenkinsfileSnippet(component.key, os)} />
</li>
</>
);
}

+ 57
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetFramework.tsx ファイルの表示

@@ -0,0 +1,57 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import CodeSnippet from '../../../common/CodeSnippet';
import SentenceWithFilename from '../../components/SentenceWithFilename';
import { DotNetCoreFrameworkProps } from './DotNet';
import DotNetPrereqsMSBuild from './DotNetPrereqsMSBuild';
import DotNetPrereqsScanner from './DotNetPrereqsScanner';

const jenkinsfileSnippet = (key: string) => `node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def msbuildHome = tool 'Default MSBuild'
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\""
bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild"
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end"
}
}
}
`;

export default function DotNetFramework({ component }: DotNetCoreFrameworkProps) {
return (
<>
<DotNetPrereqsScanner />
<DotNetPrereqsMSBuild />
<li className="abs-width-600">
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<CodeSnippet snippet={jenkinsfileSnippet(component.key)} />
</li>
</>
);
}

+ 60
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsMSBuild.tsx ファイルの表示

@@ -0,0 +1,60 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';
import SentenceWithHighlights from '../../components/SentenceWithHighlights';

export default function DotNetPrereqsMSBuild() {
return (
<li className="abs-width-600">
<SentenceWithHighlights
highlightKeys={['default_msbuild']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title"
/>
<Alert className="spacer-top" variant="info">
{translate('onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info')}
</Alert>
<ul className="list-styled">
<li>
<SentenceWithHighlights
highlightKeys={['msbuild']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={['path']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={['msbuild', 'add_msbuild', 'name', 'msbuild_plugin']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3"
/>
<code className="rule">Default MSBuild</code>
<ClipboardIconButton copyValue="Default MSBuild" />
</li>
</ul>
</li>
);
}

+ 66
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetPrereqsScanner.tsx ファイルの表示

@@ -0,0 +1,66 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';
import SentenceWithHighlights from '../../components/SentenceWithHighlights';

export default function DotNetPrereqsScanner() {
return (
<li className="abs-width-600">
<SentenceWithHighlights
highlightKeys={['default_scanner']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title"
/>
<Alert className="spacer-top" variant="info">
{translate('onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info')}
</Alert>
<ul className="list-styled">
<li>
<SentenceWithHighlights
highlightKeys={['path']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={['default_scanner', 'add_scanner_for_msbuild']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={['name']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3"
/>
<code className="rule">SonarScanner for MSBuild</code>
<ClipboardIconButton copyValue="SonarScanner for MSBuild" />
</li>
<li>
<SentenceWithHighlights
highlightKeys={['install_from']}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5"
/>
</li>
</ul>
</li>
);
}

+ 36
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx ファイルの表示

@@ -0,0 +1,36 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import * as React from 'react';
import { mockComponent } from '../../../../../helpers/testMocks';
import { OSs } from '../../../types';
import { DotNetCoreFrameworkProps } from '../DotNet';
import DotNetCore from '../DotNetCore';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('win');
expect(shallowRender({ os: OSs.Linux })).toMatchSnapshot('linux');
});

function shallowRender(props: Partial<DotNetCoreFrameworkProps> = {}) {
return shallow<DotNetCoreFrameworkProps>(
<DotNetCore component={mockComponent()} os={OSs.Windows} {...props} />
);
}

+ 35
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx ファイルの表示

@@ -0,0 +1,35 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import * as React from 'react';
import { mockComponent } from '../../../../../helpers/testMocks';
import { OSs } from '../../../types';
import { DotNetCoreFrameworkProps } from '../DotNet';
import DotNetFramework from '../DotNetFramework';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
});

function shallowRender(props: Partial<DotNetCoreFrameworkProps> = {}) {
return shallow<DotNetCoreFrameworkProps>(
<DotNetFramework component={mockComponent()} os={OSs.Windows} {...props} />
);
}

+ 30
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsMSBuild-test.tsx ファイルの表示

@@ -0,0 +1,30 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import * as React from 'react';
import DotNetPrereqsMSBuild from '../DotNetPrereqsMSBuild';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
});

function shallowRender() {
return shallow(<DotNetPrereqsMSBuild />);
}

+ 30
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetPrereqsScanner-test.tsx ファイルの表示

@@ -0,0 +1,30 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import * as React from 'react';
import DotNetPrereqsScanner from '../DotNetPrereqsScanner';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
});

function shallowRender() {
return shallow(<DotNetPrereqsScanner />);
}

+ 17
- 87
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNet-test.tsx.snap ファイルの表示

@@ -1,91 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
<li
className="abs-width-600"
>
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<Alert
className="spacer-top"
variant="info"
>
<p
className="text-middle"
>
<SentenceWithHighlights
highlightKeys={
Array [
"default_msbuild",
"default_scanner",
"in_jenkins",
]
}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace"
/>
<HelpTooltip
className="little-spacer-left"
overlay={
<React.Fragment>
<p
className="spacer-bottom"
>
<SentenceWithHighlights
highlightKeys={
Array [
"path",
]
}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1"
/>
</p>
<p
className="spacer-bottom"
>
<SentenceWithHighlights
highlightKeys={
Array [
"path",
"name",
]
}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2"
/>
</p>
<p>
<SentenceWithHighlights
highlightKeys={
Array [
"path",
"name",
]
}
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3"
/>
</p>
</React.Fragment>
}
/>
</p>
</Alert>
<CodeSnippet
snippet="node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def msbuildHome = tool 'Default MSBuild'
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" begin /k:\\\\\\"my-project\\\\\\"\\"
bat \\"\\\\\\"\${msbuildHome}\\\\\\\\MSBuild.exe\\\\\\" /t:Rebuild\\"
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" end\\"
}
}
}
"
/>
</li>
<Fragment>
<li>
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent
<RenderOptions
name="flavorComponent"
onCheck={[Function]}
optionLabelKey="onboarding.build.dotnet"
options={
Array [
"win_core",
"win_msbuild",
"linux_core",
]
}
/>
</li>
</Fragment>
`;

+ 61
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetCore-test.tsx.snap ファイルの表示

@@ -0,0 +1,61 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly: linux 1`] = `
<Fragment>
<DotNetPrereqsScanner />
<li
className="abs-width-600"
>
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<CodeSnippet
snippet="node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
sh \\"dotnet \${scannerHome}/SonarScanner.MSBuild.dll begin /k:\\\\\\"my-project\\\\\\"\\"
sh \\"dotnet build\\"
sh \\"dotnet \${scannerHome}/SonarScanner.MSBuild.dll end\\"
}
}
}
"
/>
</li>
</Fragment>
`;

exports[`should render correctly: win 1`] = `
<Fragment>
<DotNetPrereqsScanner />
<li
className="abs-width-600"
>
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<CodeSnippet
snippet="node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
bat \\"dotnet \${scannerHome}\\\\\\\\SonarScanner.MSBuild.dll begin /k:\\\\\\"my-project\\\\\\"\\"
bat \\"dotnet build\\"
bat \\"dotnet \${scannerHome}\\\\\\\\SonarScanner.MSBuild.dll end\\"
}
}
}
"
/>
</li>
</Fragment>
`;

+ 33
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetFramework-test.tsx.snap ファイルの表示

@@ -0,0 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
<Fragment>
<DotNetPrereqsScanner />
<DotNetPrereqsMSBuild />
<li
className="abs-width-600"
>
<SentenceWithFilename
filename="Jenkinsfile"
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step"
/>
<CodeSnippet
snippet="node {
stage('SCM') {
checkout scm
}
stage('SonarQube Analysis') {
def msbuildHome = tool 'Default MSBuild'
def scannerHome = tool 'SonarScanner for MSBuild'
withSonarQubeEnv() {
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" begin /k:\\\\\\"my-project\\\\\\"\\"
bat \\"\\\\\\"\${msbuildHome}\\\\\\\\MSBuild.exe\\\\\\" /t:Rebuild\\"
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" end\\"
}
}
}
"
/>
</li>
</Fragment>
`;

+ 67
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsMSBuild-test.tsx.snap ファイルの表示

@@ -0,0 +1,67 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
<li
className="abs-width-600"
>
<SentenceWithHighlights
highlightKeys={
Array [
"default_msbuild",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title"
/>
<Alert
className="spacer-top"
variant="info"
>
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info
</Alert>
<ul
className="list-styled"
>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"msbuild",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"path",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"msbuild",
"add_msbuild",
"name",
"msbuild_plugin",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3"
/>
<code
className="rule"
>
Default MSBuild
</code>
<ClipboardIconButton
copyValue="Default MSBuild"
/>
</li>
</ul>
</li>
`;

+ 75
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/__snapshots__/DotNetPrereqsScanner-test.tsx.snap ファイルの表示

@@ -0,0 +1,75 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
<li
className="abs-width-600"
>
<SentenceWithHighlights
highlightKeys={
Array [
"default_scanner",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title"
/>
<Alert
className="spacer-top"
variant="info"
>
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info
</Alert>
<ul
className="list-styled"
>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"path",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"default_scanner",
"add_scanner_for_msbuild",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"name",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3"
/>
<code
className="rule"
>
SonarScanner for MSBuild
</code>
<ClipboardIconButton
copyValue="SonarScanner for MSBuild"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"install_from",
]
}
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5"
/>
</li>
</ul>
</li>
`;

+ 1
- 3
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx ファイルの表示

@@ -23,9 +23,7 @@ import { OSs } from '../../../types';
import Other, { OtherProps } from '../Other';

it('renders correctly', () => {
expect(shallowRender()).toMatchSnapshot('linux');
expect(shallowRender({ os: OSs.Windows })).toMatchSnapshot('windows');
expect(shallowRender({ os: OSs.MacOS })).toMatchSnapshot('macos');
expect(shallowRender()).toMatchSnapshot();
});

function shallowRender(props: Partial<OtherProps> = {}) {

+ 1
- 29
server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/__snapshots__/Other-test.tsx.snap ファイルの表示

@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly: linux 1`] = `
exports[`renders correctly 1`] = `
<div>
<SQScanner
os="linux"
@@ -13,31 +13,3 @@ exports[`renders correctly: linux 1`] = `
/>
</div>
`;

exports[`renders correctly: macos 1`] = `
<div>
<SQScanner
os="mac"
/>
<ExecScanner
host="host"
os="mac"
projectKey="projectKey"
token="token"
/>
</div>
`;

exports[`renders correctly: windows 1`] = `
<div>
<SQScanner
os="win"
/>
<ExecScanner
host="host"
os="win"
projectKey="projectKey"
token="token"
/>
</div>
`;

+ 35
- 12
sonar-core/src/main/resources/org/sonar/l10n/core.properties ファイルの表示

@@ -3304,6 +3304,9 @@ onboarding.build.maven=Maven
onboarding.build.gradle=Gradle
onboarding.build.make=Make
onboarding.build.dotnet=.NET
onboarding.build.dotnet.win_core=Windows + .NET Core
onboarding.build.dotnet.win_msbuild=Windows + .NET Framework
onboarding.build.dotnet.linux_core=Linux + .NET Core
onboarding.build.cfamily=C,C++ or ObjC
onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...)

@@ -3575,18 +3578,38 @@ onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence=The name
onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.path=Maven > Maven installations
onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.name=Name
onboarding.tutorial.with.jenkins.jenkinsfile.gradle.step2.sentence=Add the following to your {file} file:
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence=Make sure to replace {default_msbuild} and {default_scanner} with the names you gave to your MSBuild and SonarScanner for MSBuild tools {in_jenkins}.
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_msbuild=Default MSBuild
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_scanner=SonarScanner for MSBuild
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.in_jenkins=in Jenkins
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence=To get the name of these tools in Jenkins, navigate to {path}.
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence.path=Manage Jenkins > Global Tool Configuration
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence=For your MSBuild tool, the name is located under the {path} section, in the {name} field.
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.path=MSBuild > MSBuild installations
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.name=Name
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence=For your SonarScanner for MSBuild tool, the name is located under the {path} section, in the {name} field.
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.path=SonarScanner for MSBuild > SonarScanner for MSBuild installations
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.name=Name
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent=Choose your build agent.

onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title.sentence=Prerequisite: Add a {default_msbuild} tool
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title.sentence.default_msbuild=MSBuild
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info=This step need to be done only once per jenkins instance.
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1.sentence=In Jenkins, make sure to have the {msbuild} installed.
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1.sentence.msbuild=MSBuild Plugin
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2.sentence=Navigate to {path}.
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2.sentence.path=Manage Jenkins > Global Tool Configuration
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence=Under {msbuild} click on {add_msbuild} and give a {name} that will be used in the last step. Refer to the {msbuild_plugin} documentation on how to install the tool:
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.msbuild=MSBuild
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.msbuild_plugin=MSBuild Plugin
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.add_msbuild=Add MSBuild
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.name=Name


onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title.sentence=Prerequisite: Add a {default_scanner} tool
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title.sentence.default_scanner=SonarScanner for MSBuild
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info=This step needs to be done only once per jenkins instance or if you need different scanner versions.
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1.sentence=In Jenkins, navigate to {path}.
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1.sentence.path=Manage Jenkins > Global Tool Configuration
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence=Under {default_scanner} click on {add_scanner_for_msbuild}
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence.default_scanner=SonarScanner for MSBuild
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence.add_scanner_for_msbuild=Add SonarScanner for MSBuild
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3.sentence=Choose a {name} that will be used in the last step:
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3.sentence.name=Name
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step4.sentence=Check {install_auto}
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step4.sentence.install_auto=Install automatically
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence=Under {install_from} select the corresponding .NET Core scanner required for you project.
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence.install_from=Install from GitHub
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence.install_auto=Install automatically

onboarding.tutorial.with.jenkins.jenkinsfile.other.step2.sentence=Create a {file} file in your repository and paste the following code:
onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence=Make sure to replace {default} with the name you gave to your SonarQube Scanner tool {in_jenkins}.
onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence.default=SonarScanner

読み込み中…
キャンセル
保存