xcv58/Tab-Manager-v2

View on GitHub
packages/extension/src/js/stores/ShortcutStore.tsx

Summary

Maintainability
A
2 hrs
Test Coverage

Showing 2 of 16 total issues

File ShortcutStore.tsx has 468 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import { makeAutoObservable } from 'mobx'
import Mousetrap from 'mousetrap'
import { openInNewTab } from 'libs'
import Store from 'stores'
import debounce from 'lodash.debounce'
Severity: Minor
Found in packages/extension/src/js/stores/ShortcutStore.tsx - About 7 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    process.env.TARGET_BROWSER === 'firefox' && [
    ['alt+c'],
    (event: Event) => {
    preventDefault(event)
    this.store.containerStore.groupTabsByContainer()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 1 other location - About 1 hr to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 412..419

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    process.env.TARGET_BROWSER === 'firefox' && [
    ['alt+x'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.selectTabsInSameContainer()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 1 other location - About 1 hr to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 420..427

    Similar blocks of code found in 5 locations. Consider refactoring.
    Invalid

    [
    ['l', 'right', 'ctrl+l'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.right()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 188..195
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 204..211
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 212..219
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 288..295

    Similar blocks of code found in 5 locations. Consider refactoring.
    Invalid

    [
    ['h', 'left', 'ctrl+h'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.left()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 196..203
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 204..211
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 212..219
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 288..295

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

    [
    ['x', 'ctrl+x'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.select()
    Severity: Minor
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 2 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 128..136
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 137..145

    Similar blocks of code found in 5 locations. Consider refactoring.
    Invalid

    [
    ['* u', 'i', 'ctrl+u'],
    (event: Event) => {
    preventDefault(event)
    this.store.searchStore.invertSelect()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 188..195
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 196..203
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 204..211
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 212..219

    Similar blocks of code found in 5 locations. Consider refactoring.
    Invalid

    [
    ['k', 'up', 'ctrl+k'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.up()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 188..195
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 196..203
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 204..211
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 288..295

    Similar blocks of code found in 5 locations. Consider refactoring.
    Invalid

    [
    ['j', 'down', 'ctrl+j'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.down()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 188..195
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 196..203
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 212..219
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 288..295

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

    [
    ['/', 'command+k'],
    (event: Event) => {
    preventDefault(event)
    this.store.searchStore.focus()
    Severity: Minor
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 2 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 137..145
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 244..252

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

    [
    ['>', 'command+shift+p'],
    (event: Event) => {
    preventDefault(event)
    this.store.searchStore.startCommandSearch()
    Severity: Minor
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 2 other locations - About 35 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 128..136
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 244..252

    Similar blocks of code found in 5 locations. Consider refactoring.
    Wontfix

    [
    ['* n', 'ctrl+n'],
    (event: Event) => {
    preventDefault(event)
    this.store.tabStore.unselectAll()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 30 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 88..95
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 228..235
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 280..287
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 296..303

    Similar blocks of code found in 5 locations. Consider refactoring.
    Wontfix

    [
    ['* m', 'ctrl+m'],
    (event: Event) => {
    preventDefault(event)
    this.store.searchStore.selectAll()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 30 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 88..95
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 228..235
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 296..303
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 304..311

    Similar blocks of code found in 5 locations. Consider refactoring.
    Wontfix

    [
    ['* c', 'shift+ctrl+c'],
    (event: Event) => {
    preventDefault(event)
    this.store.windowStore.cleanDuplicatedTabs()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 30 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 228..235
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 280..287
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 296..303
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 304..311

    Similar blocks of code found in 5 locations. Consider refactoring.
    Wontfix

    [
    ['shift+g', 'shift+ctrl+g'],
    (event: Event) => {
    preventDefault(event)
    this.store.focusStore.lastTab()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 30 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 88..95
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 280..287
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 296..303
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 304..311

    Similar blocks of code found in 5 locations. Consider refactoring.
    Wontfix

    [
    ['* a', 'ctrl+8'],
    (event: Event) => {
    preventDefault(event)
    this.store.searchStore.toggleSelectAll()
    Severity: Major
    Found in packages/extension/src/js/stores/ShortcutStore.tsx and 4 other locations - About 30 mins to fix
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 88..95
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 228..235
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 280..287
    packages/extension/src/js/stores/ShortcutStore.tsx on lines 304..311
    Category
    Status