Showing 56 of 56 total issues
Function buildCSS
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
export async function buildCSS (target, bundle, development, onlypaths, logger) {
let error = [];
process.stdout.write(`Building ${target} `);
let start = process.hrtime();
const ITEM = scfg.bundles[target] || new BundleItem(target, []);
- 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 buildCSS
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function buildCSS (target, bundle, development, onlypaths, logger) {
let error = [];
process.stdout.write(`Building ${target} `);
let start = process.hrtime();
const ITEM = scfg.bundles[target] || new BundleItem(target, []);
Function copystatic
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export default async function copystatic () {
const config = requireNoCache(ProyPath('config', 'static')).default.copy;
let promises = [];
for (const bundle of config) {
let compiled = false;
- 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 DetectChanges
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async function DetectChanges (changed) {
const newconf = requireNoCache(ProyPath('config', 'bundles.js')).default;
for (const bundle of Object.keys(newconf)) {
let mustrebuild = false;
if (allBundles[bundle]) {
- 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 constructor
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor () {
this.port = process.env.port;
this.env = process.env.NODE_ENV;
if (!fs.existsSync(ProyPath('.koaton'))) {
fs.writeFileSync(ProyPath('.koaton'), JSON.stringify({
Function buildJS
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function buildJS (target, bundle, development, onlypaths, logger) {
let error = [];
process.stdout.write(`Building ${target} `);
let start = process.hrtime();
const ITEM = scfg.bundles[target] || new BundleItem(target, []);
Function buildNginx
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export async function buildNginx () {
let nginxpath = await getnginxpath();
let conf = fs.readFileSync(nginxpath + 'nginx.conf', 'utf-8');
if (conf.indexOf('include sites-enabled/*') === -1) {
conf = conf.replace(/http ?\{/igm, 'http {\n\tinclude ./sites-enabled/*.conf;');
- 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 constructor
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (name, ...args) {
let [fields, relations = {}] = args;
if (fields === undefined) {
throw new Error('fields can\'t be undefined');
}
Function Action
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
.Action(async function Action (options) {
process.env.port = options.port || configuration.server.port;
options.production = options.production ? 'production' : 'development';
process.env.NODE_ENV = options.production;
const embercfg = configuration.ember;
Function buildJS
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export async function buildJS (target, bundle, development, onlypaths, logger) {
let error = [];
process.stdout.write(`Building ${target} `);
let start = process.hrtime();
const ITEM = scfg.bundles[target] || new BundleItem(target, []);
- 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 buildNginx
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function buildNginx () {
let nginxpath = await getnginxpath();
let conf = fs.readFileSync(nginxpath + 'nginx.conf', 'utf-8');
if (conf.indexOf('include sites-enabled/*') === -1) {
conf = conf.replace(/http ?\{/igm, 'http {\n\tinclude ./sites-enabled/*.conf;');
Similar blocks of code found in 2 locations. Consider refactoring. Open
function test () {
let script = '<script src="http://localhost:62627/livereload.js?snipver=1"></script>\n</body>';
glob.sync('coverage/**/*.html').forEach((file) => {
let index = fs.readFileSync(file, 'utf-8').replace('</body>', script);
fs.writeFileSync(file, index, 'utf-8');
- 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 84.
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
function test (...args) {
let script = '<script src="http://localhost:62627/livereload.js?snipver=1"></script>\n</body>';
glob.sync('doc/**/*.html').forEach((file) => {
let index = fs.readFileSync(file, 'utf-8').replace('</body>', script);
fs.writeFileSync(file, index, 'utf-8');
- 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 84.
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 buildBundles
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function buildBundles () {
if (Object.keys(configuration.bundles).length === 0) {
console.log(` ${__ok.green} No bundles defined`);
} else {
await utils.mkdir(ProyPath('public', 'js'), -1);
- 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 persistmodel
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default async function persistmodel (model, modelname, options) {
let override = await challenge(ProyPath('models', `${modelname}.js`), `The model ${modelname.green} already exits,do you want to override it?`, options.force);
if (override) {
write(ProyPath('models', modelname + '.js'), model.toCaminte());
if (options.rest) {
- 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 live
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async live (nginxbuilt, live) {
let storebuffer = '';
return new Promise(async resolve => {
let appst = { log: false, result: '', success: false, pid: null, process: null };
let port = await detect(4200);
Function copystatic
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function copystatic () {
const config = requireNoCache(ProyPath('config', 'static')).default.copy;
let promises = [];
for (const bundle of config) {
let compiled = false;
Function shell
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function shell (display, command, cwd = process.cwd()) {
return new Promise(function (resolve) {
let shelllog = '';
if (skipshell) {
console.log(`+ ${display}\t${__ok}`.green);
Function DetectChanges
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function DetectChanges (changed) {
const newconf = requireNoCache(ProyPath('config', 'bundles.js')).default;
for (const bundle of Object.keys(newconf)) {
let mustrebuild = false;
if (allBundles[bundle]) {
Function buildHosts
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildHosts = function buildHosts () {
const os = require('os');
let subdomains = configuration.server;
let hostname = subdomains.host;