Showing 343 of 352 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
requestClient.addOnError((event) => {
const { request, metadata } = getRequestAndMetadataFromCtx(ctx)
event.request = { ...event.request, ...request }
event.addMetadata('request', metadata)
}, true)
- 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 76.
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 exports
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (net, client) => {
const send = (opts, formData) => {
return new Promise((resolve, reject) => {
const req = net.request(opts, response => {
response.on('error', reject)
Function load
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
load (client) {
if (!client._isBreadcrumbTypeEnabled(BREADCRUMB_STATE)) {
return
}
Function _notify
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_notify (event, onError, postReportCallback = noop) {
event.app = assign({}, event.app, {
releaseStage: this._config.releaseStage,
version: this._config.appVersion,
type: this._config.appType
Function configure
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function configure (projectRoot: string, options: Options, logger: Logger): Promise<void> {
const iosDir = path.join(projectRoot, 'ios')
let xcodeprojDir
Function run
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function run (projectRoot: string, urls: OnPremiseUrls): Promise<boolean> {
try {
const { bugsnagCliIntegration } = await prompts({
type: 'confirm',
name: 'bugsnagCliIntegration',
Identical blocks of code found in 3 locations. Consider refactoring. Open
start: (opts) => {
if (Bugsnag._client) {
Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.')
return Bugsnag._client
}
- 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 74.
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
Identical blocks of code found in 3 locations. Consider refactoring. Open
start: (opts) => {
if (Bugsnag._client) {
Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.')
return Bugsnag._client
}
- 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 74.
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
Identical blocks of code found in 3 locations. Consider refactoring. Open
start: (opts) => {
if (Bugsnag._client) {
Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.')
return Bugsnag._client
}
- 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 74.
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 load
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
load: (client) => {
const emitter = new EventEmitter()
// proxy all state updates from within the main process
// so that we can emit events for the changes
- 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 a Cognitive Complexity of 15 (exceeds 5 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)
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
req.bugsnag._notify(event, () => {}, (e, event) => {
if (e) client._logger.error('Failed to send event to Bugsnag')
req.bugsnag._config.onUncaughtException(err, event, client._logger)
})
- 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 73.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
req.bugsnag._notify(event, () => {}, (e, event) => {
if (e) client._logger.error('Failed to send event to Bugsnag')
req.bugsnag._config.onUncaughtException(err, event, client._logger)
})
- 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 73.
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 load
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
load (client) {
// load the actual session delegate from plugin-browser-session
sessionDelegate.load(client)
if (isNativeClientEnabled(client)) {
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