Permalink
Browse files

Formatting and cleaning

I used the SublimeCodeLinter package to show formatting errors and dead code.

I also used these SublimeText preferences to clean files:

- "ensure_newline_at_eof_on_save": true
- "trim_trailing_white_space_on_save": true
  • Loading branch information...
1 parent 0fbfb3c commit eb6239bdb35072d46ead9ec1ab99c8e4bb6e2039 @genezys genezys committed Dec 15, 2012
Showing with 13 additions and 11 deletions.
  1. +1 −0 git_gutter.py
  2. +1 −1 git_gutter_events.py
  3. +3 −7 git_gutter_handler.py
  4. +4 −0 git_helper.py
  5. +4 −3 view_collection.py
View
@@ -2,6 +2,7 @@
import sublime_plugin
from view_collection import ViewCollection
+
class GitGutterCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.clear_all()
View
@@ -1,7 +1,7 @@
-import sublime
import sublime_plugin
from view_collection import ViewCollection
+
class GitGutterEvents(sublime_plugin.EventListener):
def on_load(self, view):
ViewCollection.add(view)
View
@@ -5,6 +5,7 @@
import re
from view_collection import ViewCollection
+
class GitGutterHandler:
def __init__(self, view):
self.view = view
@@ -65,7 +66,7 @@ def total_lines(self):
region = sublime.Region(0, chars)
lines = self.view.lines(region)
lines_count = len(lines)
- return range(1,lines_count+1)
+ return range(1, lines_count + 1)
def process_diff(self, diff_str):
inserted = []
@@ -78,11 +79,6 @@ def process_diff(self, diff_str):
if not m:
continue
kind = m.group(3)
- original_line_start = int(m.group(1))
- if len(m.group(2)) > 0:
- original_line_end = int(m.group(2))
- else:
- original_line_end = original_line_start
line_start = int(m.group(4))
if len(m.group(5)) > 0:
line_end = int(m.group(5))
@@ -102,7 +98,7 @@ def process_diff(self, diff_str):
# this means this file is either:
# - New and not being tracked *yet*
# - Or it is a *gitignored* file
- return ([],[],[])
+ return ([], [], [])
else:
return (inserted, modified, deleted)
View
@@ -1,5 +1,6 @@
import os
+
def git_file_path(view, git_path):
if not git_path:
return False
@@ -9,6 +10,7 @@ def git_file_path(view, git_path):
git_path_to_file = git_path_to_file[1:]
return git_path_to_file
+
def git_root(directory):
if os.path.exists(os.path.join(directory, '.git')):
return directory
@@ -20,11 +22,13 @@ def git_root(directory):
else:
return git_root(parent)
+
def git_tree(view):
full_file_path = view.file_name()
file_parent_dir = os.path.realpath(os.path.dirname(full_file_path))
return git_root(file_parent_dir)
+
def git_dir(directory):
if not directory:
return False
View
@@ -1,12 +1,13 @@
import tempfile
import time
+
class ViewCollection:
views = {}
git_times = {}
git_files = {}
buf_files = {}
-
+
@staticmethod
def add(view):
key = ViewCollection.get_key(view)
@@ -23,7 +24,7 @@ def git_path(view):
return False
@staticmethod
- def get_key(view):
+ def get_key(view):
return view.file_name()
@staticmethod
@@ -51,7 +52,7 @@ def git_tmp_file(view):
ViewCollection.git_files[key].close()
return ViewCollection.git_files[key]
- @staticmethod
+ @staticmethod
def buf_tmp_file(view):
key = ViewCollection.get_key(view)
if not key in ViewCollection.buf_files:

0 comments on commit eb6239b

Please sign in to comment.