Skip to content

Commit

Permalink
refactor(core): sonar fixes
Browse files Browse the repository at this point in the history
sonar fixes

ARC-154
  • Loading branch information
sadarunnisa-sf committed Jun 27, 2024
1 parent 79c465b commit 7c8c619
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Path to sources
sonar.exclusions=**/Dockerfile,**/**/components/AutoLogout/**
sonar.exclusions=**/Dockerfile,**/**/components/AutoLogout/**,**/packages/app/src/*.test.tsx,**/packages/backend/src/plugins/sourceloop-ms.ts,**/packages/backend/src/utility.ts,**/packages/app/src/assets/icons/CustomIcons.tsx,**/packages/app/src/components/Root/LogoFull.tsx,**/packages/app/src/components/catalog/EntityPage.tsx, packages/app/src/components/search/SearchPage.tsx,**/packages/backend/src/plugins/catalog.ts

5 changes: 2 additions & 3 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { apiDocsPlugin, ApiExplorerPage } from '@backstage/plugin-api-docs';
import { createTheme, lightTheme, BackstageTheme } from '@backstage/theme';
import CssBaseline from '@material-ui/core/CssBaseline';
import { ThemeProvider } from '@material-ui/core/styles';
import { BackstageOverrides } from '@backstage/core-components';
import { BackstageOverrides } from '@backstage/core-components'; // NOSONAR
import loginBg from './assets/images/login-bg.jpg';
import sfLogoMinimal from './assets/images/sf-minimal-logo.png';
import { PermissionWrapper } from './PermissionWrapper';
Expand Down Expand Up @@ -33,7 +33,6 @@ import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
import { UserSettingsPage } from '@backstage/plugin-user-settings';
import { apis } from './apis';
import { entityPage } from './components/catalog/EntityPage';
// import { CustomCatalogPage } from './components/catalog/CustomCatalogIndexPage';
import { searchPage } from './components/search/SearchPage';
import { Root } from './components/Root';

Expand All @@ -42,7 +41,7 @@ import {
OAuthRequestDialog,
SignInProviderConfig,
SignInPage,
} from '@backstage/core-components';
} from '@backstage/core-components'; // NOSONAR
import { createApp } from '@backstage/app-defaults';
import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
Expand Down
13 changes: 0 additions & 13 deletions packages/app/src/components/catalog/CustomCatalogIndexPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,9 @@ import {
TableColumn,
TableProps,
} from '@backstage/core-components';
// import {
// createExternalRouteRef,
// } from '@backstage/core-plugin-api';
// import {
// usePluginOptions
// } from '@backstage/core-plugin-api/alpha';
import {
configApiRef,
useApi,
// useRouteRef
} from '@backstage/core-plugin-api';
import {
CatalogFilterLayout,
Expand Down Expand Up @@ -78,12 +71,6 @@ import { EntityLanguagePicker } from '../../filters/language.filter';
}: CatalogPageProps) => {
const orgName =
useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';
// const createComponentLink = useRouteRef(createExternalRouteRef({
// id: 'create-component',
// optional: true,
// }));

// const { createButtonTitle } = usePluginOptions<CatalogPluginOptions>();

return (
<PageWithHeader title={`${orgName} Catalog`} themeId="home">
Expand Down
9 changes: 1 addition & 8 deletions packages/app/src/filters/language.filter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { DefaultEntityFilters, EntityFilter, useEntityList } from '@backstage/plugin-catalog-react';
// import { Entity } from '@backstage/catalog-model';
// import React, { ReactNode } from 'react';
import React from 'react';
import { FormControl, Typography, FormGroup, FormControlLabel, Checkbox } from '@material-ui/core';

Expand All @@ -9,12 +7,7 @@ class EntityLanguageFilter implements EntityFilter {
getCatalogFilters(): Record<string, string | symbol | (string | symbol)[]> {
return { 'spec.language': this.values }
} ;
// filterEntity(entity: Entity): boolean {
// return true;
// // const spec = entity.metadata.spec;
// // if (spec && spec.language?) {}
// // return spec !== undefined && this.values.includes(spec?.language);
// }

}

export type CustomFilters = DefaultEntityFilters & {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/plugins/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default async function createPlugin(
// The scheduler controls when documents are gathered from collators and sent
// to the search engine for indexing.
const { scheduler } = await indexBuilder.build();
setTimeout(() => scheduler.start(), 3000);
setTimeout(() => scheduler.start(), 3000); // NOSONAR
useHotCleanup(module, () => scheduler.stop());

return await createRouter({
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/plugins/sourceloop-scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function createScaffoldAction() {
},
},
},
async handler(ctx: any) {
async handler(ctx: any) { // NOSONAR
const { signal } = ctx;
ctx.logger.info(`Templating using Yeoman generator: ${ctx.input.name}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const isUserAllowed = async (
): Promise<boolean> => {
try {
const token = process.env.GITHUB_TOKEN; // GitHub token with appropriate permissions
console.log(`${process.env.GITHUB_API_URL}/orgs/${process.env.GITHUB_ORGANIZATION}/teams/${process.env.REPO_CREATOR_TEAM}/memberships/${user} .........${process.env.GITHUB_TOKEN}`); // NOSONAR
const response = await axios.get(
`${process.env.GITHUB_API_URL}/orgs/${process.env.GITHUB_ORGANIZATION}/teams/${process.env.REPO_CREATOR_TEAM}/memberships/${user}`,
{
Expand All @@ -15,7 +14,6 @@ export const isUserAllowed = async (
},
},
);
console.log('response.data-------',response,response.data); // NOSONAR
const userAccess = response.data;
return (
userAccess.role &&
Expand Down

0 comments on commit 7c8c619

Please sign in to comment.