Showing 207 of 207 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
export class Suggestion extends DefaultSuggestion {
constructor(...args) {
super(...args);
var name = 'python_django';
- 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 160.
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
export class Suggestion extends DefaultSuggestion {
constructor(...args) {
super(...args);
var name = 'python_django';
- 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 160.
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
File configure.js
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { _, t, os, log, lazy_require, fsAsync } from 'azk';
import { publish } from 'azk/utils/postal';
import { async, promisify, thenAll, promiseResolve } from 'azk/utils/promises';
import { config, set_config } from 'azk';
import { UIProxy } from 'azk/cli/ui';
File run.js
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { _, t, lazy_require, isBlank } from 'azk';
import { config, log, path } from 'azk';
import { subscribe, publish } from 'azk/utils/postal';
import { defer, async, asyncUnsubscribe, promiseResolve, thenAll } from 'azk/utils/promises';
import { ImageNotAvailable, SystemRunError, RunCommandError, NotBeenImplementedError } from 'azk/utils/errors';
Function run
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function run(docker, Container, image, cmd, opts = { }) {
var container = null;
opts.stdout = opts.stdout || process.stdout;
opts.stderr = opts.stderr || opts.stdout;
Function _scale
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
_scale(system, instances = {}, opts = undefined) {
var flags = {};
var _subscription = subscribe('#.status', (event) => {
if (!event) { return; }
var type;
- 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
File index.js
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { path, fs, config, _, t, log, lazy_require, isBlank } from 'azk';
import { System } from 'azk/system';
import { Validate } from 'azk/manifest/validate';
import { ManifestError, ManifestRequiredError, SystemNotFoundError } from 'azk/utils/errors';
import Utils from 'azk/utils';
UI
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
var UI = {
isUI: true,
t: t,
_interactive: true,
Function build
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function build(docker, options) {
return async(function* () {
var opts = _.extend({
cache: true
}, options);
Function constructor
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(opts) {
this.opts = _.merge({
namespace: config('configuration:namespace'),
}, opts);
Manifest
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
export class Manifest {
constructor(cwd, file = null, required = false) {
if (typeof file == "boolean") {
[required, file] = [file, null];
}
Function index
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
index() {
var { options } = this.normalized_params;
var args = this.normalized_params.arguments;
var _subscription = subscribe('docker.pull.status', (data) => {
Function _validate_wait_option
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _validate_wait_option(manifest) {
return _.reduce(manifest.systems, (errors, system) => {
// ignore if it is not present or equal false
if (typeof system.options.wait === 'undefined' || system.options.wait === false) {
File balancer.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { _, t, path, fsAsync, config, log } from 'azk';
import { async, defer, promisifyAll, thenAll, promiseResolve } from 'azk/utils/promises';
import { lazy_require } from 'azk';
import { net } from 'azk/utils';
Function index
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
index() {
return async(this, function* () {
let args = this.normalized_params.arguments;
let options = this.normalized_params.options;
Function subscribeTo
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
subscribeTo(topic) {
if (topic) {
var subscribe_topic = topic;
var subscribe = azk_channel.subscribe.bind(azk_channel);
var log = require("azk/utils/log").log;
File get_project.js
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { path, lazy_require, config, log, fsAsync } from 'azk';
import { async, promiseResolve, promiseReject } from 'azk/utils/promises';
import { UIProxy } from 'azk/cli/ui';
import { matchFirstRegex, matchAllRegex, fulltrim } from 'azk/utils/regex_helper';
import { printOutput } from 'azk/utils/spawn_helper';
Function _scale
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
_scale(system, instances = {}, opts = undefined) {
var flags = {};
var _subscription = subscribe('#.status', (event) => {
if (!event) { return; }
var type;
Function _make_options
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
_make_options(daemon, options = {}, image_conf = {}) {
// Default values
options = _.defaults(options, {
workdir: this.options.workdir,
mounts: {},
Function __convertFoldersToSystems
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
__convertFoldersToSystems() {
let systems = {};
let not_version = [];
_.forEach(this.__folder_evidences_suggestion, function(folder_evidence_suggestion) {