Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart analyze fails with "Output exceeded n bytes" #1205

Closed
swift-kim opened this issue Mar 15, 2023 · 5 comments
Closed

dart analyze fails with "Output exceeded n bytes" #1205

swift-kim opened this issue Mar 15, 2023 · 5 comments

Comments

@swift-kim
Copy link

https://pub.dev/packages/tizen_interop/score

I'm a maintainer of the above package but I can't understand why the static analysis always fails with "Running dart analyze produced too large output".

The issue can be reproduced locally with pana.

$ cd tizen_interop
$ git clean -xdf
$ ~/.pub-cache/bin/pana --no-warning
INFO       Running `/home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics --version`...
INFO       Running `flutter --suppress-analytics --no-version-check --version --machine`...
INFO       Running `git rev-parse --show-toplevel`...
INFO       Running `/home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics pub get --no-example`...
INFO       Running `/home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics pub outdated --json --up-to-date --no-dev-dependencies --no-dependency-overrides`...
INFO       Analyzing package...
INFO       Running `/home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics analyze --format machine lib`...
SEVERE     Killing `/home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics analyze --format machine lib` Output exceeded 10485760 bytes.
INFO       killed `/home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics analyze --format machine lib` - true
INFO       Running `git init`...
...

But the error is not reproduced when I run dart analyze directly with the exact same command used by pana.

$ /home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --no-analytics analyze --format machine lib
### No issues! ###

My Dart SDK version:

$ /home/swift/Git/flutter-tizen/flutter/bin/cache/dart-sdk/bin/dart --version
Dart SDK version: 2.19.1 (stable) (Tue Jan 31 12:25:35 2023 +0000) on "linux_x64"

The package (tizen_interop) is obviously large in code size (about 1M lines) but this fact doesn't explain why pana fails. What would be the real cause of the issue and how should I deal with it?

@sigurdm
Copy link
Contributor

sigurdm commented Mar 15, 2023

The documentation logs can be seen here: https://pub.dev/documentation/tizen_interop/latest/log.txt

@sigurdm
Copy link
Contributor

sigurdm commented Mar 15, 2023

The documentation logs can be seen here: https://pub.dev/documentation/tizen_interop/latest/log.txt

Sorry, that was a red herring.

I ran a manual pana run, without the limit on output size, and here is the relevant section:

## ✗ Pass static analysis (20 / 30)
### [~] 20/30 points: code has no errors, warnings, lints, or formatting issues

Found 88745 issues. Showing the first 2:

<details>
<summary>
INFO: The variable name 'get_last_result' isn't a lowerCamelCase identifier.
</summary>

`lib/src/bindings/4.0/generated_bindings.dart:32:7`


32 │ int get_last_result() {
│ ^^^^^^^^^^^^^^^


To reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `dart analyze lib/src/bindings/4.0/generated_bindings.dart`
</details>
<details>
<summary>
INFO: The variable name '_get_last_resultPtr' isn't a lowerCamelCase identifier.
</summary>

pub.dev analyzes the package with the core lints.

If you are certain that you don't want to follow the dart naming convention in the generated code, you can put: // ignore_for_file: type=lint at the top. See: https://dart.dev/guides/language/analysis-options#suppressing-rules-for-a-file

@swift-kim
Copy link
Author

@sigurdm Thank you so much for the really quick response!

pub.dev analyzes the package with the core lints.

Does pana (pub.dev) always use the core lints even if there's a custom analysis_options.yaml in the package? I tried adding the following lines to my analysis_options.yaml since I wanted to apply the rules globally to all files, but it still didn't work.

include: package:lints/core.yaml

linter:
  rules:
    camel_case_types: false
    non_constant_identifier_names: false

If you are certain that you don't want to follow the dart naming convention in the generated code, you can put: // ignore_for_file: type=lint at the top.

Maybe this is the only option I can use if pana works in that way.

@sigurdm
Copy link
Contributor

sigurdm commented Mar 15, 2023

Yeah - it always uses those and ignores the custom analysis_options.yaml.

@swift-kim
Copy link
Author

Okay. I read the ffigen documentation again and noticed that adding the following preamble is the recommended way to suppress the warnings.

preamble: |
  // ignore_for_file: camel_case_types, non_constant_identifier_names

Thank you again for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants