Skip to content

Commit

Permalink
Sonarcloud issues fixes (#3499)
Browse files Browse the repository at this point in the history
* Sonarcloud issues fixes

* Code smell fixes

* Refactoring to remove new code duplications

* Sonarcloud code smell fixes part I

* Sonarcloud code smell fixes part II

* Missing code smell fix

* Add new ESLint rules to cover fixed SonarCloud issues

* Add missing command

* Add missing is existing check
  • Loading branch information
MichalKinas authored Nov 3, 2023
1 parent 968febf commit 69c00fc
Show file tree
Hide file tree
Showing 72 changed files with 327 additions and 530 deletions.
12 changes: 9 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/no-conflicting-lifecycle": "error",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/default-param-last": "warn",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-output-native": "error",
"@angular-eslint/no-output-on-prefix": "error",
Expand All @@ -122,7 +124,7 @@
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/prefer-function-type": "error",
Expand Down Expand Up @@ -204,6 +206,7 @@
"newline-per-chained-call": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-promise-reject-errors": "error",
"import/order": "off",
"max-len": [
"error",
Expand All @@ -226,6 +229,8 @@
"no-caller": "error",
"no-global-assign": "error",
"no-cond-assign": "error",
"no-constant-binary-expression": "error",
"no-useless-rename": "error",
"no-console": [
"error",
{
Expand Down Expand Up @@ -324,7 +329,8 @@
{
"files": ["*.spec.ts", "*.test.ts"],
"rules": {
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"max-lines": "off"
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/proxy.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
// workaround for REPO-2260
onProxyRes: function (proxyRes) {
const header = proxyRes.headers['www-authenticate'];
if (header && header.startsWith('Basic')) {
if (header?.startsWith('Basic')) {
proxyRes.headers['www-authenticate'] = 'x' + header;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ if (environment.production) {
enableProdMode();
}

void platformBrowserDynamic().bootstrapModule(AppModule);
platformBrowserDynamic().bootstrapModule(AppModule);
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ test.describe('Special permissions : ', () => {
await managerSiteActions.addSiteMember(sitePrivate, userCollaborator, Site.RoleEnum.SiteCollaborator);
await managerSiteActions.addSiteMember(sitePrivate, userDemoted, Site.RoleEnum.SiteManager);

await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, docLibId, testData.fileDocx.name);
fileDocxFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, docLibId, testData.fileDocxFav.name)).entry.id;
await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocx.name, docLibId);
fileDocxFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxFav.name, docLibId)).entry.id;
await managerNodeActions.createFile(testData.file.name, docLibId);
fileFavId = (await managerNodeActions.createFile(testData.fileFav.name, docLibId)).entry.id;
fileDocxSharedId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, docLibId, testData.fileDocxShared.name)).entry.id;
fileDocxSharedFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, docLibId, testData.fileDocxSharedFav.name)).entry.id;
fileDocxSharedId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxShared.name, docLibId)).entry.id;
fileDocxSharedFavId = (await managerFileActions.uploadFileWithRename(TEST_FILES.DOCX.path, testData.fileDocxSharedFav.name, docLibId)).entry.id;
fileSharedId = (await managerNodeActions.createFile(testData.fileShared.name, docLibId)).entry.id;
fileSharedFavId = (await managerNodeActions.createFile(testData.fileSharedFav.name, docLibId)).entry.id;
fileLockedId = (await managerNodeActions.createFile(testData.fileLocked.name, docLibId)).entry.id;
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright/viewer/src/tests/viewer-protected.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.describe('viewer file', () => {
let folderId: string;
let fileDocxId: string;

test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => {
test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction }) => {
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
Expand Down
Loading

0 comments on commit 69c00fc

Please sign in to comment.