【Git】私が書き出した40個の英語頻出コミットメッセージ

git commit 時のメッセージて素早く書きたいものですね!

すばらしい記事を見つけましたよ!

GitHubで使われている実用英語コメント集 - Qiita

実際, 入力するときには悩むメッセージも, 私でもわかりそうになる意外とシンプルな単語たちで構成されていることがわかります.

_

勉強中のPHPで書き出してみました.


<?php
$data_idiom = <<<I
Fix A in B	Bの箇所のAを修正
Fix for A	Aに対する修正
Fix A to B	BへのAを修正
Fix A of B	BのAを修正
Add A to B	BにAを追加
Add A for B	B用にAを追加
Remove A from B	BからAを除去
Remove A in B	Bの箇所のAを除去
Remove unused A	不必要なAを除去
Use A insted of B	Bの代わりにAを用いる
Use A in B	Bの箇所のAを用いる
Use A for B	BのためにAを用いる
Remove use of B	Bを用いるのを除去
Update to A	Aにアップデート
Update A to B	AをBにアップデート
Update A for B	Bに対してAをアップデート
Add A support	Aサポートを追加
Add support for A	Aに対するサポートを追加
Make use of A	Aを使用する
Make it A	よりAにする
Make sure that A	必ずAするようにする
Move A from B	BからAを移動させる
Move A to B	AをBに移動させる
Move A in B	B内のAを移動させる
Don't use A	Aを用いない
Check for A	Aに対するチェック
Check A in B	B内のAをチェック
Fix A check	Aチェックを修正
Add A check	Aチェックを追加
Remove A check	Aチェックを除去
Change A to B	AをBに変更
Change A for B	Bに対してAを変更
Change A in B	B中のAを変更
Allow A to B	AがBするのを許す
Set A to B	AをBにセット
Set A for B	Bに対してAをセット
Convert A to B	AをBに変換
Rename A to B	AをBにリネーム
Avoid A to B	BするためにAを避ける
I;

$data_adj = <<<J
new	新しい
unused	使用されていない
static	静的な
empty	空の
old	古い
small	小さな
initial	最初の
local	ローカルの
wrong	間違った
common	共通の
other	他の
dead	死んだ
get rid of	取り除く
possible	可能性のある
unneeded	不必要な
same	同じ
global	グローバルの
invalid	不正な
specific	特定の
extra	余分な
J;

$data_noun = <<<N
test	テスト
tests	テスト
code	コード
error	エラー
function	ファンクション
functions	ファンクション
driver	ドライバー
version	バージョン
typo	タイポ
docs	ドキュメント
bug	バグ
return	リターン
tag	タグ
default	デフォルト
device	デバイス
handling	ハンドリング
files	ファイル
type	タイプ
auto	オート
name	名前
data	データ
warning	警告
N;

// parse data
$idioms = array();
foreach (explode("\n", $data_idiom) as $line) {
  array_push($idioms, explode("\t", lcfirst($line)));
}

$adjs = array();
foreach (explode("\n", $data_adj) as $line) {
  array_push($adjs, explode("\t", $line));
}

$nouns = array();
foreach (explode("\n", $data_noun) as $line) {
  array_push($nouns, explode("\t", $line));
}

// build titles
foreach ($idioms as $idiom) {

  shuffle($adjs);
  shuffle($nouns);

  $title_en = str_replace(
      array('A', 'B'), 
      array($adjs[0][0] . " " . $nouns[0][0], $adjs[1][0] . " " .  $nouns[1][0]), 
      $idiom[0]);

  $title_ja = str_replace(
      array('A', 'B'), 
      array($adjs[0][1] . $nouns[0][1], $adjs[1][1] . $nouns[1][1]), 
      $idiom[1]);

  printf("%s\n%s\n\n", ucfirst($title_en), $title_ja);

}

Fix common version in new docs
新しいドキュメントの箇所の共通のバージョンを修正

Fix for dead version
死んだバージョンに対する修正

Fix new data to small code
小さなコードへの新しいデータを修正

Fix unneeded handling of local tests
ローカルのテストの不必要なハンドリングを修正

Add common device to extra functions
余分なファンクションに共通のデバイスを追加

Add unused code for specific files
特定のファイル用に使用されていないコードを追加

Remove common tests from same function
同じファンクションから共通のテストを除去

Remove unneeded default in other type
他のタイプの箇所の不必要なデフォルトを除去

Remove unused wrong bug
不必要な間違ったバグを除去

Use static docs instead of wrong tests
間違ったテストの代わりに静的なドキュメントを用いる

Use small return in unneeded code
不必要なコードの箇所の小さなリターンを用いる

Use old error for extra test
余分なテストのために古いエラーを用いる

Remove use of new files
新しいファイルを用いるのを除去

Update to small code
小さなコードにアップデート

Update empty code to unneeded test
空のコードを不必要なテストにアップデート

Update empty test for static device
静的なデバイスに対して空のテストをアップデート

Add static bug support
静的なバグサポートを追加

Add support for small default
小さなデフォルトに対するサポートを追加

Make use of other warning
他の警告を使用する

Make it extra auto
より余分なオートにする

Make sure that small typo
必ず小さなタイポするようにする

Move get rid of device from new version
新しいバージョンから取り除くデバイスを移動させる

Move old data to static files
古いデータを静的なファイルに移動させる

Move small return in other tag
他のタグ内の小さなリターンを移動させる

Don't use local function
ローカルのファンクションを用いない

Check for specific data
特定のデータに対するチェック

Check other default in initial version
最初のバージョン内の他のデフォルトをチェック

Fix common tag check
共通のタグチェックを修正

Add specific auto check
特定のオートチェックを追加

Remove same data check
同じデータチェックを除去

Change unused test to global error
使用されていないテストをグローバルのエラーに変更

Change extra type for invalid driver
不正なドライバーに対して余分なタイプを変更

Change other data in get rid of return
取り除くリターン中の他のデータを変更

Allow unneeded device to dead default
不必要なデバイスが死んだデフォルトするのを許す

Set empty bug to dead auto
空のバグを死んだオートにセット

Set unneeded functions for empty device
空のデバイスに対して不必要なファンクションをセット

Convert specific driver to invalid functions
特定のドライバーを不正なファンクションに変換

Rename specific files to local test
特定のファイルをローカルのテストにリネーム

Avoid small typo to initial name
最初の名前するために小さなタイポを避ける

微妙な結果ですね!

まとめ

「イディオム」てやつを覚えるといいのかもしれませんね!!

Gitのコミットメッセージの書き方 | プログラミング | POSTD


Espresso で アイドリング

espresso

Espresso は以下の非同期処理は考慮してくれるようですが.

- メッセージキューを利用したUIイベント
- デフォルト AsyncTask のスレッドプールを利用したタスク

Square Island: Espresso: Custom Idling Resource

これらに該当しない処理でも, テスト実行を「あるタイミング」まで待たせたいときがありますよね?

カスタムした「IdlingResource」を使ってみましょう.

Espresso Idling Resource

ここで書かれているアプローチとしては2つ.

Counting running jobs: When a job starts, increment a counter. When it finishes, decrement it. The app is idle if the counter is zero. This approach is very simple and accounts for most situations. CountingIdlingResource does exactly this.

Querying state: It might be more reliable to ask a work queue or an HTTP client (or whatever is doing the background work) if it is busy. If the state is exposed, implementing an Idling Resource is trivial.

これらのうち, 汎用的に使えるジョブカウンターを利用した方法を, Googleサンプルを眺めつつ手順整理しておきます.

Android Testing Codelab

1. IdlingResource ユーティリティの作成

アイドリング向けのユーテリティを作成します.
そのまま2つのクラスを利用してもいいかもしれません.

EspressoIdlingResource.java at master · googlecodelabs/android-testing

SimpleCountingIdlingResource.java at master · googlecodelabs/android-testing

2. テスト対象の Activity に記述

テスト対象となる Activity にテスト時に利用するメソッドを記述しておきます.
テスト時にはこのメソッドを利用して, 先ほどのユーティリティを利用登録します.


    @VisibleForTesting
    public IdlingResource getCountingIdlingResource() {
        return EspressoIdlingResource.getIdlingResource();
    }

AddNoteActivity.java at master · googlecodelabs/android-testing

NotesActivity.java at master · googlecodelabs/android-testing

3. 「待たせる」処理の記述

Presenter や View などのテスト対象クラス内にアイドリングの利用タイミングを記述しておきます.


EspressoIdlingResource.increment(); 


EspressoIdlingResource.decrement(); 

カウンターを増減しながらアイドリングを操作します.
カウンターが0になると処理が再開されます.


    @Override
    public void loadNotes(boolean forceUpdate) {
        mNotesView.setProgressIndicator(true);
        if (forceUpdate) {
            mNotesRepository.refreshData();
        }

        // The network request might be handled in a different thread so make sure Espresso knows
        // that the app is busy until the response is handled.
        EspressoIdlingResource.increment(); // App is busy until further notice

        mNotesRepository.getNotes(new NotesRepository.LoadNotesCallback() {
            @Override
            public void onNotesLoaded(List<Note> notes) {
                EspressoIdlingResource.decrement(); // Set app as idle.
                mNotesView.setProgressIndicator(false);
                mNotesView.showNotes(notes);
            }
        });
    }

AddNoteFragment.java at master · googlecodelabs/android-testing

NotesPresenter.java at master · googlecodelabs/android-testing

4. テスト内で登録する

テスト対象Activityに記述したメソッドを利用してテストコードへ登録します
アイドリング処理がテスト時に反映されます.


    @Before
    public void registerIdlingResource() {
        Espresso.registerIdlingResources(
                mAddNoteIntentsTestRule.getActivity().getCountingIdlingResource());
    }

    @After
    public void unregisterIdlingResource() {
        Espresso.unregisterIdlingResources(
                mAddNoteIntentsTestRule.getActivity().getCountingIdlingResource());
    }

AddNoteScreenTest.java at master · googlecodelabs/android-testing

まとめ

テストにかかるコストがただの自己満足で終わらないようにしたいです.

JakeWharton/okhttp-idling-resource: An Espresso IdlingResource for OkHttp.

PSA: Dont Use Espresso Idling Resources like Google does · Philosophical Hacker


LINE Notify をつかってターミナルから送信する

使ってみる.

line-notify

コマンドラインから LINE にメッセージを送れる LINE Notify « LINE Engineers' Blog

とりあえず.


#!/bin/sh -x                                                                                                                                   

token=zbOIf0lthC34fLGsXuilN2WBIkbomhtKj18M1MP0B1g

while true
do
  read message
  curl https://notify-api.line.me/api/notify \
  -H "Authorization: Bearer ${token}" \
  -F "message=${message} https://goo.gl/lU0Kx6" \
  -F "imageThumbnail=https://pbs.twimg.com/profile_images/745806811597406210/HO0KCGf2_400x400.jpg" \
  -F "imageFullsize=http://developers.linecorp.com/blog/wp-content/uploads/2016/10/moon.png"
  echo
done

これはグループ向けのメッセージ通知用になるのかな.


AGPBI 関連の多量のエラーを排除する

意味不明な Gradle の Warning や Error を消して激ビルド時間短縮

解決法がなく, 待っていたがビルド時間が長すぎて非効率すぎる.

Issue リストに新しい書き込み.

A temporary workaround I managed was to rollback to 2.1.3 of gradle in my project level build.gradle. No more errors and app builds fine. Going to keep it like this until a fix is pushed out. You will be prompted to upgrade to v2.2.0 when you open AS for the project, but you can ignore it.

classpath 'com.android.tools.build:gradle:2.1.3'

Issue 215748 - android - AGPBI reports errors instead of warnings - Android Open Source Project - Issue Tracker - Google Project Hosting

なので 2.2.0 から 2.1.3 に下げる.


  dependencies {
      //classpath 'com.android.tools.build:gradle:2.2.0'
      classpath 'com.android.tools.build:gradle:2.1.3'

com.android.tools.build.gradle

再度, clean build のあと, re-start や rebuild しても以下でできず.


Error:Cause: org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

gradle-wrapper.properties で gradle のバージョンを下げる.


#distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

これでいけます. ビルド時間は, 5分の1程度に短縮された感じ.

意味がなかった proguard 記述は 無効化しておく.

proguard-rules_pro

まとめ

AGPBI 関連のエラーを消すには com.android.tools.build:gradle を 2.1.3 にダウングレードする(build.gradle root の書き換え).

com.android.tools.build:gradle:2.1.3 に対応している最新バージョンの gradle は 2.14.1(gradle-wrapper.properties の書き換え).

Gradle Distributions

2016-10-14 追記

修正された模様.

Yesterday (28 hours ago) #8 [email protected]
it seems to be fixed in Android Studio 2.2.1 with the gradle wrapper 2.2.1

Yesterday (25 hours ago) #9 [email protected]
A.S. 2.2.1 fixed it for mee too

Issue 222989 - android - Android Studio 2.2 : Build successful with 1944 errors - Android Open Source Project - Issue Tracker - Google Project Hosting

実際, 試してみたが確かに修正されていた.


  dependencies {
      classpath 'com.android.tools.build:gradle:2.2.1'

gradle 3.1 でも問題はない感じ.


意味不明な Gradle の Warning や Error を消して激ビルド時間短縮

なんとなく Gradle コンソールを開けてみると死ぬほど書き出されてるエラーやワーニング.


AGPBI: {"kind":"error","text":"(org.apache.commons.beanutils.BeanMap$8) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"error","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"error","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"error","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"error","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"error","text":"(org.apache.commons.beanutils.BeanMap$9) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"error","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"error","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"error","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"error","text":"indicate that it is *not* an inner class.","sources":[{}]}
AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"error","text":"(org.apache.commons.beanutils.BeanMap$1) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"error","text":"solution is to recompile the class from s

いつから出ていたのかわかりません.

Proguard 周りなのでしょうが, 調べても意味がわかりませんでした.

が,

Large number of errors during Gradle build after upgrading to Android Studio 2.0 - Stack Overflow

意味のない warning や error は, .idea フォルダを消すことで取り除くことができます。このフォルダは Android Studio 1.5 が作成したもので 2.0 にインポートされています。消しても自動的に作成されます。

ideadir

一度削除すると再作成されますが, 意味不明なログが吐かれなくなり, ビルド時間も数分から数十秒に激速となりました。

...

などと喜んでいたが, また出てる.

...

Issue Tacker を見てみる.

Issue 215748 - android - AGPBI reports errors instead of warnings - Android Open Source Project - Issue Tracker - Google Project Hosting

まだ生きてる issue なのですが, 一時しのぎとして以下とか.


# https://code.google.com/p/android/issues/detail?id=215748
-keepattributes Exceptions, Signature, InnerClasses, EnclosingMethod
-dontoptimize

一応出なくなりますけれども,

速くなりますけれども,

「don't optimize」て...

またはこんな一時しのぎ法も.

Issue 222989 - android - Android Studio 2.2 : Build successful with 1944 errors - Android Open Source Project - Issue Tracker - Google Project Hosting

It affects me too it is caused by gradle not android studio (but it tries to update the gradle)
Temporary solution:
I went back to gradle 2.1.3 (that I used earlier):

classpath 'com.android.tools.build:gradle:2.1.3' ->this works

If I am using classpath 'com.android.tools.build:gradle:2.2.0' I am also getting tons of warning message and the output is an unaligned file...

「com.android.tools.build:gradle のバージョンを下げる」という方法ですが, うまくダウングレードできないような...

なんなんすかね, まったく.

issues_-_android_-_android_open_source_project_-_issue_tracker_-_google_project_hosting

Issues - android - Android Open Source Project - Issue Tracker - Google Project Hosting

2016-10-05

待てないので以下でとりあえず対応.
AGPBI 関連の多量のエラーを排除する