Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve diff highlighting to understand multiple files #39

Open
chriskuehl opened this issue Apr 15, 2017 · 0 comments
Open

Improve diff highlighting to understand multiple files #39

chriskuehl opened this issue Apr 15, 2017 · 0 comments

Comments

@chriskuehl
Copy link
Owner

chriskuehl commented Apr 15, 2017

Here's an example diff with several different file types: https://i.fluffy.cc/4GH3s8gk5kvk6LZNLjgHSsHdnc7PQDsR.html

The autodetection often fails completely (like in the case above) or detects the wrong or a random file type, making the rest of the diff look bad.

It'd be cool to split the diff into chunks and highlight them individually. I'm thinking for the example above, these chunks would make sense:

diff --git a/ocfweb/middleware/errors.py b/ocfweb/middleware/errors.py
index e39319e..26dd093 100644
--- a/ocfweb/middleware/errors.py
+++ b/ocfweb/middleware/errors.py
@@ -15,10 +15,6 @@ class OcflibErrorMiddleware:
         if isinstance(exception, ResponseException):
             return exception.response
 
-        # maybe it's a real exception?
-        if settings.DEBUG or settings.TESTING:
-            return
-
         if isinstance(exception, Http404):
             # we don't care about reporting 404 errors
             return
@@ -54,6 +50,10 @@ class OcflibErrorMiddleware:
             ))
         except Exception as ex:
             print(ex)  # just in case it errors again here
+            if blah:
+                do_foo(
+                    x, y, z,
+                )
             send_problem_report(dedent(
                 """\
                 An exception occured in ocfweb, but we errored trying to report it:
diff --git a/ocfweb/static/js/site.js b/ocfweb/static/js/site.js
index 4e48734..112e029 100644
--- a/ocfweb/static/js/site.js
+++ b/ocfweb/static/js/site.js
@@ -3,16 +3,19 @@ $(document).ready(function() {
     var resizeTimeout;
     var updateFooterHeight = function() {
         var height = $('.ocf-footer').outerHeight();
-        $('body').css('margin-bottom', height);
+            $('body').css('margin-bottom', height);
     };
 
     $(window).resize(function() {
         clearTimeout(resizeTimeout);
-        setTimeout(updateFooterHeight, 10);
     });
 
     updateFooterHeight();
 
+    $(document).thing(function() {
+        return 'lol nope';
+    });
+
     // Close dropdown menu if clicked/tapped outside of
     $(document).click(function(event) {
         var menuOpen = $(".navbar-collapse").hasClass("in");
diff --git a/tox.ini b/tox.ini
index 9553550..4244304 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,6 +3,10 @@ max-line-length = 119
 # flake8 complains about 'redefinition' of imported pytest fixtures
 ignore = F811
 
+[some-new-section]
+# lol
+foo = blah
+
 [pep8]
 # autopep8 will rewrite lines to be shorter, even though we raised the length
 ignore = E501

Understanding diffs is a bit hard, but supporting the git diff format and maybe diff -u would be a good start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant