release: false should be the lowest priority rule
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
Direzione di ricerca
Inizia da test/analyze-commit.test.js intorno al test collegato e leggi lib/compare-release-types.js, in particolare come viene confrontato RELEASE_TYPES. Esegui i test dell’analizzatore prima di modificare il comportamento. Il lavoro è completo quando le regole con scope mantengono il valore di release più alto quando una regola successiva usa release: false, mentre i casi esistenti di priorità di release continuano a superare i test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 447
- Fork
- 82
- Merge medio
- 7h 53m
- PR unite (30g)
- 9
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di semantic-release/commit-analyzer
-
released on @beta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
semantic-release/commit-analyzer#921 · 8 commenti · 7 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
semantic-release/commit-analyzer#805 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
semantic-release/commit-analyzer#802 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Unexpected major release because commit description includes a line starting with "Breaking change"Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
semantic-release/commit-analyzer#776 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Exclamation mark (!) after type/scope completely ignores commitForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertareleased on @beta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
semantic-release/commit-analyzer#759 · 13 commenti · 6 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di semantic-release/commit-analyzer
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jfromaniello/url-join#134 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
quarto-dev/quarto-cli#15042 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
extendr/extendr.github.io#134 ·