Fix Quality Issues using DeepSource (#1183)

Co-authored-by: DeepSource Bot <bot@deepsource.io>
This commit is contained in:
Moulik Aggarwal
2020-09-24 20:46:20 +05:30
committed by GitHub
parent 2e423b101b
commit b2ef26600c
14 changed files with 31 additions and 13 deletions

13
.deepsource.toml Normal file
View File

@@ -0,0 +1,13 @@
version = 1
[[analyzers]]
name = "javascript"
enabled = true
[analyzers.meta]
environment = [
"nodejs",
"browser"
]
plugins = ["vue"]
module_system="es-modules"

View File

@@ -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)

View File

@@ -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

View File

@@ -38,6 +38,7 @@ export default {
theme: {
type: String,
required: false,
default: null
},
onRunGQLQuery: {
type: Function,

View File

@@ -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) {

View File

@@ -57,6 +57,7 @@ export default {
},
name: {
type: String,
default: ""
},
active: {
type: Boolean,

View File

@@ -35,6 +35,7 @@ export default {
theme: {
type: String,
required: false,
default: null
},
lang: {
type: String,

View File

@@ -36,6 +36,7 @@ export default {
theme: {
type: String,
required: false,
default: null,
},
options: {
type: Object,

View File

@@ -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,
},
},

View File

@@ -18,7 +18,7 @@
<script>
export default {
props: {
value: { type: String },
value: { type: String, default: "" },
},
data() {
return {

View File

@@ -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}`)

View File

@@ -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.

View File

@@ -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,

View File

@@ -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)
}