From d96f18c9123782756c5277f3c18122f42be518a9 Mon Sep 17 00:00:00 2001 From: mbremner Date: Tue, 6 Aug 2019 12:56:51 -0400 Subject: [PATCH] Updated to work with newest SublimeLinter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SublimeLinter update of July 26th 2019 depreciates several settings and adds a new mandatory setting ‘cls.defaults'. --- linter.py | 99 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 27 deletions(-) diff --git a/linter.py b/linter.py index bb2aba5..dd2892c 100644 --- a/linter.py +++ b/linter.py @@ -17,40 +17,85 @@ class Linter(object): class GfortranFixedForm(Linter): """Provides an interface to gfortran.""" - syntax = 'fortranfixedform' cmd = 'gfortran -cpp -fsyntax-only -Wall' - executable = None - version_args = '--version' - version_re = r'(?P\d+\.\d+\.\d+)' - version_requirement = '>= 4.0' multiline = True - regex = ( - # filename:line:col: is common for multiline and single line warnings - r'^[^:]*:(?P\d+)[:.](?P\d+):' - # Then we either have a space or (a newline, a newline, some source code, a newline, a col number, a newline) - r'(?:\s|$\r?\n^$\r?\n^.*$\r?\n^\s*\d$\r?\n)' - # Finally we have (Error|Warning): message to the end of the line - r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' - ) - tempfile_suffix = "f" + + # Migrated this upward to keep things neat on_stderr = True + tempfile_suffix = "f" + + # Adding defaults:selector arg because this is required by SublimeLinter as of July 2019 + defaults = { + 'selector': 'source.fixedform-fortran' + } + + # Commenting out args that are no longer used by SublimeLinter as of July 2019 + # executable = None + # version_args = '--version' + # version_re = r'(?P\d+\.\d+\.\d+)' + # version_requirement = '>= 4.0' + + # Split this into two paths for Windows systems and otherwise + if (sys.platform == 'win32'): + # This Regex block is copied from Kailang's Comment in Issue #28 + regex = ( + r'.*:(?P\d+):(?P\d+):' + # Then we either have a space or (a newline, a newline, some source code, + # a newline, a col number, a newline) + r'(?:(\s*.*\s*\d+\s*))' + # Finally we have (Error|Warning): message to the end of the line + r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' + ) + else: + # This Regex block is retained from the previous commit + regex = ( + # filename:line:col: is common for multiline and single line warnings + r'^[^:]*:(?P\d+)[:.](?P\d+):' + # Then we either have a space or (a newline, a newline, some source code, a newline, a col number, a newline) + r'(?:\s|$\r?\n^$\r?\n^.*$\r?\n^\s*\d$\r?\n)' + # Finally we have (Error|Warning): message to the end of the line + r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' + ) class GfortranModern(Linter): """Provides an interface to gfortran.""" - syntax = 'fortranmodern' cmd = 'gfortran -cpp -fsyntax-only -Wall' - executable = None - version_args = '--version' - version_re = r'(?P\d+\.\d+\.\d+)' - version_requirement = '>= 4.0' multiline = True - regex = ( - # filename:line:col: is common for multiline and single line warnings - r'^[^:]*:(?P\d+)[:.](?P\d+):' - # Then we either have a space or (a newline, a newline, some source code, a newline, a col number, a newline) - r'(?:\s|$\r?\n^$\r?\n^.*$\r?\n^\s*\d$\r?\n)' - # Finally we have (Error|Warning): message to the end of the line - r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' - ) + + # Migrated this upward to keep things neat tempfile_suffix = "f90" on_stderr = True + + # Adding defaults:selector arg because this is required by SublimeLinter as of July 2019 + defaults = { + 'selector': 'source.modern-fortran' + } + + # Commenting out args that are no longer used by SublimeLinter as of July 2019 + #executable = None + #version_args = '--version' + #version_re = r'(?P\d+\.\d+\.\d+)' + #version_requirement = '>= 4.0' + + # Split this into two paths for Windows systems and otherwise + if (sys.platform == 'win32'): + # This Regex block is copied from Kailang's Comment in Issue #28 + regex = ( + r'.*:(?P\d+):(?P\d+):' + # Then we either have a space or (a newline, a newline, some source code, + # a newline, a col number, a newline) + r'(?:(\s*.*\s*\d+\s*))' + # Finally we have (Error|Warning): message to the end of the line + r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' + ) + else: + # This Regex block is retained from the previous commit + regex = ( + # filename:line:col: is common for multiline and single line warnings + r'^[^:]*:(?P\d+)[:.](?P\d+):' + # Then we either have a space or (a newline, a newline, some source code, a newline, a col number, a newline) + r'(?:\s|$\r?\n^$\r?\n^.*$\r?\n^\s*\d$\r?\n)' + # Finally we have (Error|Warning): message to the end of the line + r'(?:(?PError|Fatal\sError)|(?PWarning)): (?P.*$)' + ) +