Showing 165 of 459 total issues
Function isAuthenticatedValidationImpl
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const isAuthenticatedValidationImpl: ValidationImplType<void> = async (
req,
protectedRoute: boolean
) => {
try {
Function useEntityReferenceCount
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useEntityReferenceCount = (
entities: string[],
reference: { entity: string; entityId: string }
) => {
const multipleEntityReferenceFields =
Function delete
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async delete(
entity: string,
id: string,
accountProfile: IAccountProfile
): Promise<void> {
Function useRevealedCredentialsList
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useRevealedCredentialsList = (
group: IntegrationsConfigurationGroup
) => {
const rootPassword = usePasswordStore((state) => state.password);
const queryClient = useQueryClient();
Function buildFilterConfigFromType
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const buildFilterConfigFromType = (prop: {
entityType: FormFieldTypes;
entityFieldSelections: IColorableSelection[];
isIdField: boolean;
referenceField?: string;
Function PersistentDocumentation
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function PersistentDocumentation() {
return (
<DocumentationRoot>
<p>
Persistent query is used to define a set of queries that are persisted
Function doesPermissionAllowPermission
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const doesPermissionAllowPermission = (
permissions: string[],
requiredPermission: string,
checkGranular: boolean
): boolean => {
Function getRelationshipSettings
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getRelationshipSettings(entity: string): Promise<{
format: string;
fields: string[];
}> {
const relationshipSettings = await this._configurationApiService.show(
Function rgbToOklch
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const rgbToOklch = (rgb: TRGB): TLCH => {
const r = rgb.r / 255;
const g = rgb.g / 255;
const b = rgb.b / 255;
Function do
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
do: async (config: IActionConfig, messageConfig: IConfig) => {
return await makeIntegrationRequest("POST", {
url: `https://api.sendgrid.com/v3/mail/send`,
body: JSON.stringify({
personalizations: [
Function EntityCrudSettings
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function EntityCrudSettings() {
const tabFromUrl = useRouteParam("tab");
const changeTabParam = useChangeRouterParam("tab");
const entity = useEntitySlug();
Function getEntityRelationsForUserRole
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getEntityRelationsForUserRole(
entity: string,
userRole: string
): Promise<IEntityRelation[]> {
const [validRelations, entityLabels, entityOrders] = await Promise.all([
Function Template
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Template: Story<ITableProps<unknown>> = (args) => {
const [paginatedDataState, setPaginatedDataState] = useState<
IPaginatedDataState<any>
>({ ...DEFAULT_TABLE_STATE });
Function ConfirmAlert
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ConfirmAlert() {
const { _ } = useLingui();
const [title, action, onClose] = useConfirmAlertStore((store) => [
store.title,
store.action,
Function StorageIntegrations
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function StorageIntegrations() {
const fileStorageDomainMessages = useDomainMessages(
LANG_DOMAINS.INTEGRATIONS.FILE_STORAGE
);
useSetPageDetails({
Function crudEnabledValidationImpl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const crudEnabledValidationImpl: ValidationImplType<void> = async (
req,
action: unknown
) => {
progammingError("Please provide the action for the CRUD check", !action);
Function defaultWidgets
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
.map(async (entity, index) => {
const dateField =
await this._entitiesApiService.getEntityFirstFieldType(
entity.value,
"date"
Function listData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async listData(
entity: string,
searchValue?: string
): Promise<{ value: string; label: string }[]> {
const [relationshipSettings, primaryField] = await Promise.all([
Function FormSelect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function FormSelect(formInput: IFormSelect) {
const {
input,
selectData,
meta,
Function filterOperatorToQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
filterOperatorToQuery(
query: T,
column: string,
{ operator, value, value2 }: IColumnFilterBag<unknown>,
groupOperator: "and" | "or"
- 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"