Skip to content

Should literal_only_boolean_expressions flag while(true) ? #57452

@a14n

Description

@a14n

I think the following while (true) shouldn't be flagged by literal_only_boolean_expressions :

/// Return an unused TCP port number.
Future<int> findAvailablePort() async {
  int port = 20000;
  while (true) { // LINT
    try {
      ServerSocket socket =
          await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, port);
      await socket.close();
      return port;
    } catch (_) {
      port++;
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.linter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions