Skip to content

[tool] Running dev/bots/analyze.dart fails if ktlint is not installed for a framework-only setup #181284

Description

@navaronbracke

Steps to reproduce

  1. Do the instructions in https://github.com/flutter/flutter/blob/master/docs/contributing/Setting-up-the-Framework-development-environment.md to set up your framework development environment
  2. In your flutter SDK checkout, do dart --enable-asserts dev/bots/analyze.dart, which is a check that is done by Linux analyze in CI
  3. The step Lint Kotlin files... fails with an error, because ktlint is not yet installed
navaronbracke@MacBook-Pro-van-Navaron flutter % which ktlint
ktlint not found

Note: I'm not sure if ktlint is installed as part of the Flutter Engine setup (through depot-tools or similar)

Expected results

I should be able to run dart --enable-asserts dev/bots/analyze.dart in a framework-only setup, that does not touch Flutter engine code (Kotlin in this case)

In any case, the tool should:

  1. Warn the user that Kotlin files will not be linted because ktlint is missing, instead of crashing
  2. Point the user to install instructions for ktlint, if they forgot to install it as part of a Flutter Engine setup
  3. Not lint Kotlin files if these have not changed?

cc @gmackall

Context: https://discord.com/channels/608014603317936148/608018585025118217/1463635553248608435

Actual results

An error is thrown:

navaronbracke@MacBook-Pro-van-Navaron flutter % dart --enable-asserts dev/bots/analyze.dart  
▌20:00:56▐ STARTING ANALYSIS
▌20:00:56▐ Release branch validation
▌20:00:57▐ TargetPlatform tool/framework consistency
▌20:00:57▐ All tool test files end in _test.dart...
▌20:00:57▐ No sync*/async*
▌20:00:59▐ No runtimeType in toString...
▌20:00:59▐ Debug mode instead of checked mode...
▌20:01:00▐ Links for creating GitHub issues...
▌20:01:01▐ Links to repositories...
▌20:01:03▐ Unexpected binaries...
▌20:01:04▐ Trailing spaces...
▌20:01:06▐ Spaces after flow control statements...
▌20:01:06▐ Deprecations...
▌20:01:16▐ Goldens...
▌20:01:21▐ Skip test comments...
▌20:01:24▐ Licenses...
▌20:01:35▐ Test imports...
▌20:01:36▐ Bad imports (framework)...
▌20:01:37▐ Bad imports (tools)...
▌20:01:37▐ Internationalization...
▌20:01:40▐ Localization files of stocks app...
▌20:01:41▐ Integration test timeouts...
▌20:01:41▐ null initialized debug fields...
▌20:01:44▐ Taboo words...
▌20:01:46▐ Lint Kotlin files...
RUNNING: cd .; ktlint --baseline=/Users/navaronbracke/Documents/flutter/dev/bots/test/analyze-test-input/ktlint-baseline.xml --editorconfig=/Users/navaUnhandled exception:
ProcessException: No such file or directory
  Command: ktlint --baseline=/Users/navaronbracke/Documents/flutter/dev/bots/test/analyze-test-input/ktlint-baseline.xml --editorconfig=/Users/navaronbracke/Documents/flutter/dev/bots/test/analyze-test-input/.editorconfig
#0      _ProcessImpl._start (dart:io-patch/process_patch.dart:411:33)
#1      Process.start (dart:io-patch/process_patch.dart:42:20)
#2      _evalCommand (file:///Users/navaronbracke/Documents/flutter/dev/bots/analyze.dart:2263:41)
#3      lintKotlinFiles (file:///Users/navaronbracke/Documents/flutter/dev/bots/analyze.dart:2531:39)
#4      run (file:///Users/navaronbracke/Documents/flutter/dev/bots/analyze.dart:171:9)
<asynchronous suspension>
#5      main (file:///Users/navaronbracke/Documents/flutter/dev/bots/analyze.dart:53:3)
<asynchronous suspension>

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.41.0-1.0.pre-195, on macOS 15.6.1 24G90
    darwin-x64, locale en-BE) [4.4s]
    ! Flutter version 3.41.0-1.0.pre-195 on channel [user-branch] at
      /Users/navaronbracke/Documents/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an
      official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions
      at https://flutter.dev/setup.
    • Upstream repository git@github.com:navaronbracke/flutter.git
    • FLUTTER_GIT_URL = git@github.com:navaronbracke/flutter.git
    • Framework revision 05665874b2 (28 minutes ago), 2026-01-21 21:40:57 +0100
    • Engine revision ac069ade5c
    • Dart version 3.12.0 (build 3.12.0-51.0.dev)
    • DevTools version 2.54.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, enable-swift-package-manager,
      omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration,
      enable-riscv64
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version
    36.1.0-rc1) [9.1s]
    • Android SDK at /Users/navaronbracke/Library/Android/sdk
    • Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
    • Platform android-36, build-tools 36.1.0-rc1
    • ANDROID_HOME = /Users/navaronbracke/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on
      this machine.
      To manually set the JDK path, use: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 26.1.1) [5.9s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17B100
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [28ms]
    • CHROME_EXECUTABLE = /Applications/Google Chrome.app/Contents/MacOS/Google
      Chrome

[✓] Connected device (2 available) [8.7s]
    • macOS (desktop) • macos  • darwin-x64     • macOS 15.6.1 24G90 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 143.0.7499.194
    ! Error: Browsing on the local area network for iPhone van device. Ensure
      the device is unlocked and attached with a cable or associated with the
      same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code
      -27)

[✓] Network resources [790ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.found in release: 3.38Found to occur in 3.38found in release: 3.41Found to occur in 3.41frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions