I feel like I lost my innocence. After ignoring my mentor's demand to make my code pep8 compliant since days, I finally buckled down.
I installed sumblimelinter, which acts as an interface to actual linters for different programming languages.
Note : If you are using pylint from sublime for the first time, you need to have pylint installed on your machine.
pip install pylint
Then only the interface sublimelinter-pylint will work (duh).
Or else you would get this,
pylint deactivated, cannot locate 'pylint@python'
What exactly is Pylinter?
Yes. Bad naming. And what is demotivating is that they give scores. So I quickly ran pylint on one of my scripts.
Here are the results.
Yes. I was given a score in negative. -1.05/10.
Most my variables are invalid names. What exactly is invalid names?
Well, most of my variables were outside of any function or class (It was a quickly written script) and hence they were global, and according to convention global variables should be uppercase.
So I am supposed to wrap it up in functions, which is all right because it makes them reusable. But not today.
There are other things to which I never really noticed before, like trailing white spaces and spaces after commas etc. This is going to be a rough ride.
Lets see if my scores get better.
I installed sumblimelinter, which acts as an interface to actual linters for different programming languages.
Note : If you are using pylint from sublime for the first time, you need to have pylint installed on your machine.
pip install pylint
Then only the interface sublimelinter-pylint will work (duh).
Or else you would get this,
pylint deactivated, cannot locate 'pylint@python'
What exactly is Pylinter?
Pylint is a Python tool that checks a module for coding standards. According to the TurboGears project coding guidelines, PEP8 is the standard and pylint is a good mechanical test to help us in attaining that goal.
The range of checks run from Python errors, missing docstrings, unused imports, unintended redefinition of built-ins, to bad naming and more.
Yes. Bad naming. And what is demotivating is that they give scores. So I quickly ran pylint on one of my scripts.
Here are the results.
Yes. I was given a score in negative. -1.05/10.
Most my variables are invalid names. What exactly is invalid names?
Well, most of my variables were outside of any function or class (It was a quickly written script) and hence they were global, and according to convention global variables should be uppercase.
So I am supposed to wrap it up in functions, which is all right because it makes them reusable. But not today.
There are other things to which I never really noticed before, like trailing white spaces and spaces after commas etc. This is going to be a rough ride.
Lets see if my scores get better.
No comments:
Post a Comment