Skip to content

Draft: POC Detect empty Python function

Vitali Tatarintev requested to merge ck3g-detect-empty-python-function into master

What does this MR do and why?

Detect empty Python function from prefix and suffix code.

Since there are no "closing bracket" in Python, we can't use it as an anchor to check whether a function is empty. Instead, we can check several conditions to ensure a function is empty

  • A line above cursor is a function definition AND the there is no code below
  • A line above cursor is a function definition AND the line below cursor is also a function definition

In any other cases, a function probably non empty, or we're not inside a function at all

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports