release: false should be the lowest priority rule
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- javascript
調査の方向性
リンクされているテストの周辺にある test/analyze-commit.test.js から始め、lib/compare-release-types.js を読み、特に RELEASE_TYPES がどのように比較されているかを確認します。動作を変更する前に analyzer のテストを実行してください。後続のルールが release: false を使用する場合でも、スコープ付きルールがより高い release 値を保持し、既存の release-priority のケースも引き続きパスすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Consider what happens when we expand this test to apply scope:
test('Return "false" for release type ONLY if the matching rule has no higher "release"', (t) => {
const commit = {type: 'fix', scope: 'frontend'};
t.is(analyzeCommit([
{type: 'fix', scope: 'frontend', release: 'patch'},
{type: 'fix', scope: '*', release: false} // <----- this should NOT override 'patch'
], commit), 'patch');
});
so this ruleset says "release fixes as 'patch' for the frontend, but don't release any other fixes in any other scopes"
this test will fail. because of this line: https://github.com/semantic-release/commit-analyzer/blob/master/lib/compare-release-types.js#L11
RELEASE_TYPES doesn't include false or null. so the algorithm starts to analyze our commit using our ruleset, and correctly identifies it as a 'patch'. then it considers the next rule, which says release === false. false is not in RELEASE_TYPES, so compareReleaseTypes() returns true, and the release value for the commit is incorrectly set to false, instead of patch.
this is problematic because it violates the advertised behavior of the release configuration: a commit will always be given the highest possible release value available from the given ruleset. if we consider "no release" the lowest possible release value - as I think is intuitive - then any other release value should take precedence.
the current algorithm treats no release as a special case without priority. or rather, it implicitly treats no release as the highest possible priority of release type, which doesn't make sense. no release cannot be the biggest release.
the current behavior thus renders the use case I've alluded to impossible, so i'll spell that use case out more specifically.
if you have a repo with several scopes, then you might want rules that govern how some scopes get released, and you might want only some of those scopes to get released ever. for example, if you have a project like this:
project/
- frontend
- backend
- shared-tools
you might want to say something like this:
"release any frontend or backend commits according to standard rules. fix:patch, feat:minor, break:major. but don't ever release any commits in shared-tools no matter what."
here's an example of what that ruleset might look like:
[
{scope: 'frontend', type: 'fix', release: 'patch'},
{scope: 'frontend', type: 'feat', release: 'minor'},
{scope: 'frontend', type: 'breaking', release: 'major'},
{scope: 'backend', type: 'fix', release: 'patch'},
{scope: 'backend', type: 'feat', release: 'minor'},
{scope: 'backend', type: 'breaking', release: 'major'},
{scope: '*', type: '*', release: false}
]
but for the reasons explained so far, that ruleset will never do what you expect. it will make any release impossible.
the simplest fix and what i would recommend is adding false, and null to the end of the list of RELEASE_TYPES. this would be a breaking change for people who expect release: false|null to override any other possible release value. but that perspective doesn't make any sense, and renders reasonable workflows impossible.
- 主要言語
- JavaScript
- スター
- 446
- フォーク
- 82
- 平均マージ
- 7時間 53分
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
semantic-release/commit-analyzer のほかの issue
-
released on @beta
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
semantic-release/commit-analyzer#921 · コメント 8 件 · リアクション 7 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
semantic-release/commit-analyzer#805 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
semantic-release/commit-analyzer#802 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Unexpected major release because commit description includes a line starting with "Breaking change"オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
semantic-release/commit-analyzer#776 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Exclamation mark (!) after type/scope completely ignores commit対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンreleased on @beta
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
semantic-release/commit-analyzer#759 · コメント 13 件 · リアクション 6 件 ·
メンテナーはふだん 1 日以内に返信
semantic-release/commit-analyzer の issue をすべて見る
似ている issue
-
Four problem loader browser tests fail on Windows対応中かも @Patriciaath999 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
juice-shop/juice-shop#3686 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ScottKirvan/GOMAC#56 ·
-
area:install bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
yetone/magpie#2406 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信