Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Fix Quality Issues using DeepSource (#1183)

Moulik Aggarwalb2ef26600cf7
diff --git a/.deepsource.toml b/.deepsource.toml
new file mode 100644
index 000000000..a7292752d
--- /dev/null
+++ b/.deepsource.toml
@@ -0,0 +1,13 @@
+version = 1
+
+[[analyzers]]
+name = "javascript"
+enabled = true
+
+ [analyzers.meta]
+ environment = [
+ "nodejs",
+ "browser"
+ ]
+ plugins = ["vue"]
+ module_system="es-modules"
diff --git a/build.js b/build.js
index c4b42638e..25b4acacd 100644
--- a/build.js
+++ b/build.js
@@ -8,7 +8,7 @@ const PW_BUILD_DATA_DIR = "./.hoppscotch"
// const IS_DEV_MODE = process.argv.includes("--dev")
try {
- ;(async () => {
+ (async () => {
// Create the build data directory if it does not exist.
if (!fs.existsSync(PW_BUILD_DATA_DIR)) {
fs.mkdirSync(PW_BUILD_DATA_DIR)
diff --git a/components/collections/import-export-collections.vue b/components/collections/import-export-collections.vue
index 5fb2423cb..4b4100d83 100644
--- a/components/collections/import-export-collections.vue
+++ b/components/collections/import-export-collections.vue
@@ -320,10 +320,10 @@ export default {
return items
},
hasFolder(item) {
- return item.hasOwnProperty("item")
+ return Object.prototype.hasOwnProperty.call(item, "item")
},
isSubFolder(item) {
- return item.hasOwnProperty("_postman_isSubFolder") && item._postman_isSubFolder
+ return Object.prototype.hasOwnProperty.call(item, "_postman_isSubFolder") && item._postman_isSubFolder
},
flattenPostmanItem(subFolder, subFolderGlue = " -- ") {
delete subFolder._postman_isSubFolder
diff --git a/components/graphql/queryeditor.vue b/components/graphql/queryeditor.vue
index b1f204367..6c7b62db5 100644
--- a/components/graphql/queryeditor.vue
+++ b/components/graphql/queryeditor.vue
@@ -38,6 +38,7 @@ export default {
theme: {
type: String,
required: false,
+ default: null
},
onRunGQLQuery: {
type: Function,
diff --git a/components/layout/pw-header.vue b/components/layout/pw-header.vue
index 15c4a6e47..31555adb1 100644
--- a/components/layout/pw-header.vue
+++ b/components/layout/pw-header.vue
@@ -346,7 +346,7 @@ export default {
mounted() {
// Initializes the PWA code - checks if the app is installed,
// etc.
- ;(async () => {
+ (async () => {
this.showInstallPrompt = await intializePwa()
let cookiesAllowed = localStorage.getItem("cookiesAllowed") === "yes"
if (!cookiesAllowed) {
diff --git a/components/settings/swatch.vue b/components/settings/swatch.vue
index 580cc3137..405835749 100644
--- a/components/settings/swatch.vue
+++ b/components/settings/swatch.vue
@@ -57,6 +57,7 @@ export default {
},
name: {
type: String,
+ default: ""
},
active: {
type: Boolean,
diff --git a/components/ui/ace-editor.vue b/components/ui/ace-editor.vue
index 8722e8710..c1b9bda76 100644
--- a/components/ui/ace-editor.vue
+++ b/components/ui/ace-editor.vue
@@ -35,6 +35,7 @@ export default {
theme: {
type: String,
required: false,
+ default: null
},
lang: {
type: String,
diff --git a/components/ui/js-editor.vue b/components/ui/js-editor.vue
index 9d2f87d20..f658e4809 100644
--- a/components/ui/js-editor.vue
+++ b/components/ui/js-editor.vue
@@ -36,6 +36,7 @@ export default {
theme: {
type: String,
required: false,
+ default: null,
},
options: {
type: Object,
diff --git a/components/ui/tab.vue b/components/ui/tab.vue
index 54353c540..3785daa42 100644
--- a/components/ui/tab.vue
+++ b/components/ui/tab.vue
@@ -7,10 +7,11 @@
<script>
export default {
props: {
- label: { type: String },
- icon: { type: String },
+ label: { type: String, default: "" },
+ icon: { type: String, default: "" },
id: { required: true },
selected: {
+ type: Boolean,
default: false,
},
},
diff --git a/components/ui/url-field.vue b/components/ui/url-field.vue
index 3b2304ead..204d6dbee 100644
--- a/components/ui/url-field.vue
+++ b/components/ui/url-field.vue
@@ -18,7 +18,7 @@
<script>
export default {
props: {
- value: { type: String },
+ value: { type: String, default: "" },
},
data() {
return {
diff --git a/helpers/postwomanTesting.js b/helpers/postwomanTesting.js
index c1fed8cc1..13af1c975 100644
--- a/helpers/postwomanTesting.js
+++ b/helpers/postwomanTesting.js
@@ -102,7 +102,7 @@ class Expectation {
: this._fail(this._fmtNot(`Expected ${this.expectValue} (not)to be ${value}`))
}
toHaveProperty(value) {
- return this._satisfies(this.expectValue.hasOwnProperty(value), true)
+ return this._satisfies(Object.prototype.hasOwnProperty.call(this.expectValue, value), true)
? this._pass()
: this._fail(
this._fmtNot(`Expected object ${this.expectValue} to (not)have property ${value}`)
diff --git a/layouts/default.vue b/layouts/default.vue
index a9d07fbf0..aad7328ca 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -17,7 +17,7 @@
export default {
beforeMount() {
// Load theme settings
- ;(() => {
+ (() => {
// Apply theme from settings.
document.documentElement.className = this.$store.state.postwoman.settings.THEME_CLASS || ""
// Load theme color data from settings, or use default color.
diff --git a/pages/index.vue b/pages/index.vue
index 69db43c17..da0009e7e 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -2604,7 +2604,7 @@ export default {
},
async oauthRedirectReq() {
const tokenInfo = await oauthRedirect()
- if (tokenInfo.hasOwnProperty("access_token")) {
+ if (Object.prototype.hasOwnProperty.call(tokenInfo, "access_token")) {
this.bearerToken = tokenInfo.access_token
this.addOAuthToken({
name: this.accessTokenName,
diff --git a/store/postwoman.js b/store/postwoman.js
index 1976a2cd4..3a1b8a9b5 100644
--- a/store/postwoman.js
+++ b/store/postwoman.js
@@ -331,9 +331,9 @@ export const mutations = {
const { request } = payload
// Remove the old request from collection
- if (request.hasOwnProperty("oldCollection") && request.oldCollection > -1) {
+ if (Object.prototype.hasOwnProperty.call(request, "oldCollection") && request.oldCollection > -1) {
const folder =
- request.hasOwnProperty("oldFolder") && request.oldFolder >= -1
+ Object.prototype.hasOwnProperty.call(request, "oldFolder") && request.oldFolder >= -1
? request.oldFolder
: request.folder
if (folder > -1) {
@@ -341,7 +341,7 @@ export const mutations = {
} else {
collections[request.oldCollection].requests.splice(request.requestIndex, 1)
}
- } else if (request.hasOwnProperty("oldFolder") && request.oldFolder !== -1) {
+ } else if (Object.prototype.hasOwnProperty.call(request, "oldFolder") && request.oldFolder !== -1) {
collections[request.collection].folders[folder].requests.splice(request.requestIndex, 1)
}