Showing 7 of 49 total issues
Function render
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { items, multiselect, sort, onKeyDown, onPicked } = this.props
let ids = items.map((record: Record) => record.id)
let selected = ids.filter(this.isPicked, this)
Function renderRow
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderRow(item: Record, index: number, list: Record[]) {
const { id, name, attribution, caption, url, tags } = item
const { multiselect, onPicked, onTagClick } = this.props
let animationDelay = itemAnimationDelay(index) + 'ms'
Function renderItems
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderItems(data: Record[], fetching: boolean) {
const { columns, multiselect } = this.props
const { mode, picked, queriedSearch, sort } = this.state
if (data.length === 0) {
Function getItem
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getItem(record: Record, index: number, list: Record[]) {
const { onPicked } = this.props
let isPicked = this.isPicked(record.id)
let delay = Math.max(0, itemAnimationDelay(index) - this.offset)
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { resource, ids, onEdit, onClear } = this.props
let hasPicked = ids.length
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let { search, autoComplete, data } = this.props
let inputId = `ars_search_${this.id}`
let listId = `ars_search_list_${this.id}`
Function accumulate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
accumulate(requests: Request[]): Record[] {
let data = []
let newContent = requests.some(request => request.valid && !request.fetching)
for (var i = 0; i < requests.length; i += 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"