Skip to content

Instantly share code, notes, and snippets.

@Croydon
Created March 19, 2020 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Croydon/7ff833b41e9ee48270147e3615510fe6 to your computer and use it in GitHub Desktop.
Save Croydon/7ff833b41e9ee48270147e3615510fe6 to your computer and use it in GitHub Desktop.
Find longest line in all Python files in CCI
import glob
import os
record = 0
record_file = ""
for filename in glob.iglob(os.path.join(".", "recipes", "**"), recursive=True):
if os.path.isfile(filename) and filename.endswith(".py"):
print(filename)
current = len(max(open(filename), key=len))
if current > record:
record = current
record_file = filename
print("Biggest line: {} in {}".format(str(record), record_file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment