Showing 191 of 352 total issues
Function createRendererClient
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createRendererClient = (rendererOpts) => {
if (!window.__bugsnag_ipc__) throw new Error('Bugsnag was not loaded in the main process')
const internalPlugins = [
require('@bugsnag/plugin-electron-renderer-client-state-updates')(window.__bugsnag_ipc__),
Function load
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: (client) => {
client.addOnBreadcrumb(breadcrumb => {
try {
BugsnagIpcRenderer.leaveBreadcrumb(Object.assign({}, breadcrumb))
} catch (e) {
Function load
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: (client) => {
if (!isEnabledFor(client)) {
return
}
Function buildIOS
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildIOS: function buildIOS () {
try {
const version = process.env.NOTIFIER_VERSION || common.determineVersion()
const rnVersion = process.env.REACT_NATIVE_VERSION
const registryUrl = process.env.REGISTRY_URL
Function deserialiseEvent
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deserialiseEvent (json, minidumpPath) {
if (!json || typeof json !== 'object') {
return
}
Function load
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: client => {
const requestHandler = (req, res, next) => {
const dom = domain.create()
// Get a client to be scoped to this request. If sessions are enabled, use the
Function attachBrowserWindowListeners
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function attachBrowserWindowListeners (leaveBreadcrumb, browserWindow) {
// the moved event fires too frequently to add a breadcrumb each time
const onMoved = debounce(() => {
// it's possible for the window to be destroyed at this point because we
// debounce this callback. If we try to use 'getPosition' when the window is
Function getIdentifier
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getIdentifier = (filepath) => {
const key = Buffer.from(lookupKey)
// Align to nearest 8 bytes:
// offset = {length rounded up to nearest multiple of 8}
const byteOffset = (lookupKeyLength | 0x7) + 1
Function createMainClient
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createMainClient = (opts) => {
// check api key has been provided as we need it to create the FileStore
// which happens before the API key is validated
if (typeof opts.apiKey !== 'string') {
throw new Error('No Bugsnag API Key set')
Function sendSessionSummary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const sendSessionSummary = client => sessionCounts => {
// exit early if the current releaseStage is not enabled
if (client._config.enabledReleaseStages !== null && !client._config.enabledReleaseStages.includes(client._config.releaseStage)) {
client._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration')
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 exports
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (source = process) => ({
load: (client) => {
client.addOnError(function (event) {
const info = {}
if (typeof source.getHeapStatistics === 'function') {
- 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 load
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
load (client) {
const leaveBreadcrumb = (event, currentRouteName, previousRouteName) => {
if (!client._isBreadcrumbTypeEnabled('navigation')) return
client.leaveBreadcrumb(
Function load
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: client => {
const requestHandler = async (ctx, next) => {
// Get a client to be scoped to this request. If sessions are enabled, use the
// resumeSession() call to get a session client, otherwise, clone the existing client.
const requestClient = client._config.autoTrackSessions ? client.resumeSession() : clone(client)
Consider simplifying this complex logical expression. Open
} else if (
// This complex case detects "error" events that are typically synthesised
// by jquery's trigger method (although can be created in other ways). In
// order to detect this:
// - the first argument (message) must exist and be an object (most likely it's a jQuery event)
Function buildAndroid
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildAndroid: function buildAndroid (sourceFixtures, destFixtures) {
try {
const version = process.env.NOTIFIER_VERSION || common.determineVersion()
const rnVersion = process.env.REACT_NATIVE_VERSION
const registryUrl = process.env.REGISTRY_URL
Function load
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
load (client) {
if (!client._isBreadcrumbTypeEnabled(BREADCRUMB_REQUEST)) {
return
}
Function insertIos
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function insertIos (projectRoot: string, logger: Logger): Promise<void> {
logger.info('Adding Bugsnag to the iOS layer')
const iosDir = path.join(projectRoot, 'ios')
let appDelegatePath
Function load
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: client => {
const requestHandler = (req, res, next) => {
const dom = domain.create()
// Get a client to be scoped to this request. If sessions are enabled, use the
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = screen => {
const seenIds = []
const anonymiseId = id => {
if (!seenIds.includes(id)) {
Function exports
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
module.exports = req => {
const connection = req.connection
const address = connection && connection.address && connection.address()
const portNumber = address && address.port
const port = (!portNumber || portNumber === 80 || portNumber === 443) ? '' : `:${portNumber}`
- 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"