Static-code analysis for Python
I have recently been tinkering around with static code analysis tools for python. The two I have tried out thus far are:
Pychecker is really nice and simple and seems to work fairly well for standalone projects such as my saucer_api project. However, it's simplicity was somewhat of a drawback for me because:
- It didn't play too well with django out of the box due to import problems. This is a fairly well documented problem.
- I really wanted something to check that I was adhering to some simple coding style standards such as variable/function naming consistency, line lengths, etc.
Pylint is very similar to to pychecker, but really steps it up a notch. First, pylint doesn't have too many problems with django. I did have to make some modifications to get rid of errors regarding the use of generated django attributes such as "objects" when calling "objects.all()", etc. on a model. Luckily, this is easily done by:
- Generating rcfile via pylint --generate-rcfile option
- Copying default file to ~/.pylintrc
- Modifying rcfile to include "objects" to "generated-members"
Second, pylint performs a much more detailed analysis of the code. It verifies code follows line length, naming consistency, etc. It even gives your code a score based on the errors, warnings, convention inconsistencies, etc. This makes it easy to say code is ready to be tested and/or checked in to the main repository. As previously mentioned, almost all these conventions, etc. can be configured by an rcfile. This is convenient because the rcfile can also be committed and serve as your standards documentation.
I haven't used either of these tools very extensively so I reserve the right to change my mind. Also, I haven't used either tool within python code yet. My use has been restricted to the command-line, which seems a more pragmatic way to use these tools, because I simply want a quick, easy way to prepossess my code prior to committing.
Both of these projects are open-source nice tools for the job. However,
pylint was much better suited to my needs. It is a bit overwhelming with
all of its output and metrics at first, but the majority of it is
Use pychecker for easy way to find for syntax errors, etc. Use pylint for detailed syntax and coding standards verification.
Pychecker and pylint are not the only tools for python code analysis. I didn't try pyflakes, but it seemed on the surface to be very similar to pychecker.
Stackoverflow has a nice discussion of these tools.
Submitted by: Luke Lee 2010-01-05 03:08:52
I recently added a few new projects that I have finished in the past few months. You can view them over in the work section of this site.
I am also working on an updated version of this website using new hosting and the excellent django web framework so be on the lookout!
Submitted by: Luke Lee 2009-06-28 15:09:09
Too long since update...
Well it has obviously been a really long time since I have updated here. I could lie and say I have been busy, but nothing out of the ordinary. I am currently trying to think of a new project to start working on to learn Rails 2.0. I did a site about a year ago with an old version of Rails. I am also hoping to create a new theme for this site. I think it is about time for a CSS makeover. Keep in touch and please check back every now and then for updates.
Submitted by: Luke Lee 2008-05-31 16:44:07
In keeping with my last promise, I am testing out a new footer. This currently holds my most recent diigo bookmarks. Hopefully I can think of some more stuff to put there in the future. Until then enjoy looking at what I am reading through diigo.
Submitted by: Luke Lee 2007-04-01 04:20:11
I know I always say this, but I am planning some real interface updates to this site. I plan on making a nice big footer, and I can include some RSS feeds and more of my online trail.
Submitted by: Luke Lee 2007-04-01 02:36:27
I made a deal with a fellow CTSI colleague to try and keep up a small blog with sentences using the word of the day.
Submitted by: Luke Lee 2007-03-23 02:18:42
Firebug - Web Dev. Essential
I thought I would chime in and try to spread the word about a great tool for any web developer out there. I am sure a lot of people have heard of it or used it before, but version 1.0 beta is amazing. The tool is firebug. I can't even begin to tell you about the features and time it has already saved me. Just please check it out.
While I am sharing, another great tool deserving some mention is web developer. Again, this tool has way too many great features to even begin to start a good list.
Thanks to both of the developers for the amazing tools they are writing to help everyone else out there. Note these are both add-ons for Firefox. However, you should already have that installed. ;)
Submitted by: Luke Lee 2006-12-12 04:07:10
Projects, Projects, Projects
Hey everyone. Sorry for the lack of updates lately. I have quite a few web projects going on at work and some database projects also. I am also working on some Java stuff for a network file system written by a grad student at TTU. I will be posting some screenshots of the new CTSI website soon. I will also complete the full work entry about it as well. Hope everyone is having a good holiday.
Submitted by: Luke Lee 2006-11-24 22:01:53
Well, I have recently begun teaching myself C#. I have been trying to modify/maintain an application at work that was written by a previous employee in C# so I figured I needed to learn it pretty well. Luckily after purchasing some books and using it at work we are actually using it in my database class.
I am proud to say I have successfully created a nice GUI for a little database application using C# now. So far I think C# is actually pretty nice and easy to use. Hopefully I can post some screenshots of my application up here soon because sadly it is not a web application. Thanks for reading...
Submitted by: Luke Lee 2006-10-30 01:10:27
Welcome to HTML 4.01 Strict!
I have been really busy with school and work so I have not quite been working on this much lately. However, I am pleased to announce I ironed out a few issues today that allows this site to validate with the HTML 4.01 Strict specification. I am sure none of you will notice a difference in the rendering of the site, but this is a big improvement for me. I know some of the HTML/CSS that governs the top bar of this site is still not up to par, but it is getting there. Sadly, I had to resort to some IE conditional comments to bring IE along in the updates. However, I am almost positive this is some other issue that is hiding. I promise I will find it soon.
Also, I am planning on adding archive and comment features to the site when I have time. So don't worry, it is on my to-do list. However, I am in the midst of some very challenging database and operating system courses right now.
By the way, as I mentioned I have been busy at work so I will have a few new features up here soon. So please keep checking back!
Submitted by: Luke Lee 2006-09-28 00:10:19
CSS Layout vs. Table Layout
I just wanted to take the time to update everyone on my position on the CSS vs. Table debate.
If you do read the project descriptions for some of my work you will undoubtedly notice that I have used table layouts in the past. This was a few years ago when I was just starting my career as a web developer. I was learning from a great developer at my current company, and his layout method was all table based. Therefore, that was the method I learned to start with. However, I have since changed my view and only create CSS based layouts now. In fact, I have completely switched the mindset of all the developers at my current company. After I wrote a few sites using CSS, they were able to see the benefits of using CSS for layouts. I am proud to say this is the method we have been using and will be using from now on.
There are a few reasons I prefer CSS based layouts over table based ones.
- Tables are for tabular data - not layouts. Therefore, their semantic meaning is lost in layouts.
- CSS provides a much easier maintenance track for websites by further seperating presentation from content
- CSS provides a much more effective approach to semantic markup - meaning using an HTML element that accurately describes the data it contains
- CSS reduces the amount of code in HTML files (on average)
Anyway, those are just a few of the many reasons I am a supporter of CSS based layouts. However, please do not get the impression that tables are bad. This is not the case at all, they should simply be used for their original purpose - to organize tabular data, not layouts.
Submitted by: Luke Lee 2006-09-11 22:59:50
Happy Launch Day!
Welcome. You are now reading my official website. First of all, thanks for visiting! To set things off on the right foot, I would like to state the two running battle cries for this project:
- Create. Refine. Repeat.
- No good website is ever complete.
I hope to uphold both of these as the time passes. So be checking back soon for a few new featured works.
However, the fun doesn't stop there. There have been a few updates recently, most notable is the fact that the "Under Construction" banner has been replaced with a recent updates feature. I think that is it for now, please send me a comment if you find any bugs or would just like to tell me what you think.
Submitted by: Luke Lee 2006-09-08 20:17:45
A Few Updates
I also plan on having my new resume up very soon as well as some more work samples. Thanks for reading and check back soon!
Submitted by: Luke Lee 2006-09-04 04:56:30
The beginning of something
Hello. Welcome to the blog portion of my "portfolio" website. I plan to use this blog page to update readers on new features, bug fixes, etc. that occur on this site from time to time. I just recently completed the code to power this blog so there might be a few hiccups in the near future.
In the meantime, please take a look around and be sure to send me some comments.
Submitted by: Luke Lee 2006-09-02 19:16:28