mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Apply syntax check before running black
This commit is contained in:
parent
3312bf1ad2
commit
a4f325c92f
@ -184,7 +184,7 @@ def somefunc(param1: str='', param2=0):
|
||||
'''A docstring'''
|
||||
if param1 > param2: # interesting
|
||||
print('Gre\'ater'.lower())
|
||||
return (param2 - param1 + 1 + 0b10l) or None
|
||||
return (param2 - param1 + 1 + 0b10) or None
|
||||
|
||||
class SomeClass:
|
||||
"""
|
||||
|
@ -454,6 +454,12 @@ QString QgsCodeEditorPython::reformatCodeString( const QString &string )
|
||||
{
|
||||
const bool normalize = settings.value( QStringLiteral( "pythonConsole/blackNormalizeQuotes" ), true ).toBool();
|
||||
|
||||
if ( !checkSyntax() )
|
||||
{
|
||||
showMessage( tr( "Reformat Code" ), tr( "Code formatting failed -- the code contains syntax errors" ), Qgis::MessageLevel::Warning );
|
||||
return newText;
|
||||
}
|
||||
|
||||
const QString defineReformat = QStringLiteral(
|
||||
"def __qgis_reformat(script):\n"
|
||||
" try:\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user