Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DON'T REVIEW] Testing Sonar configurations #222

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/suite-base/src/components/PlaybackControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
useMessagePipeline,
} from "@lichtblick/suite-base/components/MessagePipeline";
import PlaybackSpeedControls from "@lichtblick/suite-base/components/PlaybackSpeedControls";
import ProblematicComponent from "@lichtblick/suite-base/components/ProblematicComponent/ProblematicComponent";
import Stack from "@lichtblick/suite-base/components/Stack";
import { useCurrentUser } from "@lichtblick/suite-base/context/BaseUserContext";
import { EventsStore, useEvents } from "@lichtblick/suite-base/context/EventsContext";
Expand Down Expand Up @@ -190,6 +191,7 @@ export default function PlaybackControls(props: {

return (
<>
<ProblematicComponent userName=""></ProblematicComponent>
<RepeatAdapter play={play} seek={seek} repeatEnabled={repeat} />
<KeyListener global keyDownHandlers={keyDownHandlers} />
<div className={classes.root}>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-FileCopyrightText: Copyright (C) 2023-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)<[email protected]>
// SPDX-License-Identifier: MPL-2.0

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import React, { useState, useEffect } from "react";

type Props = {
userName: string;
};

const ProblematicComponent: React.FC<Props> = ({ userName }) => {
const [count, setCount] = useState<number>(0);
// const [data, setData] = useState<string | undefined>("");
// const [unnusedData,] = useState<any>(null); // unnused var

// Complexity issue - bad logic
const handleClick = () => {
setCount(0);
};

useEffect(() => {
fetch("/api/data")
.then(async (response) => await response.json())
.catch((error) => {
console.error("Error:", error);
});
}, []);

return (
<div>
<h1>Hello, {userName}</h1>
<p>Counter: {count}</p>
<button onClick={handleClick}>Increment</button>
{/* {data ? <div>{data.name}</div> : <p>Loading...</p>} */}
</div>
);
};

export default ProblematicComponent;
10 changes: 7 additions & 3 deletions packages/suite-desktop/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { app, BrowserWindow, ipcMain, Menu, nativeTheme, session } from "electron";
import fs from "fs";
import i18n from "i18next";
import path from "path";

import Logger from "@lichtblick/log";
import { AppSetting } from "@lichtblick/suite-base/src/AppSetting";
Expand Down Expand Up @@ -138,7 +139,10 @@ export async function main(): Promise<void> {

// files our app should open - either from user double-click on a supported fileAssociation
// or command line arguments.
const filesToOpen: string[] = process.argv.slice(1).filter(isFileToOpen);
const filesToOpen: string[] = process.argv
.slice(1)
.map((filePath) => path.resolve(filePath)) // Convert to absolute path, linux has some problems to resolve relative paths
.filter(isFileToOpen);

// indicates the preloader has setup the file input used to inject which files to open
let preloaderFileInputIsReady = false;
Expand Down Expand Up @@ -172,9 +176,9 @@ export async function main(): Promise<void> {
preloaderFileInputIsReady = true;
});

ipcMain.handle("setRepresentedFilename", (ev, path: string | undefined) => {
ipcMain.handle("setRepresentedFilename", (ev, filePath: string | undefined) => {
const browserWindow = BrowserWindow.fromId(ev.sender.id);
browserWindow?.setRepresentedFilename(path ?? "");
browserWindow?.setRepresentedFilename(filePath ?? "");
});

const openUrls: string[] = [];
Expand Down
Loading