LoginSignup
1

More than 5 years have passed since last update.

Raspberry Pi > C > タブと空白インデントの混在 | 行末の空白 > PEP8を使ってチェック

Last updated at Posted at 2018-03-09
動作環境
Raspberry Pi 2 Model B (以下RPi)
Raspbian Jessie
Python 2.7.9

Raspberry Pi > editor > geany > Cの実装に使ってみる
にてCの実装にgeanyを使い始めた。

geanyの1つの問題は、空白とタブのインデントが明白でない点。
また、行末の空白が明示されない点。

gitリポジトリにpushする前にチェックして修正したい。

PEP8

PythonのコードチェックのPEP8を使う。

$ pep8 i2c_gpio_180309.c | grep mixed
i2c_gpio_180309.c:22:1: E101 indentation contains mixed spaces and tabs
i2c_gpio_180309.c:23:1: E101 indentation contains mixed spaces and tabs

22行目でタブインデントがある。
(空白4つのインデントで実装している)。

$ pep8 i2c_gpio_180309.c | grep trail
i2c_gpio_180309.c:14:36: W291 trailing whitespace
i2c_gpio_180309.c:20:44: W291 trailing whitespace

14行目と20行目に行末の空白がある。

C/C++用のチェックツールは未確認。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1