Showing 269 of 269 total issues
Function run
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(environmentPromiseHash) {
if (environmentPromiseHash === undefined) {
return Promise.reject(new Error('Unable to execute "run" command without environment argument'));
}
let shutdownOnExit = null;
- Create a ticketCreate a ticket
Function createBlueprints
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createBlueprints(options) {
let name = options.args[0];
let noAddonBlueprint = ['mixin', 'blueprint-test'];
let entity = {
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
memorySwapUsed(platform = process.platform) {
switch (platform) {
case 'darwin':
return memorySwapUsedDarwin();
- Read upRead up
- Create a ticketCreate a ticket
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 90.
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
isUsingBattery(platform = process.platform) {
switch (platform) {
case 'darwin':
return isUsingBatteryDarwin();
- Read upRead up
- Create a ticketCreate a ticket
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 90.
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
PackageInfo
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class PackageInfo {
constructor(pkgObj, realPath, cache, isRoot = false) {
this.pkg = pkgObj;
this.pkg['ember-addon'] = this.pkg['ember-addon'] || {};
this.realPath = realPath;
- Create a ticketCreate a ticket
Function _import
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
_import(assetPath, options, directory, subdirectory, extension) {
// TODO: refactor, this has gotten very messy. Relevant tests: tests/unit/broccoli/ember-app-test.js
let basename = path.basename(assetPath);
if (p.isType(assetPath, 'js', { registry: this.registry })) {
- Create a ticketCreate a ticket
Function exports
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (initialMargin, shouldDescriptionBeGrey) {
initialMargin = initialMargin || '';
let output = '';
- Create a ticketCreate a ticket
Function _fileMapTokens
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_fileMapTokens(options) {
let { project } = this;
let standardTokens = {
__name__(options) {
if (options.pod && options.hasPathToken) {
- Read upRead up
- Create a ticketCreate a ticket
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 contentFor
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function contentFor(config, match, type, options) {
let content = [];
// This normalizes `rootURL` to the value which we use everywhere inside of Ember CLI.
// This makes sure that the user doesn't have to account for it in application code.
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
addonPromises = this.project.addons.reduce((sum, addon) => {
let method = addon[buildStep];
if (method) {
let val = method.call(addon, results);
if (val) {
- Read upRead up
- Create a ticketCreate a ticket
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 81.
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 (this.options.addons.include && this.options.addons.include.length) {
throw new Error(
[
`[ember-cli] addon bundle caching is disabled for apps that specify an addon "include"`,
'',
- Read upRead up
- Create a ticketCreate a ticket
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 81.
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 (this.options.addons.exclude && this.options.addons.exclude.length) {
throw new Error(
[
`[ember-cli] addon bundle caching is disabled for apps that specify an addon "exclude"`,
'',
- Read upRead up
- Create a ticketCreate a ticket
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 81.
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
return this.project.addons.reduce((sum, addon) => {
let method = addon[methodName];
if (method) {
let val = method.apply(addon, invokeArguments);
if (val) {
- Read upRead up
- Create a ticketCreate a ticket
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 81.
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 mergeTrees
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function mergeTrees(_inputTrees, options) {
options = options || {};
let node = heimdall.start(
{
- Create a ticketCreate a ticket
Function insertIntoFile
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function insertIntoFile(fullPath, contentsToInsert, providedOptions) {
let options = providedOptions || {};
let returnValue = {
path: fullPath,
- Create a ticketCreate a ticket
Function createBlueprints
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
async createBlueprints(options) {
let name = options.args[0];
let noAddonBlueprint = ['mixin', 'blueprint-test'];
let entity = {
- Read upRead up
- Create a ticketCreate a ticket
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 getAddonInstance
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
getAddonInstance(parent, addonPkgInfo) {
// If the new addon is itself a bundle host (i.e. lazy engine), there is only one
// instance of the bundle host, and it's in the entries of the bundleHostCache, outside
// of the 'regular' addon caches. Because 'setupBundleHostCache' ran during construction,
// we know that an entry is in the cache with this engine name.
- Create a ticketCreate a ticket
Function getAddonProxy
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getAddonProxy(targetCacheEntry, parent) {
let _app;
// handle `preprocessJs` separately for Embroider
//
- Create a ticketCreate a ticket
Function run
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(options) {
let hasBuild = !!options.path;
if (hasBuild) {
if (!fs.existsSync(options.path)) {
- Create a ticketCreate a ticket
Function locals
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
locals(options) {
let entity = { name: 'dummy' };
let rawName = entity.name;
let name = stringUtil.dasherize(rawName);
let namespace = stringUtil.classify(rawName);
- Create a ticketCreate a ticket