Skip to content

Commit

Permalink
Some style changes with codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
Reamer committed Mar 17, 2020
1 parent 36187f9 commit 5f457c5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
Expand Up @@ -23,15 +23,31 @@ import React from "react";
import { DeferredSpinner } from "sonar-components";
import { getJSON } from "sonar-request";

export function findDependencyCheckReport(options) {
return getJSON("/api/measures/component", {
component : options.component.key,
metricKeys : "report"
}).then(function(response) {
var report = response.component.measures.find((measure) => {
return measure.metric === "report";
});
if (typeof report === "undefined") {
return "<center><h2>No HTML-Report found. Please check property sonar.dependencyCheck.htmlReportPath</h2></center>";
} else {
return report.value;
}
});
}

export default class DependencyCheckReportApp extends React.PureComponent {
state = {
loading: true,
data: [],
data: "",
height: 0,
};

componentDidMount() {
findDependencyCheckReport(this.props.options).then(data => {
findDependencyCheckReport(this.props.options).then((data) => {
this.setState({
loading: false,
data
Expand All @@ -55,8 +71,8 @@ export default class DependencyCheckReportApp extends React.PureComponent {
// 72px SonarQube common pane
// 72px SonarQube project pane
// 145,5 SonarQube footer
let update_height = window.innerHeight - (72 + 48 + 145.5);
this.setState({ height: update_height });
let updateHeight = window.innerHeight - (72 + 48 + 145.5);
this.setState({ height: updateHeight });
}

render() {
Expand All @@ -65,20 +81,7 @@ export default class DependencyCheckReportApp extends React.PureComponent {
}

return (<div className="page dependency-check-report-container" >
<iframe classsandbox="allow-scripts allow-same-origin" height={this.state.height} srcdoc={this.state.data} style={{border: 'none'}} />
<iframe classsandbox="allow-scripts allow-same-origin" height={this.state.height} srcdoc={this.state.data} style={{border: "none"}} />
</div>);
}
}
export function findDependencyCheckReport(options) {
return getJSON("/api/measures/component", {
component : options.component.key,
metricKeys : "report"
}).then(function(response) {
var report = response.component.measures.find(measure => measure.metric === "report");
if (report !== undefined) {
return report.value
} else {
return "<center><h2>No HTML-Report found. Please check property sonar.dependencyCheck.htmlReportPath</h2></center>"
}
});
}
Expand Up @@ -19,11 +19,11 @@
*/
import React from "react";
import DependencyCheckReportApp from "./components/DependencyCheckReportApp";
import '../style.css';
import "../style.css";

// This creates a page for dependencycheck, which shows a html report

// You can access it at /project/extension/dependencycheck/report_page?id={PORTFOLIO_ID}&qualifier=VW
window.registerExtension("dependencycheck/report_page", options => {
window.registerExtension("dependencycheck/report_page", (options) => {
return <DependencyCheckReportApp options={options} />;
});
Expand Up @@ -29,7 +29,7 @@
class DependencyCheckReportPageTest {

@Test
void testPage() {
public void testPage() {
DependencyCheckReportPage reportPage = new DependencyCheckReportPage();
Context context = new Context();
reportPage.define(context);
Expand Down

0 comments on commit 5f457c5

Please sign in to comment.