Search code examples
pythonpylintstatic-code-analysis

Code Analysis Warning: C0330:: Wrong continued indentation


I am performing static code analysis using pylint. Here some of my lines are very long due to number of variables I am using. I want to know how to split below line correctly into multiple lines.

TO_TIMESTAMP_TZ('{6}','YYYY-MM-DD 
HH24:MI:SS.FF6TZH:TZM'),'{7}')""".format(S_JOBID, JENKINS_ID,
            stg_name, plug, plugin_index[plug]['Status'], plugin_index[plug]['Start Time']

I have taken out of some lines from starting as well as end. Above, first line split is correct but second line is giving warning. What is the correct way of splitting the second line or format statement?


Solution

  • You need to add "\" at the end of second line.

    TO_TIMESTAMP_TZ('{6}','YYYY-MM-DD
    HH24:MI:SS.FF6TZH:TZM'),'{7}')""".format(S_JOBID, JENKINS_ID,\
               stg_name, plug, plugin_index[plug]['Status'], plugin_index[plug]['Start Time']