Showing 386 of 386 total issues
Avoid too many return
statements within this function. Open
return Promise.reject(exceptions.ValidationError('unrecognized response type',
{ source: helpers.clone(responseConfig) }));
Similar blocks of code found in 2 locations. Consider refactoring. Open
lockAcquireDuration: new prometheus.Histogram({
name: 'mb_lock_acquire_duration_seconds',
help: 'Time it takes to acquire a file lock',
buckets: [0.1, 0.2, 0.5, 1, 3, 5, 10, 30],
labelNames: ['caller']
- 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 45.
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
Avoid too many return
statements within this function. Open
return 'this month';
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return this.inMemory();
Similar blocks of code found in 2 locations. Consider refactoring. Open
proxyDuration: new prometheus.Histogram({
name: 'mb_proxy_duration_seconds',
help: 'Time it takes to get the response from the downstream service',
buckets: [0.1, 0.2, 0.5, 1, 3, 5, 10, 30],
labelNames: ['imposter']
- 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 45.
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
marked
Regular Expression Denial of Service Open
"marked": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.1.1.tgz",
"integrity": "sha512-0cNMnTcUJPxbA6uWmCmjWz4NJRe/0Xfk2NhXCUHjew9qJzFN20krFnsUe7QynwqOwa5m1fZ4UDg0ycKFVC0ccw==",
"dev": true
- Read upRead up
- Exclude checks
Regular Expression Denial of Service
Overview:
The marked module is vulnerable to a regular expression denial of service. Based on the information published in the public issue, 1k characters can block for around 6 seconds.
Recommendation:
Consider another markdown parser until the issue can be addressed.
marked
Regular Expression Denial of Service Open
"marked": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.1.1.tgz",
"integrity": "sha512-0cNMnTcUJPxbA6uWmCmjWz4NJRe/0Xfk2NhXCUHjew9qJzFN20krFnsUe7QynwqOwa5m1fZ4UDg0ycKFVC0ccw==",
"dev": true
- Read upRead up
- Exclude checks
Regular Expression Denial of Service
Overview:
The marked module is vulnerable to a regular expression denial of service. Based on the information published in the public issue, 1k characters can block for around 6 seconds.
Recommendation:
Consider another markdown parser until the issue can be addressed.
Function parseLogConfiguration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function parseLogConfiguration (args) {
// Not defaulted in yargs so we can test yargs value without defaulting interfering.
// This is needed for backwards compatibility with older CLI options.
const defaultConfig = {
level: 'info',
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function create (logfile) {
function getLogEntries () {
if (!logfile || !fs.existsSync(logfile)) {
return [{ level: 'error', message: 'No logfile' }];
}
- 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 rawArgvIndexFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function rawArgvIndexFor (key) {
// Use raw process.argv to ensure user actually passed the parameter, bypassing
// yargs defaulting. Also check alias.
let index = process.argv.indexOf(`--${key}`);
if (index < 0) {
- 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
Rule doesn't have all its properties in alphabetical order. Open
body {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
header p {
- Exclude checks
Using width with padding-left can sometimes make elements larger than you expect. Open
padding-left: 1em;
- Exclude checks
Don't use IDs in selectors. Open
#sidenav {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
footer nav {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
nav.horizontal a:link, a:visited {
- Exclude checks
Using width with padding can sometimes make elements larger than you expect. Open
padding: 4px;
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
nav.vertical p {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
#sidenav {
- Exclude checks