Showing 258 of 258 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (helper.isArray(data.removedFiles)) {
await Promise.all(data.removedFiles.map(async function (filepath) {
await fileList.removeFile(path.resolve(config.basePath, filepath))
fullRefresh = false
}))
- 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 83.
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 3 locations. Consider refactoring. Open
if (helper.isArray(data.addedFiles)) {
await Promise.all(data.addedFiles.map(async function (filepath) {
await fileList.addFile(path.resolve(config.basePath, filepath))
fullRefresh = false
}))
- 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 83.
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
Browser
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Browser {
constructor (id, fullName, collection, emitter, socket, timer, disconnectDelay,
noActivityTimeout, singleRun, clientConfig) {
this.id = id
this.fullName = fullName
Function createErrorFormatter
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createErrorFormatter (config, emitter, SourceMapConsumer) {
const basePath = config.basePath
const urlRoot = config.urlRoot === '/' ? '' : (config.urlRoot || '')
let lastServedFiles = []
Function serialize
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serialize (node, context, fn, eventTarget) {
if (!node) return '';
if ('function' === typeof context) {
fn = context;
context = null;
Function serialize
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serialize (node, context, fn, eventTarget) {
if (!node) return '';
if ('function' === typeof context) {
fn = context;
context = null;
Function parseProxyConfig
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseProxyConfig (proxies, config) {
proxies = proxies || []
return _.sortBy(_.map(proxies, function (proxyConfiguration, proxyPath) {
if (typeof proxyConfiguration === 'string') {
proxyConfiguration = { target: proxyConfiguration }
Function setupContext
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.setupContext = function (contextWindow) {
// If we clear the context after every run and we already had an error
// then stop now. Otherwise, carry on.
if (self.config.clearContext && hasError) {
return
Function setupContext
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.setupContext = function (contextWindow) {
// If we clear the context after every run and we already had an error
// then stop now. Otherwise, carry on.
if (self.config.clearContext && hasError) {
return
Function stop
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.stop = function (cliOptionsOrConfig, done) {
cliOptionsOrConfig = cliOptionsOrConfig || {}
const log = logger.create('stopper')
done = helper.isFunction(done) ? done : process.exit
Function decode
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function decode(input) {
// Don't use UCS-2
var output = [],
inputLength = input.length,
out,
Function decode
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function decode(input) {
// Don't use UCS-2
var output = [],
inputLength = input.length,
out,
Function BaseLauncher
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function BaseLauncher (id, emitter) {
if (this.start) {
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 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (wallaby) {
return {
files: [
{
pattern: 'package.json',
Similar blocks of code found in 2 locations. Consider refactoring. Open
exports.saveOriginalArgs = (config) => {
if (config && config.client && config.client.args) {
config.client.originalArgs = _.cloneDeep(config.client.args)
}
}
- 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 75.
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
exports.restoreOriginalArgs = (config) => {
if (config && config.client && config.client.originalArgs) {
config.client.args = _.cloneDeep(config.client.originalArgs)
}
}
- 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 75.
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 StatusUpdater
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function StatusUpdater (socket, titleElement, bannerElement, browsersElement) {
function updateBrowsersInfo (browsers) {
if (!browsersElement) {
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 launchSingle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
launchSingle (protocol, hostname, port, urlRoot, upstreamProxy, processKillTimeout) {
if (upstreamProxy) {
protocol = upstreamProxy.protocol
hostname = upstreamProxy.hostname
port = upstreamProxy.port
Function resolve
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolve (plugins, emitter) {
const modules = []
function requirePlugin (name) {
log.debug(`Loading plugin ${name}.`)
Function _refresh
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
_refresh () {
const matchedFiles = new Set()
let lastCompletedRefresh = this._refreshing
lastCompletedRefresh = Promise.all(