Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

document/explain logic of ignoring --lines

オープン
#1,276 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
cli, tooling

調査の方向性

提供された hello.java の例と 2 つの google-java-format コマンドを使って問題を再現します。--lines オプションの範囲処理を追跡し、そのうえで最初の行がフォーマットされる理由と意図された動作を記録してください。また、対象行に限定したフォーマット結果を得られるかどうかも含めてください。

索引モデルが issue の本文から書いたものです。

説明

as seen in #942 and #1000 (and others) use of --lines does not reliably work.

I'm trying to grok how/why....

As an example:

///usr/bin/env jbang "$0" "$@" ; exit $?


import static java.lang.System.*;

public class hello {

    public static void main(String... args) {
        out.println("Hello World");
    }
}

I want google java format to ignore the first line - reading other isseues I should --skip-* as much as possible ...

jbang com.google.googlejavaformat:google-java-format:1.28.0 --lines 2:9999 --skip-javadoc-formatting --skip-reflowing-long-strings --skip-sorting-imports --skip-removing-unused-imports hello.java

result in first line being formatted as: /// usr/bin/env jbang "$0" "$@" ; exit $?

why ?

If I add --lines 1000:9999 it works...but now the code is not formatted at all.

is this really the intended behavior of --lines ?

any way to have it not try include outside the lines requested?

主要言語
Java
スター
6.2k
フォーク
936
平均マージ
6分
マージ済み PR(30日)
3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google/google-java-format のほかの issue

google/google-java-format の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。