2020年12月30日 星期三

[cpplint] cpplint 設定

  • What
    • cpplint 是 Google 開發的一套 open source static code checker.
    • 是一套 python tool.
    • 主要 check 原則是依據 Google C++ Style Guide
    • source repository: cpplint
  • How
    • install
    • pip install cpplint
    • usage
      • run
      • cpplint [option] files
      • configuration
        • config file: CPPLINT.CFG, 可以在資料夾內新增此檔做設定, 裡面由 set noparent 這設定來指定是否獨立於其他設定檔
        • options
          • set noparent
          • extensions=c, cpp, h
            • 會被偵測到的 file extension
          • exclude_files=regex
          • root
            • 設定 root directory, 這會影響 header file include的變數名稱
              • e.g: #ifndef _PATH_FROM_ROOT_FILE_NAME_H_
          • filter
            • 可以透過--filter= (參數為空)來查看所有filters, 透過 filter=+filter1,-filter2 來 enable filter1, disable filter2
            • build/c++11
            • build/include
              • 滿常 argue include header 須加入路徑, 個人是都用這把此 filter 關閉
          • linelength=80

沒有留言:

張貼留言