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") // const IS_DEV_MODE = process.argv.includes("--dev")
try { try {
;(async () => { (async () => {
// Create the build data directory if it does not exist. // Create the build data directory if it does not exist.
if (!fs.existsSync(PW_BUILD_DATA_DIR)) { if (!fs.existsSync(PW_BUILD_DATA_DIR)) {
fs.mkdirSync(PW_BUILD_DATA_DIR) fs.mkdirSync(PW_BUILD_DATA_DIR)

View File

@@ -320,10 +320,10 @@ export default {
return items return items
}, },
hasFolder(item) { hasFolder(item) {
return item.hasOwnProperty("item") return Object.prototype.hasOwnProperty.call(item, "item")
}, },
isSubFolder(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 = " -- ") { flattenPostmanItem(subFolder, subFolderGlue = " -- ") {
delete subFolder._postman_isSubFolder delete subFolder._postman_isSubFolder

View File

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

View File

@@ -346,7 +346,7 @@ export default {
mounted() { mounted() {
// Initializes the PWA code - checks if the app is installed, // Initializes the PWA code - checks if the app is installed,
// etc. // etc.
;(async () => { (async () => {
this.showInstallPrompt = await intializePwa() this.showInstallPrompt = await intializePwa()
let cookiesAllowed = localStorage.getItem("cookiesAllowed") === "yes" let cookiesAllowed = localStorage.getItem("cookiesAllowed") === "yes"
if (!cookiesAllowed) { if (!cookiesAllowed) {

View File

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

View File

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

View File

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

View File

@@ -7,10 +7,11 @@
<script> <script>
export default { export default {
props: { props: {
label: { type: String }, label: { type: String, default: "" },
icon: { type: String }, icon: { type: String, default: "" },
id: { required: true }, id: { required: true },
selected: { selected: {
type: Boolean,
default: false, default: false,
}, },
}, },

View File

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

View File

@@ -102,7 +102,7 @@ class Expectation {
: this._fail(this._fmtNot(`Expected ${this.expectValue} (not)to be ${value}`)) : this._fail(this._fmtNot(`Expected ${this.expectValue} (not)to be ${value}`))
} }
toHaveProperty(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._pass()
: this._fail( : this._fail(
this._fmtNot(`Expected object ${this.expectValue} to (not)have property ${value}`) this._fmtNot(`Expected object ${this.expectValue} to (not)have property ${value}`)

View File

@@ -17,7 +17,7 @@
export default { export default {
beforeMount() { beforeMount() {
// Load theme settings // Load theme settings
;(() => { (() => {
// Apply theme from settings. // Apply theme from settings.
document.documentElement.className = this.$store.state.postwoman.settings.THEME_CLASS || "" document.documentElement.className = this.$store.state.postwoman.settings.THEME_CLASS || ""
// Load theme color data from settings, or use default color. // Load theme color data from settings, or use default color.

View File

@@ -2604,7 +2604,7 @@ export default {
}, },
async oauthRedirectReq() { async oauthRedirectReq() {
const tokenInfo = await oauthRedirect() const tokenInfo = await oauthRedirect()
if (tokenInfo.hasOwnProperty("access_token")) { if (Object.prototype.hasOwnProperty.call(tokenInfo, "access_token")) {
this.bearerToken = tokenInfo.access_token this.bearerToken = tokenInfo.access_token
this.addOAuthToken({ this.addOAuthToken({
name: this.accessTokenName, name: this.accessTokenName,

View File

@@ -331,9 +331,9 @@ export const mutations = {
const { request } = payload const { request } = payload
// Remove the old request from collection // 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 = const folder =
request.hasOwnProperty("oldFolder") && request.oldFolder >= -1 Object.prototype.hasOwnProperty.call(request, "oldFolder") && request.oldFolder >= -1
? request.oldFolder ? request.oldFolder
: request.folder : request.folder
if (folder > -1) { if (folder > -1) {
@@ -341,7 +341,7 @@ export const mutations = {
} else { } else {
collections[request.oldCollection].requests.splice(request.requestIndex, 1) 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) collections[request.collection].folders[folder].requests.splice(request.requestIndex, 1)
} }