Showing 343 of 352 total issues
Function install
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function install (projectRoot: string, logger: Logger): Promise<void> {
if (platform() !== 'darwin') {
logger.warn('Detected platform is not macOS, skipping')
return
}
Method toWritableArray
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static WritableArray toWritableArray(Collection<? extends Object> collection) {
WritableArray writableArray = Arguments.createArray();
if (collection == null) {
return writableArray;
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (BugsnagIpcRenderer = window.__bugsnag_ipc__) => ({
load: (client) => {
client.addOnBreadcrumb(breadcrumb => {
try {
BugsnagIpcRenderer.leaveBreadcrumb(Object.assign({}, breadcrumb))
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (callbacks, event, onCallbackError, cb) => {
// This function is how we support different kinds of callback:
// - synchronous - return value
// - node-style async with callback - cb(err, value)
// - promise/thenable - resolve(value)
- 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
Method toWritableMap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
static WritableMap toWritableMap(Map<String, ? extends Object> javaMap) {
WritableMap writableMap = Arguments.createMap();
if (javaMap == null) {
- 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 formatComponentName
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const formatComponentName = (vm, includeFile) => {
if (vm.$root === vm) return '<Root>'
const options = typeof vm === 'function' && vm.cid != null
? vm.options
: vm._isVue
- 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 mergeOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.mergeOptions = (additionalSchemaKeys, mainOpts, rendererOpts) => {
return Object.keys(module.exports.schema).concat(additionalSchemaKeys).reduce((accum, k) => {
if (Object.prototype.hasOwnProperty.call(rendererOpts, k)) {
if (ALLOWED_IN_RENDERER.includes(k)) {
if (k === 'metadata') {
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (NativeClient) => ({
load: (client) => {
client.addOnBreadcrumb(breadcrumb => {
// we copy the breadcrumb's properties over to a new object to ensure its
// to JSON() method doesn't get called before passing the object over the
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = ctx => {
if (!ctx) return {}
const request = ctx.req
const connection = request.connection
const address = connection && connection.address && connection.address()
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: (client) => {
const device = {
locale: nav.browserLanguage || nav.systemLanguage || nav.userLanguage || nav.language,
userAgent: nav.userAgent
}
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (win = window) => {
const plugin = {
load: (client) => {
if (!('addEventListener' in win)) return
if (!client._isBreadcrumbTypeEnabled('navigation')) return
Function listener
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const listener = evt => {
let error = evt.reason
let isBluebird = false
// accessing properties on evt.detail can throw errors (see #394)
Function load
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: (client) => {
const sessionTracker = new SessionTracker(client._config.sessionSummaryInterval)
sessionTracker.on('summary', sendSessionSummary(client))
sessionTracker.start()
client._sessionDelegate = {
Function sendMinidump
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const sendMinidump = async (minidumpPath, event) => {
const apiKey = (event && event.apiKey) || client._config.apiKey
const url = new URL(client._config.endpoints.minidumps)
url.pathname = `${url.pathname.replace(/\/$/, '')}/minidump`
url.searchParams.set('api_key', apiKey)
Function run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function run (projectRoot: string, urls: OnPremiseUrls): Promise<boolean> {
try {
const { apiKey } = await prompts({
type: 'text',
name: 'apiKey',
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (req.bugsnag) {
req.bugsnag._notify(event)
} else {
client._logger.warn(
'req.bugsnag is not defined. Make sure the @bugsnag/plugin-express requestHandler middleware is added first.'
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 56.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
screen.on('display-removed', (_event, display) => {
const metadata = anonymise(display)
client.leaveBreadcrumb(
`Display ${metadata.id} removed`,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 56.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
screen.on('display-added', (_event, display) => {
const metadata = anonymise(display)
client.leaveBreadcrumb(
`Display ${metadata.id} added`,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 56.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (req.bugsnag) {
req.bugsnag._notify(event)
} else {
client._logger.warn(
'req.bugsnag is not defined. Make sure the @bugsnag/plugin-restify requestHandler middleware is added first.'
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 56.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function _createClient
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const _createClient = (opts, jsOpts) => {
if (jsOpts && typeof jsOpts === 'object') {
// mutate the options with anything supplied in JS. This will throw
Object.keys(jsOpts).forEach(k => { opts[k] = jsOpts[k] })
}