@@ -64,7 +64,6 @@ type lintModel struct {
6464 error error
6565 watching bool
6666 skipped bool
67- canSkip bool
6867 ctx context.Context
6968 cmd * cli.Command
7069 client stainless.Client
@@ -97,11 +96,6 @@ func (m lintModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
9796 m .cmd = msg .cmd
9897 m .client = msg .client
9998
100- if m .canSkip && ! hasBlockingDiagnostic (m .diagnostics ) {
101- m .watching = false
102- return m , tea .Quit
103- }
104-
10599 if m .watching {
106100 return m , func () tea.Msg {
107101 if err := waitTillConfigChanges (m .ctx , m .cmd , m .wc ); err != nil {
@@ -240,26 +234,28 @@ func getDiagnostics(ctx context.Context, cmd *cli.Command, client stainless.Clie
240234 return diagnostics , nil
241235}
242236
243- func (m lintModel ) ShortHelp () []key.Binding {
244- if m .canSkip {
245- return []key.Binding {
246- key .NewBinding (key .WithKeys ("ctrl+c" ), key .WithHelp ("ctrl-c" , "quit" )),
247- key .NewBinding (key .WithKeys ("enter" ), key .WithHelp ("enter" , "skip diagnostics" )),
237+ func hasBlockingDiagnostic (diagnostics []stainless.BuildDiagnostic ) bool {
238+ for _ , d := range diagnostics {
239+ if ! d .Ignored {
240+ switch d .Level {
241+ case stainless .BuildDiagnosticLevelFatal :
242+ case stainless .BuildDiagnosticLevelError :
243+ case stainless .BuildDiagnosticLevelWarning :
244+ return true
245+ case stainless .BuildDiagnosticLevelNote :
246+ continue
247+ }
248248 }
249- } else {
250- return []key.Binding {key .NewBinding (key .WithKeys ("ctrl+c" ), key .WithHelp ("ctrl-c" , "quit" ))}
251249 }
250+ return false
251+ }
252+
253+ func (m lintModel ) ShortHelp () []key.Binding {
254+ return []key.Binding {key .NewBinding (key .WithKeys ("ctrl+c" ), key .WithHelp ("ctrl-c" , "quit" ))}
252255}
253256
254257func (m lintModel ) FullHelp () [][]key.Binding {
255- if m .canSkip {
256- return [][]key.Binding {{
257- key .NewBinding (key .WithKeys ("ctrl+c" ), key .WithHelp ("ctrl-c" , "quit" )),
258- key .NewBinding (key .WithKeys ("enter" ), key .WithHelp ("enter" , "skip diagnostics" )),
259- }}
260- } else {
261- return [][]key.Binding {{key .NewBinding (key .WithKeys ("ctrl+c" ), key .WithHelp ("ctrl-c" , "quit" ))}}
262- }
258+ return [][]key.Binding {{key .NewBinding (key .WithKeys ("ctrl+c" ), key .WithHelp ("ctrl-c" , "quit" ))}}
263259}
264260
265261func runLinter (ctx context.Context , cmd * cli.Command , canSkip bool ) error {
@@ -274,7 +270,6 @@ func runLinter(ctx context.Context, cmd *cli.Command, canSkip bool) error {
274270 m := lintModel {
275271 spinner : s ,
276272 watching : cmd .Bool ("watch" ),
277- canSkip : canSkip ,
278273 ctx : ctx ,
279274 cmd : cmd ,
280275 client : client ,
@@ -306,7 +301,7 @@ func runLinter(ctx context.Context, cmd *cli.Command, canSkip bool) error {
306301 }
307302
308303 // If not in watch mode and we have blocking diagnostics, exit with error code
309- if ! cmd .Bool ("watch" ) && hasBlockingDiagnostic ( finalModel . diagnostics ) {
304+ if ! cmd .Bool ("watch" ) {
310305 os .Exit (1 )
311306 }
312307
0 commit comments