xcv58/Tab-Manager-v2

View on GitHub

Showing 7 of 68 total issues

Function AutocompleteSearch has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AutocompleteSearch = observer((props: Props) => {
  const { autoFocus, open } = props
  const searchInputRef = useSearchInputRef()
  const options = useOptions()
  const { userStore, searchStore } = useStore()
Severity: Major
Found in packages/extension/src/js/components/AutocompleteSearch/index.tsx - About 2 hrs to fix

    File FocusStore.tsx has 254 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { makeAutoObservable } from 'mobx'
    import Store from 'stores'
    import log from 'libs/log'
    import Tab from './Tab'
    import Window from './Window'
    Severity: Minor
    Found in packages/extension/src/js/stores/FocusStore.tsx - About 2 hrs to fix

      Function Icon has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Icon = observer((props: TabProps) => {
        const { userStore } = useStore()
        const { focus, select, iconUrl, isSelected, bulkSelect } = props.tab
        const checkbox = (
          <Checkbox
      Severity: Major
      Found in packages/extension/src/js/components/Tab/Icon.tsx - About 2 hrs to fix

        Function constructor has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(tab, store: Store, win: Window) {
            super(store)
        
            makeObservable(this, {
              cookieStoreId: observable,
        Severity: Minor
        Found in packages/extension/src/js/stores/Tab.tsx - About 1 hr to fix

          Function TabContent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            (props: TabProps & { buttonClassName: string; content: ReactElement }) => {
              const { faked, buttonClassName, content } = props
              const { hoverStore, dragStore } = useStore()
              const { activate, title, url, isDuplicated, focus, isFocused, isHovered } =
                props.tab
          Severity: Minor
          Found in packages/extension/src/js/components/Tab/TabContent.tsx - About 1 hr to fix

            Function transform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      transform: function (content) {
                        const json = JSON.parse(content.toString())
                        if (process.env.NODE_ENV === 'production') {
                          delete json.content_security_policy
                        }
            Severity: Minor
            Found in packages/extension/webpack.config.js - About 1 hr to fix

              Function tabComparator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const tabComparator = (a, b) => {
                if (a.pinned ^ b.pinned) {
                  return b.pinned ? 1 : -1
                }
                if (a.domain !== b.domain) {
              Severity: Minor
              Found in packages/extension/src/js/libs/index.tsx - About 25 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Severity
              Category
              Status
              Source
              Language