mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixing following SonarQube Issues:
1. Ternary operators should not be nested. 2. "Exception" and "BaseException" should not be raised.
This commit is contained in:
parent
a30a722e11
commit
2c37ff2893
@ -327,19 +327,17 @@ export default class FunctionSchema extends BaseUISchema {
|
|||||||
group: gettext('Options'),
|
group: gettext('Options'),
|
||||||
disabled: obj.inCatalog() ? true : obj.isLessThan95ORNonSPL,
|
disabled: obj.inCatalog() ? true : obj.isLessThan95ORNonSPL,
|
||||||
deps: ['lanname'],
|
deps: ['lanname'],
|
||||||
depChange: (state, source) => (
|
depChange: (state, source) => {
|
||||||
(source[source.length - 1] !== 'lanname') ? undefined : (
|
if (source[source.length - 1] === 'lanname' && obj.isLessThan95ORNonSPL(state)) {
|
||||||
obj.isLessThan95ORNonSPL(state)
|
return {
|
||||||
) ? {
|
|
||||||
provolatile: null,
|
provolatile: null,
|
||||||
proisstrict: false,
|
proisstrict: false,
|
||||||
procost: null,
|
procost: null,
|
||||||
proleakproof: false,
|
proleakproof: false,
|
||||||
proparallel: null,
|
proparallel: null,
|
||||||
} : (
|
};
|
||||||
obj.isLessThan95ORNonSPL(state) ? { proparallel: null } : undefined
|
}
|
||||||
)
|
},
|
||||||
),
|
|
||||||
},{
|
},{
|
||||||
id: 'prosecdef', label: gettext('Security of definer?'),
|
id: 'prosecdef', label: gettext('Security of definer?'),
|
||||||
group: gettext('Options'), type: 'switch',
|
group: gettext('Options'), type: 'switch',
|
||||||
|
@ -154,33 +154,37 @@ export const createFieldControls = ({
|
|||||||
isPropertyMode ? 'Properties-controlRow' : 'FormView-controlRow';
|
isPropertyMode ? 'Properties-controlRow' : 'FormView-controlRow';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
if (hasView(field.type)) {
|
||||||
control = (
|
control = View(field.type);
|
||||||
hasView(field.type) ? View(field.type) : (
|
} else if (field.id) {
|
||||||
field.id ? MappedFormControl : StaticMappedFormControl
|
control = MappedFormControl;
|
||||||
)
|
} else {
|
||||||
);
|
control = StaticMappedFormControl;
|
||||||
|
}
|
||||||
|
|
||||||
if (inlineGroup) {
|
if (inlineGroup) {
|
||||||
controlProps['withContainer'] = false;
|
controlProps['withContainer'] = false;
|
||||||
controlProps['controlGridBasis'] = 3;
|
controlProps['controlGridBasis'] = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
controlProps['className'] = field.isFullTab ? '' : (
|
if (field.isFullTab) {
|
||||||
isPropertyMode ? 'Properties-controlRow' : 'FormView-controlRow'
|
controlProps['className'] = '';
|
||||||
);
|
} else if (isPropertyMode) {
|
||||||
|
controlProps['className'] = 'Properties-controlRow';
|
||||||
|
} else {
|
||||||
|
controlProps['className'] = 'FormView-controlRow';
|
||||||
|
}
|
||||||
|
|
||||||
if (field.id) {
|
if (field.id) {
|
||||||
controlProps['id'] = field.id;
|
controlProps['id'] = field.id;
|
||||||
controlProps['onChange'] = (changeValue) => {
|
controlProps['onChange'] = (changeValue) => {
|
||||||
// Get the changes on dependent fields as well.
|
// Get the changes on dependent fields as well.
|
||||||
dataDispatch?.({
|
dataDispatch?.({
|
||||||
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
||||||
path: controlProps.accessPath,
|
path: controlProps.accessPath,
|
||||||
value: changeValue,
|
value: changeValue,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ def get_binary_path_versions(binary_path: str) -> dict:
|
|||||||
# if path doesn't exist raise exception
|
# if path doesn't exist raise exception
|
||||||
if not os.path.isdir(binary_path):
|
if not os.path.isdir(binary_path):
|
||||||
current_app.logger.warning('Invalid binary path.')
|
current_app.logger.warning('Invalid binary path.')
|
||||||
raise Exception()
|
raise FileNotFoundError()
|
||||||
# Get the output of the '--version' command
|
# Get the output of the '--version' command
|
||||||
cmd = subprocess.run(
|
cmd = subprocess.run(
|
||||||
[full_path, '--version'],
|
[full_path, '--version'],
|
||||||
@ -390,8 +390,6 @@ def get_binary_path_versions(binary_path: str) -> dict:
|
|||||||
)
|
)
|
||||||
if cmd.returncode == 0:
|
if cmd.returncode == 0:
|
||||||
ret[utility] = cmd.stdout.split(") ", 1)[1].strip()
|
ret[utility] = cmd.stdout.split(") ", 1)[1].strip()
|
||||||
else:
|
|
||||||
raise Exception()
|
|
||||||
except Exception as _:
|
except Exception as _:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user