Showing 84 of 84 total issues
Function exports
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(env, lib, repl, local) {
function ReplHistory() {
this.help = 'Shows command history';
var maxSize = 10240
Function exports
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Table, env, lib, repl, local) {
function Modules() {
this.help = 'Lists all of the modules within this project';
this.table = new Table({
head: [
Function Models
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Models() {
this.help = 'Lists all of the models within this project';
this.models = {};
this.table = new Table({
head: [
Function npmRegistry
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
var searchNPMRegistry = exports.npmRegistry = function(queries) {
return new Promise(function(resolve, reject) {
var repos = [];
async.each(
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (thePath, program, cmd, args) {
if (arguments.length < 4) {
args = cmd;
cmd = program;
program = require(path.join(__dirname, 'program'));
Function aggregate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.aggregate = function(args) {
return new Promise(function(resolve, reject) {
var all = [];
utils.info(' Searching for modules...');
Function installPeerModules
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function installPeerModules(project, dependencies, projectDir) {
var originalCwd = process.cwd();
return new Promise(function(resolve, reject) {
projectDir = typeof projectDir !== 'undefined' ? projectDir : project;
Function exports
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Table, env, lib, repl, local) {
function Commands() {
this.help = 'Lists all of the REPL commands';
this.aliases = ['h', 'help'];
this.table = new Table({
Function Services
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Services() {
this.help = 'Lists all of the services within this project';
this.services = {};
this.table = new Table({
head: [
Function get
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
var get = exports.get = function(pkg, url, dir) {
if (arguments.length < 3) {
var name = pkg.name.split('@')[ 0 ];
dir = url;
url = 'https://github.com/' + pkg.owner + '/' + name + '/archive/master.tar.gz';
Function runTask
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runTask(projectFolder, command) {
var args = [].slice.call(arguments, 1);
return new Promise(function(resolve, reject) {
var cmd = !isWin ? 'grunt' : 'grunt.cmd'
Function ReplHistory
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ReplHistory() {
this.help = 'Shows command history';
var maxSize = 10240
, lastLine = null
Function generateRun
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateRun(projects, tmpls, names, fn) {
async.each(
projects,
function(project, next) {
generator.fs
Function installFrontendModules
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var installFrontendModules = exports.installFrontendModules = function(location, packages) {
return new Promise(function(resolve, reject) {
async.eachSeries(
packages,
function(pkg, next) {
Function installWithBower
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.installWithBower = function(location, packages) {
return new Promise(function(resolve, reject) {
async.each(
packages,
function(pkg, next) {
Function initBar
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.initBar = function() {
if (undefined === bar) {
bar = require('node-status');
bar.clear();
Function generateScaffold
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateScaffold(project, name, filterOut, fn) {
var _path = path.join(__dirname, '..', 'templates', project.name)
, walk = require('findit')(_path)
, dirs = []
, files = []
Function bower
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var searchBower = exports.bower = function(query) {
return new Promise(function(resolve) {
var pkg = query.split('@');
_pkg.getJSON({
Function listBower
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function listBower() {
return new Promise(function(resolve) {
var repos = [];
utils.info(' Searching Bower...');
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!!program.verbose) {
readline
.createInterface({
input : posixProc.stdout,
terminal : 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 60.
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