Showing 94 of 322 total issues
File product.py
has 784 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from datetime import date, timedelta
from decimal import Decimal
from django.db import models
File test_product.py
has 594 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from datetime import date, timedelta
from decimal import Decimal
import pytest
Function insert_rows
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def insert_rows(ws, row_idx, cnt, above=False, copy_style=True,
fill_formulae=True): # flake8: noqa # pragma: no cover
"""Inserts new (empty) rows into worksheet at specified row index.
:param row_idx: Row index specifying where to insert new rows.
- 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 plotCumulativeSpendings
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function plotCumulativeSpendings(product, showBurnDown, startDate, endDate, elem, isSmall) {
const today = moment().format('YYYY-MM-DD');
const keyDatesFinancials = product.keyDatesFinancials;
const keyDates = Object.keys(keyDatesFinancials).sort();
const pastDates = keyDates.filter(d => d <= today).sort();
File forms.py
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from collections import defaultdict
import copy
import os
from decimal import Decimal
File test_task.py
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
from decimal import Decimal
from datetime import date
from django.test import TestCase
from model_mommy import mommy
File sync.py
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
export from float
"""
Product
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Product(BaseProduct, AditionalCostsMixin):
hr_id = models.CharField(max_length=12, unique=True, null=True)
float_id = models.CharField(max_length=128, unique=True)
is_billable = models.BooleanField(default=True)
area = models.ForeignKey('Area', related_name='products',
Function clean_payroll_file
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def clean_payroll_file(self):
start, end = self.cleaned_data.get('date_range')
if not start or not end:
raise ValidationError('No date supplied.')
- 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 product.js
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
import moment from 'moment';
import React, { Component } from 'react';
import Plotly from '../libs/plotly-custom';
import { plotCumulativeSpendings } from '../components/cumulative-graph';
Product
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
export class Product {
constructor(productJSON) {
Object.assign(this, productJSON);
}
File models.js
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
import 'whatwg-fetch';
import moment from 'moment';
import { startOfMonth, endOfMonth, thisCalendarYear,
thisFinancialYear, thisQuarter, lastCalendarYear,
Function normalMode
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalMode() {
const product = this.state.product;
const editButton = () => {
if (product.meta['can_edit']) {
return (
Function timeFrames
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
get timeFrames() {
const now = moment();
const result = {
'entire-time-span': {
name: 'Entire product life time',
Function plotMonthlySpendings
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function plotMonthlySpendings(product, startDate, endDate, elem, isSmall) {
const monthly = product.monthlyFinancials;
const months = Object.keys(monthly).sort()
.filter(m => endOfMonth(m) >= startDate && endOfMonth(m) <= endDate);
File cumulative-graph.js
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import moment from 'moment';
import Plotly from '../libs/plotly-custom';
import { round, monthRange } from '../libs/utils';
Function write
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def write(self, workbook, ws=None):
ws = workbook.get_active_sheet()
product = self.cleaned_data['product']
start_date, end_date = self.cleaned_data['date_range']
- 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 backgroundForPhases
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function backgroundForPhases(product, range, isSmall) {
const phases = product.phases;
const shapes = [];
const annotations = [];
Function sync_tasks
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def sync_tasks(start_date, end_date, data_dir):
logging.info('sync tasks')
source = os.path.join(data_dir, 'tasks.json')
with open(source, 'r') as sf:
data = json.loads(sf.read())
- 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 additional_rate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def additional_rate(self, start_date, end_date, name=None,
predict_based_on=None):
costs = self.get_costs_between(start_date, end_date, name=name)
if not self.is_contractor and not costs:
# If additional costs haven't been added for the month then
- 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"