Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Minor fixes of problems identified by lgtm. (#9732)
Browse files Browse the repository at this point in the history
* Remove an unused argument.
* Remove unused assignments.
* Fix an incorrect type test.
* Remove repeated values from regex character class.
* Remove some unnecessary conditionals.
* Remove unused dependencies.
  • Loading branch information
chrisgavin authored and cezaraugusto committed Jul 27, 2017
1 parent 744469f commit 18acc2a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/common/lib/formatUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const defaultOrderLookup = (value) => {
* Accelerator reference: https://github.com/electron/electron/blob/master/docs/api/accelerator.md
*/
module.exports.formatAccelerator = (accelerator) => {
let result = accelerator
let result
let splitResult = accelerator.split('+')
// sort in proper order, based on OS
// also, replace w/ name or symbol
Expand Down
2 changes: 1 addition & 1 deletion app/common/state/navigationBarState.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const api = {
}
if (selected) {
// selection implies focus
state = state = api.setFocused(state, tabId, true)
state = api.setFocused(state, tabId, true)
}
return state.setIn(path.push('selected'), selected)
},
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/components/preferences/extensionsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ExtensionsTab extends ImmutableComponent {
headings={['icon', 'name', 'description', 'version', 'enabled'] /* 'exclude' */}
columnClassNames={this.columnClassNames}
rowClassNames={
this.props.extensions.map(entry => (entry = css(styles.extensionsRow))).toJS()
this.props.extensions.map(entry => css(styles.extensionsRow)).toJS()
}
rows={this.props.extensions.map(entry => this.getRow(entry))} />
</main>
Expand Down
2 changes: 1 addition & 1 deletion js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ function onUrlBarContextMenu (e) {

function onFindBarContextMenu (e) {
e.stopPropagation()
const findBarMenu = Menu.buildFromTemplate(findBarTemplateInit(e))
const findBarMenu = Menu.buildFromTemplate(findBarTemplateInit())
findBarMenu.popup(getCurrentWindow())
}

Expand Down
4 changes: 2 additions & 2 deletions js/lib/debounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function debounce (fn, bufferInterval, ...args) {
let timeout
return (...args2) => {
clearTimeout(timeout)
let a = args || []
if (args2 && args2.constructor === Array) {
let a = args
if (args2.constructor === Array) {
a = a.concat(args2)
}
timeout = setTimeout(fn.apply.bind(fn, this, a), bufferInterval)
Expand Down
2 changes: 1 addition & 1 deletion js/lib/urlutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const UrlUtil = {
// - starts with "?" or "."
// - contains "? "
// - ends with "." (and was not preceded by a domain or /)
const case2Reg = /(^\?)|(\?.+\s)|(^\.)|(^[^.+..+]*[^/]*\.$)/
const case2Reg = /(^\?)|(\?.+\s)|(^\.)|(^[^.+]*[^/]*\.$)/
// for cases, pure string
const case3Reg = /[?./\s:]/
// for cases, data:uri, view-source:uri and about
Expand Down
9 changes: 5 additions & 4 deletions js/state/userPrefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ let registeredPrivateSessions = {}
const setUserPrefType = (ses, path, value) => {
switch (typeof value) {
case 'object':
ses.userPrefs.setDictionaryPref(path, value)
if (Array.isArray(value)) {
ses.userPrefs.setListPref(path, value)
} else {
ses.userPrefs.setDictionaryPref(path, value)
}
break
case 'string':
ses.userPrefs.setStringPref(path, value)
break
case 'array':
ses.userPrefs.setListPref(path, value)
break
case 'number':
if ((/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i).test(value.to_s())) {
ses.userPrefs.setDoublePref(path, value)
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
"lru-cache": "^1.0.0",
"moment": "^2.15.1",
"niceware": "^1.0.4",
"normalize-url": "^1.7.0",
"parse-torrent": "^5.8.1",
"prettier-bytes": "^1.0.3",
"prop-types": "^15.5.6",
Expand All @@ -119,8 +118,6 @@
"react-dnd": "^2.1.4",
"react-dnd-html5-backend": "^2.1.2",
"react-dom": "^15.5.4",
"string.prototype.endswith": "^0.2.0",
"string.prototype.startswith": "^0.2.0",
"tablesort": "5.0.0",
"tldjs": "1.6.2",
"tracking-protection": "1.1.x",
Expand Down

0 comments on commit 18acc2a

Please sign in to comment.