lakerainsound / get_code_metrics Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
同じディレクトリにcli.pyとmain.pyという2つのファイルを配置したが,main.pyでimport cli
としたところ,No module named cli
と怒られる.
Clocの処理をクラスを作って,
class Cloc:
repository_list = []
path_to_ghq_root = Path('')
def __init__(self, repository_list, path_to_ghq_root: Path):
self.repository_list = repository_list
self.path_to_ghq_root = path_to_ghq_root
@staticmethod
def _get_analyzed_cloc(repository_dir):
return subprocess.Popen(
['cloc', '--json', repository_dir],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding='utf-8'
)
def get_cloc_results(self):
res = {}
for repository_name in self.repository_list:
repository_dir = str(self.path_to_ghq_root) + '/github.com/' + repository_name
cloc_process = self._get_analyzed_cloc(repository_dir)
# cloc_processから出力を受け取る
# repository_nameをkeyとして返り値とresをupdateする
# processをterminate
ということをかんがえているが何回もprocessを呼び出すことになる?また,存在しないものがrepository_listにある場合,json文字列が吐き出されず,
1 error:
Unable to read: /Users/restartsugar/.cache/gcm/repositories/github.com/lslakaflkjc/vhjksfhkavvn
のように出力して返り値も0のためエラーハンドリングができない?
APIのアクセストークンを用いて,クエリを送出し返ってきた結果をmainに返すまでを実装.
ファイルごとに行う処理内容をprint等で記述し呼び出し関係をある程度決めておく.
コマンドラインからの引数が正しいかチェックする処理を書く.
cloneとcloc,apiを叩く2つでそれぞれ並列に実行したい.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.