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

Lint result not showing #13

Closed
AllanLRH opened this issue Jan 12, 2013 · 4 comments
Closed

Lint result not showing #13

AllanLRH opened this issue Jan 12, 2013 · 4 comments

Comments

@AllanLRH
Copy link

When I save my code (and thus lint it, at least that what Subime says in the bottom panel) no errors is reported, even thouth I introduced a reference to an undefined variable. In order to test if Pylint works, I ran pylint on the code manually, and got this:

No config file found, using default configuration
************* Module afl7
W: 10,0: Found indentation with tabs instead of spaces
W: 11,0: Found indentation with tabs instead of spaces
W: 12,0: Found indentation with tabs instead of spaces
W: 13,0: Found indentation with tabs instead of spaces
W: 23,0: Found indentation with tabs instead of spaces
W: 31,0: Found indentation with tabs instead of spaces
W: 32,0: Found indentation with tabs instead of spaces
C:  1,0: Missing docstring
C: 16,0: Invalid name "n" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 17,0: Invalid name "m" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 18,0: Invalid name "g" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 19,0: Invalid name "v" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 20,0: Comma not followed by a space
v[0,:] = np.array([100, 100])
   ^^
E: 22,3: Undefined variable 'a'
C: 32,1: Comma not followed by a space
    print 'v[0:4,:] :\n', v[0:4,:]
                            ^^
W: 14,0: Unused import plt

I'we given the exact path for the lint.py in the settings, and tried both with and without the my linting-ignore file:

    {
        // Full path to the lint.py module in the pylint package
        "pylint_path": "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylint/lint.py",
        // Optional full path to a Pylint configuration file
        // "pylint_rc": "/Users/allan/.pylint_rc",
        // Set to true to automtically run Pylint on save
        "run_on_save": true,
        // Set to true to use graphical error icons
        "use_icons": true,
        // Ignore Pylint error types. Possible values:
        // "R" : Refactor for a "good practice" metric violation
        // "C" : Convention for coding standard violation
        // "W" : Warning for stylistic problems, or minor programming issues
        // "E" : Error for important programming issues (i.e. most probably bug)
        // "F" : Fatal for errors which prevented further processing
        "ignore": []
    }

I Love Pylint – any suggestions on fixing this will be greatly appreciated :)

@biermeester
Copy link
Owner

Sorry for the somewhat late reply.

Can you give Pylinter a try with the following config:

{
    // When versbose is 'true', various messages will be written to the console.
    // values: true or false
    "verbose": true,
    // The full path to the Python executable you want to
    // run Pylint with or simply use 'python'.
    "python_bin": "python",
    // The following paths will be added Pylint's Python path
    "python_path": [

                   ],
    // Optionally set the working directory
    "working_dir": null,
    // Full path to the lint.py module in the pylint package
    "pylint_path": null,
    // Optional full path to a Pylint configuration file
    "pylint_rc": null,
    // Set to true to automtically run Pylint on save
    "run_on_save": true,
    // Set to true to use graphical error icons
    "use_icons": false,
    // Ignore Pylint error types. Possible values:
    // "R" : Refactor for a "good practice" metric violation
    // "C" : Convention for coding standard violation
    // "W" : Warning for stylistic problems, or minor programming issues
    // "E" : Error for important programming issues (i.e. most probably bug)
    // "F" : Fatal for errors which prevented further processing
    "ignore": []
}

The main point being that 'verbose' is set to true, so you might get some extra info in Sublime's console.

@AllanLRH
Copy link
Author

Thanks for the reply biermeester!

A strange thing happend: Pylinter suddenly started working, then stopped before I got clever enough to check the console :(

I'we tried reinstalling and using the configuration file below:

{
    // When versbose is 'true', various messages will be written to the console.
    // values: true or false
    "verbose": true,
    // The full path to the Python executable you want to
    // run Pylint with or simply use 'python'.
    "python_bin": "python",
    // The following paths will be added Pylint's Python path
    "python_path": [

                   ],
    // Optionally set the working directory
    "working_dir": null,
    // Full path to the lint.py module in the pylint package
    // "pylint_path": "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylint/lint.py",
    "pylint_path": null,
    // Optional full path to a Pylint configuration file
    // "pylint_rc": "/Users/allan/.pylint_rc",
    "pylint_rc": null,
    // Set to true to automtically run Pylint on save
    "run_on_save": true,
    // Set to true to use graphical error icons
    "use_icons": false,
    // Ignore Pylint error types. Possible values:
    // "R" : Refactor for a "good practice" metric violation
    // "C" : Convention for coding standard violation
    // "W" : Warning for stylistic problems, or minor programming issues
    // "E" : Error for important programming issues (i.e. most probably bug)
    // "F" : Fatal for errors which prevented further processing
    "ignore": []
}

The Python file which I ran Pylinter on was this one (the errors are intentional):

#!/usr/bin/python
# -*- coding: utf8 -*-

import from argparse

from __future__ import division

a = 1
b = 2
a = 3

Which produced this console output:

Writing file /Users/allan/Desktop/argParsePlay1.py with encoding UTF-8
 - PyLinter:  Verbose is True
 - PyLinter:  Running Pylinter on /Users/allan/Desktop/argParsePlay1.py
 - PyLinter:  Current PYTHONPATH is ''
 - PyLinter:  Updated PYTHONPATH is ''
 - PyLinter:  Running command:
     python /Library/Python/2.7/site-packages/pylint-0.26.0-py2.7.egg/pylint/lint.py --output-format=parseable --include-ids=y /Users/allan/Desktop/argParsePlay1.py

I also tried running the listed command in my system terminal:

python /Library/Python/2.7/site-packages/pylint-0.26.0-py2.7.egg/pylint/lint.py --output-format=parseable --include-ids=y /Users/allan/Desktop/argParsePlay1.py
No config file found, using default configuration
/Users/allan/Desktop/argParsePlay1.py:4: [E0001] invalid syntax

What to do now?

@biermeester
Copy link
Owner

I am quite puzzled, since when I try the same file with the invalid syntax, the error gets correctly highlighted.

Today I merged some commits which should display error messages to the user when PyLint fails for some reason. Maybe you'll get some more feedback when you update and run Pylinter again?

@AllanLRH
Copy link
Author

Actually, PyLinter suddenly started working again today, then stopped :( The console output was identical to the output in the post above.

I'we installed the new version – no change.
This is my settings file for the new version (only change: set the 'message_stay' to true):

{
    // When versbose is 'true', various messages will be written to the console.
    // values: true or false
    "verbose": true,
    // The full path to the Python executable you want to
    // run Pylint with or simply use 'python'.
    "python_bin": "python",
    // The following paths will be added Pylint's Python path
    "python_path": [

                   ],
    // Optionally set the working directory
    "working_dir": null,
    // Full path to the lint.py module in the pylint package
    // "pylint_path": "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylint/lint.py",
    "pylint_path": null,
    // Optional full path to a Pylint configuration file
    // "pylint_rc": "/Users/allan/.pylint_rc",
    "pylint_rc": null,
    // Set to true to automtically run Pylint on save
    "run_on_save": true,
    // Set to true to use graphical error icons
    "use_icons": false,
    "disable_outline": false,
    // Status messages stay as long as cursor is on an error line
    "message_stay": true,
    // Ignore Pylint error types. Possible values:
    // "R" : Refactor for a "good practice" metric violation
    // "C" : Convention for coding standard violation
    // "W" : Warning for stylistic problems, or minor programming issues
    // "E" : Error for important programming issues (i.e. most probably bug)
    // "F" : Fatal for errors which prevented further processing
    "ignore": [],
    // a list of strings of individual errors to disable, ex: ["C0301"]
    "disable": []
}

I used this file as a test file – it has lines which are waaaay too long:

#!/usr/bin/python
# -*- coding: utf8 -*-

from __future__ import division


defaultPackages = ['ASP', 'ActionScript', 'AppleScript', 'Batch File', 'C#', 'C++', 'CSS', 'Clojure', 'Color Scheme - Default', 'D', 'Default', 'Diff', 'Erlang', 'Go', 'Graphviz', 'Groovy', 'HTML', 'Haskell', 'Java', 'JavaScript', 'LaTeX', 'Language - English', 'Lisp', 'Lua', 'Makefile', 'Markdown', 'Matlab', 'OCaml', 'Objective-C', 'PHP', 'Perl', 'Python', 'R', 'Rails', 'Regular Expressions', 'RestructuredText', 'Ruby', 'SQL', 'Scala', 'ShellScript', 'TCL', 'Text', 'Textile', 'Theme - Default', 'User', 'Vintage', 'XML', 'YAML']
myPackages = ['ASP', 'ActionScript', 'Alignment', 'All Autocomplete', 'AppleScript', 'Batch File', 'C#', 'C++', 'CSS', 'Clojure', 'Color Scheme - Default', 'Color Scheme – User', 'D', 'Default', 'Diff', 'Erlang', 'FileDiffs', 'Fortran', 'Gist', 'Git', 'Go', 'GotoRecent', 'Graphviz', 'Groovy', 'HTML', 'Haskell', 'Helios', 'HighlightWords', 'Inc-Dec-Value', 'Java', 'JavaScript', 'LaTeX', 'LaTeXTools', 'Language - English', 'LastEdit', 'Lisp', 'Lua', 'Makefile', 'Markdown', 'Mathematica', 'Matlab', 'Mcstas', 'MoveText', 'NaturalDocs', 'OCaml', 'Objective-C', 'Open Recent Files', 'PHP', 'Package Control', 'Perl', 'Print to HTML', 'Pylinter', 'Python', 'R', 'Rails', 'Regular Expressions', 'RestructuredText', 'Ruby', 'SQL', 'STProjectMaker', 'Scala', 'Search Stack Overflow', 'SearchMatlabDocumentation', 'SendToPasteBin', 'ShellScript', 'Sniptastic', 'SortTabs', 'SublimeTODO', 'SyncedSideBar', 'TCL', 'Text', 'Text Pastry', 'Textile', 'Theme - Aqua', 'Theme - Default', 'Theme - Nexus', 'Theme - Soda', 'User', 'Vintage', 'WordHighlight', 'XML', 'YAML']

for p in myPackages:
    if p not in defaultPackages:
        print p

The console showed this on save:

Writing file /Users/allan/Desktop.py with encoding UTF-8
 - PyLinter:  Verbose is True
 - PyLinter:  Running Pylinter on /Users/allan/Desktop.py
 - PyLinter:  Current PYTHONPATH is ''
 - PyLinter:  Updated PYTHONPATH is ''
 - PyLinter:  Running command:
     python /Library/Python/2.7/site-packages/pylint-0.26.0-py2.7.egg/pylint/lint.py --output-format=parseable --include-ids=y /Users/allan/Desktop.py

Running the command in the bottom prints this to the terminal (excluded all the ascii-tables):

No config file found, using default configuration
Desktop.py:7: [C0301] Line too long (534/80)
Desktop.py:8: [C0301] Line too long (1059/80)
Desktop.py:11: [W0312] Found indentation with tabs instead of spaces
Desktop.py:12: [W0312] Found indentation with tabs instead of spaces
Desktop.py:8: [W0511] TODO', 'SyncedSideBar', 'TCL', 'Text', 'Text Pastry', 'Textile', 'Theme - Aqua', 'Theme - Default', 'Theme - Nexus', 'Theme - Soda', 'User', 'Vintage', 'WordHighlight', 'XML', 'YAML']
Desktop.py:1: [C0111] Missing docstring
Desktop.py:7: [C0103] Invalid name "defaultPackages" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
Desktop.py:8: [C0103] Invalid name "myPackages" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)

Also, the python test code prints out the those of my installed packages which is not included in the default installation. Previously I thought one of them might "block" Pylinters access to display icons in the GUI? Then I renamed my 'Sublime Text 2' folder, where all the settings and packages are stored, to start on a frest, and installed Package Control and Pylinter (and nothing else). Still didn't work.
Anyways, here is the output of the test script (the commentet out packages are ignored in my user settings file):

Alignment
All Autocomplete
Color Scheme – User
FileDiffs
Fortran
Gist
Git
GotoRecent
Helios
HighlightWords
Inc-Dec-Value
LaTeXTools
LastEdit
Mathematica
Mcstas
MoveText
NaturalDocs
Open Recent Files
Package Control
Print to HTML
Pylinter
# STProjectMaker
Search Stack Overflow
SearchMatlabDocumentation
SendToPasteBin
Sniptastic
SortTabs
SublimeTODO
# SyncedSideBar
Text Pastry
Theme - Aqua
Theme - Nexus
Theme - Soda
WordHighlight

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

2 participants