question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Knob to set blank lines near imports, classes, functions and methods

See original GitHub issue

BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF allows adding a blank line before nested classes or methods.

Ideally, a knob would allow setting a specified amount of blank lines near:

  • Top-level imports
  • Top-level classes and functions
  • Classes
  • Methods
  • Top-level comments

Alternatively, offer a knob can allow “maximum blank lines”, thus allowing blank lines after imports (for example). Right now they get formatted away.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:10
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
bwendlingcommented, Feb 8, 2017

Adding the knobs shouldn’t be too hard. I’ll bump up the priority here.

2reactions
jamesbeithcommented, Feb 8, 2017

yapf and isort currently handle blank lines near Top-level imports and comments differently. isort is happy with this:

from foo import bar


# Public


def baz():
    pass

but yapf wants to remove a line between the import and the comment.

from foo import bar

# Public


def baz():
    pass

Irrespective of isort’s behaviour, it would be nice to control the number of spaces here so there’s 2 (ideally configurable) both above and below the comment. Should behave the same when there’s a constant too.

from foo import bar

QUX = 'quux'


# Public


def baz():
    pass
Read more comments on GitHub >

github_iconTop Results From Across the Web

tslint-blank-lines-after-imports - npm
Ensure number of blank lines after all import statements.. Latest version: 0.1.1, last published: 3 years ago.
Read more >
black formatter: How can I place one newline before and after ...
It uses 2 lines to visually distinguish methods from empty lines in code structure. From the docs: Black will allow single empty lines...
Read more >
How to Use Scroll Panes - Oracle Help Center
This Swing Java Tutorial describes developing graphical user interfaces (GUIs) for applications and applets using Swing components.
Read more >
Custom Panels — NUKE Python Developer's Guide v10.0v1 ...
Python Panels - more complex to create, but offer all knobs that are available in nodes as ... import nuke import nukescripts class...
Read more >
Chapter 4. Visualization with Matplotlib - O'Reilly
In [ 1 ]: import matplotlib as mpl import matplotlib.pyplot as plt ... in the object-oriented interface the plotting functions are methods of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found