SPRKPY1074

Mixed indentation symbols

Message: File has mixed indentation (spaces and tabs).

Category: Parsing error.

Description

This issue appears when the tool detects the file has a mixed indentation. It means, file has a combination of spaces and tabs to indent code lines.

Scenario

Input

In Pyspark you can mix spaces and tabs for the identation level.

def foo():
    x = 5 # spaces
    y = 6 # tab

Output

SMA cannot handle mixed indentation markers. When this is detected on a python code file SMA adds the EWI SPRKPY1074 on first line.

# EWI: SPRKPY1074 => File has mixed indentation (spaces and tabs).
# This file was not converted, so it is expected to still have references to the Spark API
def foo():
    x = 5 # spaces
    y = 6 # tabs

Recommended fix

The solution is to make all the indentation symbols the same.

def foo():
  x = 5 # tab
  y = 6 # tab

Additional recommendations

Last updated