Showing 173 of 964 total issues
File ExpressionManager.js
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import log from 'loglevel';
import { Observable } from 'rxjs';
Function render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const styles = {
tree: {
marginLeft: 16,
whiteSpace: 'nowrap',
Function renderLabel
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderLabel(
isSelected,
isSelectable,
isInitiallyExpanded,
canBecomeCurrentRoot,
Function render
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const setDateState = (nothing, date) => {
const year = getYear(date);
const month = getTwoDigitMonth(date);
this.setState({ date, year, month }, this.handleChange);
File FileMenu.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
import { mui3theme } from '@dhis2/d2-ui-core';
import { withStyles } from '@material-ui/core/styles';
File TreeView.component.spec.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { shallow } from 'enzyme';
import TreeView from '../TreeView.component';
describe('TreeView component', () => {
Function render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const headerBannerWrapperStyle = {
width: 155,
height: 44,
verticalAlign: 'middle',
Function insertMarkers
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
const insertMarkers = (mode, cb) => {
const { selectionStart: start, selectionEnd: end, value } = state.element;
const marker = markerMap[mode] || null;
if (!marker || !cb || start < 0) {
return;
- 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 SelectFieldExample
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function SelectFieldExample (props) {
return(
<div style={style}>
<SelectField
label="Select animal"
File header-bar-styles.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
import 'rxjs/add/operator/debounceTime';
import log from 'loglevel';
import curry from 'lodash/fp/curry';
Function getStubContext
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getStubContext() {
return {
d2: {
i18n: {
getTranslation(key) {
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const styles = {
scale: {
width: 36 * this.state.classes,
minWidth: 36 * this.state.classes,
Function constructor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (props) {
super(props);
const d2 = props.d2;
this.state = {
Function getPeriod
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
getPeriod() {
const week = this.props.periodType === 'BiWeekly' && this.state.biWeek
? biWeekToWeek(this.state.biWeek)
: this.state.week;
const date = this.state.year && week && getFirstDateOfWeek(this.state.year, week);
- 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 render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const dataElement = this.props.d2.models.dataElement.create({
"code":"DE_11486142",
"created":"2011-04-20T15:54:58.775+0000",
"lastUpdated":"2016-06-29T07:30:50.235+0000",
Function TableContextMenu
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function TableContextMenu(props, context) {
const actionList = Object
.keys(props.actions)
.filter(menuActionKey => typeof props.actions[menuActionKey] === 'function');
Function getOrgUnitsForLevel
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getOrgUnitsForLevel(level, ignoreCache = false) {
const d2 = this.context.d2;
return new Promise((resolve) => {
if (this.props.currentRoot) {
const rootLevel = this.props.currentRoot.level || this.props.currentRoot.path
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const classList = classes(
'd2-ui-table__rows__row',
{
'd2-ui-table__rows__row--even': !this.props.isOdd,
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { open, fileType } = this.props;
return (
<Dialog open={open} onClose={this.onRequestClose} maxWidth="md">
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { open, fileType } = this.props;
return (
<Dialog open={open} onClose={this.onRequestClose} maxWidth="md">