Showing 179 of 3,635 total issues
Function prepareMetadata
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
prepareMetadata(doc, templates, thesauris) {
const template = templates.find(t => t._id === doc.template);
if (!template || !thesauris.length) {
return { ...doc, metadata: [], documentType: '' };
- 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 updateSuggestions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const updateSuggestions = (
currentSuggestions: TableSuggestion[],
suggestionsToAccept: TableSuggestion[]
): TableSuggestion[] => {
if (!suggestionsToAccept.length) {
- 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 ValidatedElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const ValidatedElement = (
type: string | React.JSXElementConstructor<any>,
props: (React.Attributes & { children?: React.ReactNode }) | null,
children: React.ReactNode[],
sanitized = true
- 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 prettifyError
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const prettifyError = (error, { req = {}, uncaught = false } = {}) => {
let result = error;
if (error instanceof Error) {
result = { code: 500, message: util.inspect(error), logLevel: 'error' };
- 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 Geolocation
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const Geolocation = ({
name,
onChange,
className,
disabled,
- 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 getFormValue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const getFormValue = (
suggestion?: EntitySuggestionType,
entity?: ClientEntitySchema,
type?: string
) => {
- 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 Account
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const Account = () => {
const userAccount = useLoaderData() as ClientUserSchema;
const [isSidepanelOpen, setIsSidepanelOpen] = useState(false);
const [confirmationModal, setConfirmationModal] = useState(false);
const passwordConfirmation = useRef<string>();
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
render() {
let submitLabel = this.state.recoverPassword ? (
<Translate>Send recovery email</Translate>
) : (
<Translate>Login</Translate>
- 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 getPropertyType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const getPropertyType = (property, templates) => {
if (property.inherit?.property) return property.inherit.type;
//relationships v2
if (property.type === 'newRelationship') {
if (property.denormalizedProperty) {
- 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 inherit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
inherit(property, propValue, thesauri, options, templates) {
const propertyInfo = Immutable.fromJS({
label: property.get('label'),
name: property.get('name'),
type: property.get('inherit').get('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
Function processQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const processQuery = (params, globalResources, key) => {
const defaultSearch = prioritySortingCriteria.get({ templates: globalResources.templates });
let query = decodeQuery(params);
- 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 HideColumnsComponent
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const HideColumnsComponent = ({
setTableViewAllColumnsHidden: setAllColumnsHidden,
setTableViewColumnHidden: setColumnHidden,
columns: columnsMap,
}: HideColumnsComponentProps) => {
- 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 newRelationshipWithInherit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
newRelationshipWithInherit(property, propValue, thesauri, options, templates) {
const label = property.get('label');
const name = property.get('name');
const denormalizedProperty = property.get('denormalizedProperty');
const type = getPropertyType(denormalizedProperty, templates);
- 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 Collection
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const Collection = () => {
const { settings, templates } = useLoaderData() as {
settings: ClientSettings;
templates: Template[];
};
- 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 FiltersSidepanel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const FiltersSidepanel = ({
showSidepanel,
setShowSidepanel,
onSave,
availableTemplates,
- 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 ParagraphExtractorDashboard
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const ParagraphExtractorDashboard = () => {
const { extractors = [] } = useLoaderData() as {
extractors: ParagraphExtractorApiResponse[];
};
- 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 getFilesForTraining
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function getFilesForTraining(templates: ObjectIdSchema[], property: string) {
const propertyType = await getPropertyType(templates, property);
const entities = await entitiesModel.getUnrestricted(
entityForTrainingQuery(templates, property, propertyType),
`sharedId metadata.${property} language`
- 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 fileExists
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const fileExists = async filePath =>
new Promise((resolve, reject) => {
fs.stat(filePath, err => {
if (err === null) {
resolve(true);
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const run = async () => {
const redisClient = Redis.createClient(redisUrl);
const redisSMQ = new RedisSMQ({ client: redisClient });
const readFirstTaskMessage = async () => {
- 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 save
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async save(_relationships, language, updateEntities = true) {
if (!language) {
throw createError('Language cant be undefined');
}
- 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"