Showing 5 of 12 total issues
AppStore
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class AppStore {
store: Store
constructor (store) {
makeObservable(this, {
File AppStore.tsx
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { action, computed, observable, makeObservable } from 'mobx'
import { encodeSource, decodeSource, getHosts, setHosts } from 'libs'
import isEqual from 'lodash.isequal'
import sizeof from 'object-sizeof'
import { js } from 'js-beautify'
Function constructor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (store) {
makeObservable(this, {
mode: observable,
loading: observable,
autoSaveHandle: observable,
Function NewPatternDialog
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const NewPatternDialog = observer(() => {
const navigate = useNavigate()
const { NewPatternStore } = useStore()
const { closeDialog, error, validPattern, pattern } = NewPatternStore
return (
Function onMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
const onMessage = async (message, sender, sendResponse) => {
const { domain } = message
try {
const tab = await getActiveTab()
const url = domain ? getURL({ url: domain }) : getURL(tab)
- Read upRead up
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"