Closure LinterをInstallしてCoding規約に従っているかCheck

Google Linterを使うと自分のCodeがGoogle JavaScript Style Guideに従っているかCheckしてくれる。

環境は Windows 7 Home Premium 64bit 英語版

Official Documentが十分詳しい。ただWindows Supportは試験的らしい。

PythonのInstallやPowerShellについては、前の記事を参考に。

1. Python moduleのeasy_installをInstall.

基本はOfficial Helpを参考に。

  1. こちらのSiteからez_setup.pyをDownload. 現時点では0.6c11
  2. PowerShellからCommand実行
    > cd C:\Python27\Tools\Scripts
    > C:\Python27\python.exe ez_setup.py

出力結果:

python.exe : Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
At line:1 char:23
+ C:\Python27\python.exe <<<<  ez_setup.py
    + CategoryInfo          : NotSpecified: (Downloading htt....6c11-py2.7.egg:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to c:\python27\lib\site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install-script.py script to C:\Python27\Scripts
Installing easy_install.exe script to C:\Python27\Scripts
Installing easy_install.exe.manifest script to C:\Python27\Scripts
Installing easy_install-2.7-script.py script to C:\Python27\Scripts
Installing easy_install-2.7.exe script to C:\Python27\Scripts
Installing easy_install-2.7.exe.manifest script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11

これでC:\Python27\Scriptsにeasy_install.exeがあるはず。

2. System環境変数に追記

Computer → 右Click → Properties → Advanced system settings → Environment Variables ... → System Variables
でPathを選択してEdit...

Python.exeまでのPathを追加
C:\Python27;C:\Python27\Scripts

PowerShellを再起動。

3. Closure LinterをInstall

準備が整ったので下記Commandを実行

> easy_install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz

出力結果:

Downloading http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
Processing closure_linter-latest.tar.gz
Running closure_linter-2.3.2b\setup.py -q bdist_egg --dist-dir c:\users\owner\appdata\local\temp\easy_install-x1bwb8\closure_linter-2.3.2b\egg-dist-tm
p-7uxcds
easy_install.exe : zip_safe flag not set; analyzing archive contents...
At line:1 char:13
+ easy_install <<<<  http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
    + CategoryInfo          : NotSpecified: (zip_safe flag n...ive contents...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Adding closure-linter 2.3.2b to easy-install.pth file
Installing fixjsstyle-script.py script to C:\Python27\Scripts
Installing fixjsstyle.exe script to C:\Python27\Scripts
Installing fixjsstyle.exe.manifest script to C:\Python27\Scripts
Installing gjslint-script.py script to C:\Python27\Scripts
Installing gjslint.exe script to C:\Python27\Scripts
Installing gjslint.exe.manifest script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\closure_linter-2.3.2b-py2.7.egg
Processing dependencies for closure-linter==2.3.2b
Searching for python-gflags
Reading http://pypi.python.org/simple/python-gflags/
Reading http://code.google.com/p/python-gflags
Best match: python-gflags 1.6
Downloading http://python-gflags.googlecode.com/files/python-gflags-1.6.tar.gz
Processing python-gflags-1.6.tar.gz
Running python-gflags-1.6\setup.py -q bdist_egg --dist-dir c:\users\owner\appdata\local\temp\easy_install-npxm1o\python-gflags-1.6\egg-dist-tmp-qaertr
zip_safe flag not set; analyzing archive contents...

Adding python-gflags 1.6 to easy-install.pth file

Installed c:\python27\lib\site-packages\python_gflags-1.6-py2.7.egg
Finished processing dependencies for closure-linter==2.3.2b

C:\Python27\Scriptsにgjslint.exeがいるはず。

4. 使ってみる。

この前作ったGoogle Chrome Extension"History Plus"(Web Store) (GitHub)で試してみた。

> cd "C:\Users\Owner\Develop\Google Chrome Extension\history-plus\git\src"
> gjslint.exe .\js\history.js

いっぱい出てきた。56 errors... (^^;

なぜか嬉しい。

ちなみに試したのはCommit No:"a276196768"のhistory.js

 

< Related Posts >