Skip to content

Commit ed36a12

Browse files
author
Arvid Paeglit
committed
Big refactoring. moving parts, that must be in 'tsc' to tsc
1 parent 9fdba4f commit ed36a12

14 files changed

Lines changed: 115 additions & 426 deletions

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
max_line_length = 120
13+
14+
[*.{js,jsx,ts,tsx,vue,sass}]
15+
indent_style = space
16+
indent_size = 2
17+
18+
# 4 space indentation
19+
[*.py]
20+
indent_style = space
21+
indent_size = 4

.eslintrc.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ module.exports = {
88
'Atomics': 'readonly',
99
'SharedArrayBuffer': 'readonly'
1010
},
11-
// 'parserOptions': {
12-
// 'ecmaVersion': 2018,
13-
// 'sourceType': 'module',
14-
// 'parser': 'babel-eslint'
15-
// },
11+
'parserOptions': {
12+
'ecmaVersion': 2018,
13+
'sourceType': 'module',
14+
'parser': 'babel-eslint'
15+
},
1616
'rules': {
1717
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
1818
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
@@ -28,6 +28,10 @@ module.exports = {
2828
'padded-blocks': 'off',
2929
'camelcase': 'warn',
3030
'object-property-newline': 'off',
31-
'indent': 'warn'
31+
'prefer-const': 'off',
32+
'import/no-absolute-path': 'off',
33+
'no-prototype-builtins': 'off',
34+
'indent': 'warn',
35+
'quote-props': 'off'
3236
}
3337
}

package-lock.json

Lines changed: 59 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/deepcode/constants/filesConstants.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
export const HASH_ALGORITHM = "sha256";
2-
export const ENCODE_TYPE = "hex";
3-
export const FILE_FORMAT = "utf-8";
4-
export const GIT_FILENAME = ".git";
5-
export const GITIGNORE_FILENAME = ".gitignore";
6-
export const DCIGNORE_FILENAME = ".dcignore";
7-
export const EXCLUDED_NAMES = [
8-
GIT_FILENAME,
9-
GITIGNORE_FILENAME,
10-
DCIGNORE_FILENAME,
11-
".vscode/"
12-
];
13-
141
export const FILE_CURRENT_STATUS = {
152
modified: "modified",
163
deleted: "deleted",

src/deepcode/constants/general.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Changing this requires changing display name in package.json.
22
export const DEEPCODE_NAME = "DeepCode";
33
export const DEEPCODE_EXTENSION_NAME = "deepcode";
4-
export const ALLOWED_PAYLOAD_SIZE = 1024 * 1024 * 4; // max payload size of 4MB in bytes
54
export const MAX_CONNECTION_RETRIES = 5; // max number of automatic retries before showing an error
65
export const IDE_NAME = "vscode";
76
export const EXECUTION_DEBOUNCE_INTERVAL = 1000; // 1 second

src/deepcode/lib/modules/BundlesModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as _ from "lodash";
44
import DeepCode from "../../../interfaces/DeepCodeInterfaces";
55
import { IQueueAnalysisCheckResult } from "@deepcode/tsc";
66
import { checkIfBundleIsEmpty } from "../../utils/bundlesUtils";
7-
import { createListOfDirFiles } from "../../utils/packageUtils";
7+
import { createListOfDirFiles } from "@deepcode/tsc/src/utils/packageUtils";
88
import { BUNDLE_EVENTS } from "../../constants/events";
99
import LoginModule from "../../lib/modules/LoginModule";
1010
import { DEEPCODE_ANALYSIS_STATUS, DEEPCODE_CONTEXT } from "../../constants/views";

src/deepcode/lib/modules/LoginModule.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ abstract class LoginModule extends ReportModule implements DeepCode.LoginModuleI
2323
try {
2424
const checkCurrentToken = await this.checkSession();
2525
if (checkCurrentToken) return;
26-
const result = await this.serviceAI.startSession({ baseURL: this.baseURL, source: this.source });
27-
const { sessionToken, loginURL } = result;
26+
const { sessionToken, loginURL } = await this.serviceAI.startSession({ baseURL: this.baseURL, source: this.source });
2827
if (!sessionToken || !loginURL) {
2928
throw new Error(errorsLogs.login);
3029
}

src/deepcode/lib/watchers/DeepCodeFilesWatcher.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import * as vscode from "vscode";
2-
import { compareFileChanges, acceptFileToBundle, isFileChangingBundle } from "../../utils/filesUtils";
3-
import {
4-
FILE_CURRENT_STATUS,
5-
GIT_FILENAME
6-
} from "../../constants/filesConstants";
2+
import { compareFileChanges, isFileChangingBundle } from "@deepcode/tsc/src/utils/filesUtils";
3+
import { FILE_CURRENT_STATUS, GIT_FILENAME } from "@deepcode/tsc/src/constants/files";
74
import { errorsLogs } from "../../messages/errorsServerLogMessages";
85
import DeepCode from "../../../interfaces/DeepCodeInterfaces";
96

@@ -102,7 +99,7 @@ class DeepCodeFilesWatcher implements DeepCode.DeepCodeWatcherInterface {
10299
}
103100
} catch (err) {
104101
const filePathInBundle = filePath.split(fileWorkspacePath)[1];
105-
102+
106103
await extension.processError(err, {
107104
message: errorsLogs.watchFileBeforeExtendBundle,
108105
bundleId: extension.remoteBundles[fileWorkspacePath].bundleId,
@@ -123,7 +120,7 @@ class DeepCodeFilesWatcher implements DeepCode.DeepCodeWatcherInterface {
123120
type: string
124121
): Promise<void> {
125122
if (
126-
!acceptFileToBundle(filePath, extension.serviceAI.serverFilesFilterList) &&
123+
!extension.serviceAI.acceptFileToBundle(filePath) &&
127124
!isFileChangingBundle(filePath)
128125
) {
129126
return;
@@ -189,7 +186,7 @@ class DeepCodeFilesWatcher implements DeepCode.DeepCodeWatcherInterface {
189186
...(extension.serverFilesFilterList.extensions || []).map(e => `*${e}`),
190187
...(extension.serverFilesFilterList.configFiles || [])
191188
];
192-
189+
193190
const globPattern: vscode.GlobPattern = `**/\{${watchFiles.join(',')}\}`;
194191
this.watcher = vscode.workspace.createFileSystemWatcher(globPattern);
195192

0 commit comments

Comments
 (0)