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'),
|
||||
disabled: obj.inCatalog() ? true : obj.isLessThan95ORNonSPL,
|
||||
deps: ['lanname'],
|
||||
depChange: (state, source) => (
|
||||
(source[source.length - 1] !== 'lanname') ? undefined : (
|
||||
obj.isLessThan95ORNonSPL(state)
|
||||
) ? {
|
||||
depChange: (state, source) => {
|
||||
if (source[source.length - 1] === 'lanname' && obj.isLessThan95ORNonSPL(state)) {
|
||||
return {
|
||||
provolatile: null,
|
||||
proisstrict: false,
|
||||
procost: null,
|
||||
proleakproof: false,
|
||||
proparallel: null,
|
||||
} : (
|
||||
obj.isLessThan95ORNonSPL(state) ? { proparallel: null } : undefined
|
||||
)
|
||||
),
|
||||
};
|
||||
}
|
||||
},
|
||||
},{
|
||||
id: 'prosecdef', label: gettext('Security of definer?'),
|
||||
group: gettext('Options'), type: 'switch',
|
||||
|
@ -154,33 +154,37 @@ export const createFieldControls = ({
|
||||
isPropertyMode ? 'Properties-controlRow' : 'FormView-controlRow';
|
||||
break;
|
||||
default:
|
||||
{
|
||||
control = (
|
||||
hasView(field.type) ? View(field.type) : (
|
||||
field.id ? MappedFormControl : StaticMappedFormControl
|
||||
)
|
||||
);
|
||||
if (hasView(field.type)) {
|
||||
control = View(field.type);
|
||||
} else if (field.id) {
|
||||
control = MappedFormControl;
|
||||
} else {
|
||||
control = StaticMappedFormControl;
|
||||
}
|
||||
|
||||
if (inlineGroup) {
|
||||
controlProps['withContainer'] = false;
|
||||
controlProps['controlGridBasis'] = 3;
|
||||
}
|
||||
if (inlineGroup) {
|
||||
controlProps['withContainer'] = false;
|
||||
controlProps['controlGridBasis'] = 3;
|
||||
}
|
||||
|
||||
controlProps['className'] = field.isFullTab ? '' : (
|
||||
isPropertyMode ? 'Properties-controlRow' : 'FormView-controlRow'
|
||||
);
|
||||
if (field.isFullTab) {
|
||||
controlProps['className'] = '';
|
||||
} else if (isPropertyMode) {
|
||||
controlProps['className'] = 'Properties-controlRow';
|
||||
} else {
|
||||
controlProps['className'] = 'FormView-controlRow';
|
||||
}
|
||||
|
||||
if (field.id) {
|
||||
controlProps['id'] = field.id;
|
||||
controlProps['onChange'] = (changeValue) => {
|
||||
// Get the changes on dependent fields as well.
|
||||
dataDispatch?.({
|
||||
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
||||
path: controlProps.accessPath,
|
||||
value: changeValue,
|
||||
});
|
||||
};
|
||||
}
|
||||
if (field.id) {
|
||||
controlProps['id'] = field.id;
|
||||
controlProps['onChange'] = (changeValue) => {
|
||||
// Get the changes on dependent fields as well.
|
||||
dataDispatch?.({
|
||||
type: SCHEMA_STATE_ACTIONS.SET_VALUE,
|
||||
path: controlProps.accessPath,
|
||||
value: changeValue,
|
||||
});
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ def get_binary_path_versions(binary_path: str) -> dict:
|
||||
# if path doesn't exist raise exception
|
||||
if not os.path.isdir(binary_path):
|
||||
current_app.logger.warning('Invalid binary path.')
|
||||
raise Exception()
|
||||
raise FileNotFoundError()
|
||||
# Get the output of the '--version' command
|
||||
cmd = subprocess.run(
|
||||
[full_path, '--version'],
|
||||
@ -390,8 +390,6 @@ def get_binary_path_versions(binary_path: str) -> dict:
|
||||
)
|
||||
if cmd.returncode == 0:
|
||||
ret[utility] = cmd.stdout.split(") ", 1)[1].strip()
|
||||
else:
|
||||
raise Exception()
|
||||
except Exception as _:
|
||||
continue
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user