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

Linter not working correctly #37

Open
martixy opened this issue May 3, 2018 · 3 comments
Open

Linter not working correctly #37

martixy opened this issue May 3, 2018 · 3 comments

Comments

@martixy
Copy link

martixy commented May 3, 2018

  1. No gutter or inline feedback.
  2. Linter commands do nothing (e.g. Show All Errors / Goto Error, etc)

Interestingly, status bar does show gfortranmodern(errer) on error and gfortranmodern(ok) when everything is okay.
Sublime's console shows linter messages as well.

Package installed from Package control.
Sublime 3 build 3143

@ctowery
Copy link

ctowery commented May 7, 2018

I had the same issue. The problem is that the pushed fix from closed issue #36 is not in the Package Control version of SublimeFortran. You can download the new linter.py from the repository and save it in your ST3 Packages folder, which will override the linter installed with SublimeFortran.

@martixy
Copy link
Author

martixy commented May 10, 2018

@ctowery This solution however doesn't work for me.
In fact it makes things worse. Before, the status bar displayed gfortranmodern(erred) and the Sublime console contained the linting error. Now, even with errors, it just says gfortranmodern(ok) and no errors in console.

Edit: With SublimeLinter's debug mode it was fairly easy to locate the issue:
The regex used by the linter is ill-equipped to handle windows paths(which is the system I am using atm).

The current regex is:

r'^[^:]*:(?P<line>\d+)[:.](?P<col>\d+):'

Given that windows paths include a colon : in the drive letter, this fails miserably.
The following might be a good fix for the linter classes:

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<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 4.0'
    multiline = True
    if (sys.platform == 'win32'):
        regex = (
            # filename:line:col: is common for multiline and single line warnings
            r'^.*:(?P<line>\d+)[:.](?P<col>\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'(?:(?P<error>Error|Fatal\sError)|(?P<warning>Warning)): (?P<message>.*$)'
        )
    else:
        regex = (
            # filename:line:col: is common for multiline and single line warnings
            r'^[^:]*:(?P<line>\d+)[:.](?P<col>\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'(?:(?P<error>Error|Fatal\sError)|(?P<warning>Warning)): (?P<message>.*$)'
        )
    tempfile_suffix = "f90"
    on_stderr = True

Another option might be replacing the ^.* catch-all with a more specific ^[a-zA-Z]:[^:]*

P.S. I could submit a PR(See below).

martixy added a commit to martixy/SublimeFortran that referenced this issue May 10, 2018
@PunyTRexArms
Copy link

PunyTRexArms commented Oct 29, 2018

I'm having the same problem. Inline linter using gfortran has not worked in a while. You can read more at Package SublimeFortran not fully functional after build 3143?. As of right now, the package does not even appear under Package Control > Install Package. I've also tried the manual installation, which did not resolve the issue. Please note that I'm using a Linux system.

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

No branches or pull requests

3 participants