Showing 365 of 1,033 total issues
File add-to-collection-modal.js
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as bootstrap from 'react-bootstrap';
import {faPlus, faTimes} from '@fortawesome/free-solid-svg-icons';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import PropTypes from 'prop-types';
import React from 'react';
Function render
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const warnMessage = 'Are you sure? You entered a date in the future!';
const labelElement = (
<ValidationLabel
empty={this.props.empty}
Function LicensingPage
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function LicensingPage(): JSX.Element {
const CC0Link = 'http://creativecommons.org/publicdomain/zero/1.0/';
const CC0Image = 'http://i.creativecommons.org/p/zero/1.0/88x31.png';
const CCBYSALink = 'http://creativecommons.org/licenses/by-sa/4.0/';
File userCollection.js
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2020 Prabal Singh
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Function EntityMerge
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const EntityMerge = (props: Props) => {
const {
children,
mergingEntities,
identifierSet,
Function editionGroupToFormState
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function editionGroupToFormState(editionGroup) {
/** The front-end expects a language id rather than the language object. */
const aliases = editionGroup.aliasSet ?
editionGroup.aliasSet.aliases.map(({languageId, ...rest}) => ({
...rest,
File name-section.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2016 Ben Ockmore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Function render
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div>
{
this.props.user ?
Function render
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let errorComponent = null;
if (this.state.error) {
errorComponent =
<Alert variant="danger">{this.state.error}</Alert>;
Function transformFormData
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function transformFormData(data:Record<string, any>):Record<string, any> {
const newData = {};
const nextId = 0;
// add new series
_.forEach(data.Series, (series, sid) => {
File collection.js
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2020 Prabal Singh
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Function render
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {onCancel, onClose, baseEntity} = this.props;
const baseEntityTypeForDisplay = _.startCase(baseEntity.type);
const submitDisabled = this.calculateProgressAmount() < 100;
const entitySelect = this.renderEntitySelect();
Function IdentifierTypeEditor
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
function IdentifierTypeEditor({identifierTypeData, parentTypes}: IdentifierTypeEditorPropsT) {
const [formData, setFormData] = useState<IdentifierTypeDataT>(identifierTypeData);
// State for the ParentType modal
const [showModal, setShowModal] = useState<boolean>(false);
- 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 SingleEntityCard
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function SingleEntityCard({entity, languageOptions}:SingleEntityCardProps) {
const id2LanguageMap = React.useMemo(() => Object.fromEntries(_.map(languageOptions, (option) => [option.id, option.name])), []);
// display formatted entity attributes in modal
function renderField(path, key) {
let fieldVal = _.get(entity, path, '');
- 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 EditorContainer
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function EditorContainer(props) {
const {tabActive, editor, children, user} = props;
return (
<div>
File work.ts
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2015 Ben Ockmore
* 2015-2016 Sean Burke
*
* This program is free software; you can redistribute it and/or modify
Function render
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const ShowServiceOption = (optionData) => {
const {
service, value, title, details
} = optionData;
File edition-group.ts
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2015 Ben Ockmore
* 2015-2016 Sean Burke
*
* This program is free software; you can redistribute it and/or modify
File entity.tsx
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2016 Daniel Hsing
* 2019 Akhilesh Kumar (@akhilesh26)
*
* This program is free software; you can redistribute it and/or modify
Function renderBasicInfo
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderBasicInfo() {
const {user, editor} = this.props;
const {
cachedMetabrainzName,
metabrainzUserId,