Showing 20 of 31 total issues
Function server
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
const server = http.createServer((request, response) => {
switch (request.url) {
// Serve the frontend React app
case '/':
serve(response, ['index.html']);
Function init
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const init = ({
loadSourceMaps = currentPlatform === PLATFORMS.WEB,
devMode: devModeOption = false,
verbose = false,
skipTracking: skipTrackingOption = false,
- 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"
Further reading
Function Activity
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Activity = () => {
const [selected, setSelected] = useState(null);
const {history, selectedModule} = useContext(DataContext);
const moduleHistory = useMemo(
() => (history || []).filter((e) => e?.module === selectedModule),
Function buildPatch
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const buildPatch = (family, method, track = () => {}) =>
// eslint-disable-next-line func-names
function (...args) {
let allowed;
const {
- 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"
Further reading
Function sendBatch
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const sendBatch = () => {
try {
if (skipTracking || batch.length === 0) {
return;
}
Function Permissions
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Permissions = () => {
const [selectedLibrary, setSelectedLibrary] = useState(null);
const {
requiredPermissions,
selectedModule,
Function App
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function App() {
const {history, setHistory, currentTab, setCurrentTab, selectedModule} = useContext(DataContext);
useEffect(() => {
const evtSource = new EventSource('/events');
Function sendBatch
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const sendBatch = () => {
try {
if (skipTracking || batch.length === 0) {
return;
}
- 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"
Further reading
Function parseStackLine
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const parseStackLine = (l) => {
const line = (l || '').trim();
const cached = lineParseCache[line];
if (cached) {
Function getSourceMapFromSource
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getSourceMapFromSource = async (location) => {
try {
logger.debug(`loading source from ${location}`);
const source = await getSource(location);
Function DataProvider
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const DataProvider = ({children}) => {
const [currentTab, setCurrentTab] = useLocalStorage('_sandworm_permissions', 'permissions');
const [history, setHistory] = useState([]);
const [selectedModule, setSelectedModule] = useLocalStorage('_sandworm_module', null);
const [requiredPermissions, setRequiredPermissions] = useState({});
- 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"
Further reading
Function getSourceMapFromSource
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const getSourceMapFromSource = async (location) => {
try {
logger.debug(`loading source from ${location}`);
const source = await getSource(location);
- 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"
Further reading
Function parseStackLine
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const parseStackLine = (l) => {
const line = (l || '').trim();
const cached = lineParseCache[line];
if (cached) {
- 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"
Further reading
Function getModuleNameFromLocation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const getModuleNameFromLocation = (location, allowURLs) => {
// Infer the module name
let moduleName = 'root';
if (!location || typeof location !== 'string') {
- 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"
Further reading
Consider simplifying this complex logical expression. Open
if (
(match = line.match(/at (.+) \(eval at .+ \((.+)\), .+\)/)) || // eval calls
(match = line.match(/at (.+) \((.+)\)/)) ||
(line.slice(0, 3) !== 'at ' && (match = line.match(/(.*)@(.*)/)))
) {
Function node
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const node = ({name, methods, globalMethod}) => {
let module;
if (!globalMethod) {
try {
// eslint-disable-next-line no-undef
- 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"
Further reading
Function web
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const web = ({
name,
globalConstructor,
constructorDescription,
constructorUrl,
- 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"
Further reading
Function server
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const server = http.createServer((request, response) => {
switch (request.url) {
// Serve the frontend React app
case '/':
serve(response, ['index.html']);
- 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"
Further reading
Function getCurrentModuleInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getCurrentModuleInfo = ({stack: stackInput, allowURLs = false} = {}) => {
try {
const stack = (stackInput || currentStack())
// If we have sourcemap info, trace calls back to the original files
.map((item) => mapStackItemToSource(item, sourcemaps))
- 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"
Further reading
Function useLocalStorage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function useLocalStorage(key, initialValue) {
// State to store our value
// Pass initial state function to useState so logic is only executed once
const [storedValue, setStoredValue] = useState(() => {
if (typeof window === 'undefined') {
- 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"