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 Analysis Server always crashes whenever I launch my custom lint project on vs code #60

Closed
biplab-khalti opened this issue Jan 8, 2023 · 62 comments
Labels
bug Something isn't working

Comments

@biplab-khalti
Copy link

Describe the bug
Dart Analysis Server always crashes whenever I launch my custom lint project on vs code. The crash doesn't take place when I launch my other flutter projects.

flutter doctor -v
[✓] Flutter (Channel stable, 3.3.10, on Fedora Linux 37 (Workstation Edition) 6.0.17-300.fc37.x86_64, locale en_US.UTF-8)
    • Flutter version 3.3.10 on channel stable at /home/biplab-khalti/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (3 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/biplab-khalti/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /var/lib/snapd/snap/android-studio/125/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.3)
    • Android Studio at /var/lib/snapd/snap/android-studio/125/android-studio
    • Flutter plugin version 71.0.3
    • Dart plugin version 213.7433
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.74.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.56.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Fedora Linux 37 (Workstation Edition) 6.0.17-300.fc37.x86_64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 108.0.5359.124

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Screenshot from 2023-01-08 22-32-09

@biplab-khalti biplab-khalti added the bug Something isn't working label Jan 8, 2023
@rrousselGit
Copy link
Collaborator

Could you share your custom_lint.log file, if any?

@biplab-khalti
Copy link
Author

Sorry. The log file is not there.

@rrousselGit
Copy link
Collaborator

Any chance you could create a git repo for reproducing the issue?

@biplab-khalti
Copy link
Author

Okay. So, I had a folder Experiments where I created 2 dart packages - one for the lint and other just a dummy project to check if the lint is working.
If I launched my Experiments directory on vs code, that is when I get the analysis server issue. On launching just the lint project separately on vs code, the analyzer seems to be working fine.

@rrousselGit
Copy link
Collaborator

Sure but I'd need something I can run. It's unlikely to be something I can debug with just a description of your situation

@biplab-khalti
Copy link
Author

Alright. let me create a git repo.

@kuhnroyal
Copy link
Contributor

kuhnroyal commented Jan 8, 2023

Seeing these crashes as well on 0.1.0
And also timeouts of dart run custom_lint with certain analyzer and _fe_analyzer_shared versions combinations.

The request analysis.setContextRoots failed with the following error:
RequestErrorCode.PLUGIN_ERROR
Bad state: Two ContextRoots depend on _fe_analyzer_shared but use different version,
therefore custom_lint does not know which one to pick.
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-52.0.0/

at:
#0      _writePackageConfigForTempProject (package:custom_lint/src/v2/server_to_client_channel.dart:74:9)
#1      _SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:225:5)
#2      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:269:25)
<asynchronous suspension>
#3      CustomLintServer._handleAnalysisSetContextRoots (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:244:5)
<asynchronous suspension>
#4      CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:118:22)
<asynchronous suspension>

[custom_lint] 2023-01-08T16:59:29.638686 Bad state: No element
[custom_lint] 2023-01-08T16:59:29.638686 #0      Stream.first.<anonymous closure> (dart:async/stream.dart:1581:9)
[custom_lint] 2023-01-08T16:59:29.638686 #1      _rootRun (dart:async/zone.dart:1383:47)
[custom_lint] 2023-01-08T16:59:29.638686 #2      _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T16:59:29.638686 #3      _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T16:59:29.638686 #4      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T16:59:29.638686 #5      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T16:59:29.638686 #6      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T16:59:29.638686 #7      _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
[custom_lint] 2023-01-08T16:59:29.638686 #8      _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
[custom_lint] 2023-01-08T16:59:29.638686 #9      _rootRun (dart:async/zone.dart:1391:13)
[custom_lint] 2023-01-08T16:59:29.638686 #10     _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T16:59:29.638686 #11     _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T16:59:29.638686 #12     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T16:59:29.638686 #13     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T16:59:29.638686 #14     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T16:59:29.638686 #15     _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:782:19)
[custom_lint] 2023-01-08T16:59:29.638686 #16     _StreamController._closeUnchecked (dart:async/stream_controller.dart:637:7)
[custom_lint] 2023-01-08T16:59:29.638686 #17     _StreamController.close (dart:async/stream_controller.dart:630:5)
[custom_lint] 2023-01-08T16:59:29.638686 #18     _RawServerSocket.listen.<anonymous closure> (dart:io-patch/socket_patch.dart:1762:37)
[custom_lint] 2023-01-08T16:59:29.638686 #19     _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1401:39)
[custom_lint] 2023-01-08T16:59:29.638686 #20     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
[custom_lint] 2023-01-08T16:59:29.638686
The request analysis.setContextRoots failed with the following error:
RequestErrorCode.PLUGIN_ERROR
Bad state: Two ContextRoots depend on _fe_analyzer_shared but use different version,
therefore custom_lint does not know which one to pick.
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-49.0.0/

at:
#0      _writePackageConfigForTempProject (package:custom_lint/src/v2/server_to_client_channel.dart:74:9)
#1      _SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:225:5)
#2      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:269:25)
<asynchronous suspension>
#3      CustomLintServer._handleAnalysisSetContextRoots (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:244:5)
<asynchronous suspension>
#4      CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:118:22)
<asynchronous suspension>

[custom_lint] 2023-01-08T17:03:48.381953 Bad state: No element
[custom_lint] 2023-01-08T17:03:48.381953 #0      Stream.first.<anonymous closure> (dart:async/stream.dart:1581:9)
[custom_lint] 2023-01-08T17:03:48.381953 #1      _rootRun (dart:async/zone.dart:1383:47)
[custom_lint] 2023-01-08T17:03:48.381953 #2      _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T17:03:48.381953 #3      _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T17:03:48.381953 #4      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T17:03:48.381953 #5      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T17:03:48.381953 #6      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T17:03:48.381953 #7      _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
[custom_lint] 2023-01-08T17:03:48.381953 #8      _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
[custom_lint] 2023-01-08T17:03:48.381953 #9      _rootRun (dart:async/zone.dart:1391:13)
[custom_lint] 2023-01-08T17:03:48.381953 #10     _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T17:03:48.381953 #11     _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T17:03:48.381953 #12     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T17:03:48.381953 #13     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T17:03:48.381953 #14     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T17:03:48.381953 #15     _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:782:19)
[custom_lint] 2023-01-08T17:03:48.381953 #16     _StreamController._closeUnchecked (dart:async/stream_controller.dart:637:7)
[custom_lint] 2023-01-08T17:03:48.381953 #17     _StreamController.close (dart:async/stream_controller.dart:630:5)
[custom_lint] 2023-01-08T17:03:48.381953 #18     _RawServerSocket.listen.<anonymous closure> (dart:io-patch/socket_patch.dart:1762:37)
[custom_lint] 2023-01-08T17:03:48.381953 #19     _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1401:39)
[custom_lint] 2023-01-08T17:03:48.381953 #20     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
[custom_lint] 2023-01-08T17:03:48.381953
The request analysis.setContextRoots failed with the following error:
RequestErrorCode.PLUGIN_ERROR
Bad state: Two ContextRoots depend on _fe_analyzer_shared but use different version,
therefore custom_lint does not know which one to pick.
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-51.0.0/

at:
#0      _writePackageConfigForTempProject (package:custom_lint/src/v2/server_to_client_channel.dart:74:9)
#1      _SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:225:5)
#2      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:269:25)
<asynchronous suspension>
#3      CustomLintServer._handleAnalysisSetContextRoots (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:244:5)
<asynchronous suspension>
#4      CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:118:22)
<asynchronous suspension>

[custom_lint] 2023-01-08T17:17:33.009881 Bad state: No element
[custom_lint] 2023-01-08T17:17:33.009881 #0      Stream.first.<anonymous closure> (dart:async/stream.dart:1581:9)
[custom_lint] 2023-01-08T17:17:33.009881 #1      _rootRun (dart:async/zone.dart:1383:47)
[custom_lint] 2023-01-08T17:17:33.009881 #2      _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T17:17:33.009881 #3      _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T17:17:33.009881 #4      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T17:17:33.009881 #5      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T17:17:33.009881 #6      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T17:17:33.009881 #7      _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
[custom_lint] 2023-01-08T17:17:33.009881 #8      _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
[custom_lint] 2023-01-08T17:17:33.009881 #9      _rootRun (dart:async/zone.dart:1391:13)
[custom_lint] 2023-01-08T17:17:33.009881 #10     _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T17:17:33.009881 #11     _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T17:17:33.009881 #12     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T17:17:33.009881 #13     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T17:17:33.009881 #14     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T17:17:33.009881 #15     _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:782:19)
[custom_lint] 2023-01-08T17:17:33.009881 #16     _StreamController._closeUnchecked (dart:async/stream_controller.dart:637:7)
[custom_lint] 2023-01-08T17:17:33.009881 #17     _StreamController.close (dart:async/stream_controller.dart:630:5)
[custom_lint] 2023-01-08T17:17:33.009881 #18     _RawServerSocket.listen.<anonymous closure> (dart:io-patch/socket_patch.dart:1762:37)
[custom_lint] 2023-01-08T17:17:33.009881 #19     _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1401:39)
[custom_lint] 2023-01-08T17:17:33.009881 #20     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
[custom_lint] 2023-01-08T17:17:33.009881
The request analysis.setContextRoots failed with the following error:
RequestErrorCode.PLUGIN_ERROR
Bad state: Two ContextRoots depend on collection but use different version,
therefore custom_lint does not know which one to pick.
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/collection-1.16.0/
- file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/collection-1.17.0/

at:
#0      _writePackageConfigForTempProject (package:custom_lint/src/v2/server_to_client_channel.dart:74:9)
#1      _SocketCustomLintServerToClientChannel.init (package:custom_lint/src/v2/server_to_client_channel.dart:225:5)
#2      CustomLintServer._maybeSpawnCustomLintPlugin (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:269:25)
<asynchronous suspension>
#3      CustomLintServer._handleAnalysisSetContextRoots (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:244:5)
<asynchronous suspension>
#4      CustomLintServer._handleRequest (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:118:22)
<asynchronous suspension>

[custom_lint] 2023-01-08T17:19:48.552099 Bad state: No element
[custom_lint] 2023-01-08T17:19:48.552099 #0      Stream.first.<anonymous closure> (dart:async/stream.dart:1581:9)
[custom_lint] 2023-01-08T17:19:48.552099 #1      _rootRun (dart:async/zone.dart:1383:47)
[custom_lint] 2023-01-08T17:19:48.552099 #2      _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T17:19:48.552099 #3      _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T17:19:48.552099 #4      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T17:19:48.552099 #5      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T17:19:48.552099 #6      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T17:19:48.552099 #7      _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
[custom_lint] 2023-01-08T17:19:48.552099 #8      _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
[custom_lint] 2023-01-08T17:19:48.552099 #9      _rootRun (dart:async/zone.dart:1391:13)
[custom_lint] 2023-01-08T17:19:48.552099 #10     _CustomZone.run (dart:async/zone.dart:1293:19)
[custom_lint] 2023-01-08T17:19:48.552099 #11     _CustomZone.runGuarded (dart:async/zone.dart:1201:7)
[custom_lint] 2023-01-08T17:19:48.552099 #12     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
[custom_lint] 2023-01-08T17:19:48.552099 #13     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
[custom_lint] 2023-01-08T17:19:48.552099 #14     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
[custom_lint] 2023-01-08T17:19:48.552099 #15     _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:782:19)
[custom_lint] 2023-01-08T17:19:48.552099 #16     _StreamController._closeUnchecked (dart:async/stream_controller.dart:637:7)
[custom_lint] 2023-01-08T17:19:48.552099 #17     _StreamController.close (dart:async/stream_controller.dart:630:5)
[custom_lint] 2023-01-08T17:19:48.552099 #18     _RawServerSocket.listen.<anonymous closure> (dart:io-patch/socket_patch.dart:1762:37)
[custom_lint] 2023-01-08T17:19:48.552099 #19     _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1401:39)
[custom_lint] 2023-01-08T17:19:48.552099 #20     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
[custom_lint] 2023-01-08T17:19:48.552099
[custom_lint] 2023-01-08T18:22:00.174957 FileSystemException: writeFrom failed, path = '' (OS Error: Broken pipe, errno = 32)
[custom_lint] 2023-01-08T18:22:00.174957 #0      _RandomAccessFile.writeFromSync (dart:io/file_impl.dart:873:7)
[custom_lint] 2023-01-08T18:22:00.174957 #1      _StdConsumer.addStream.<anonymous closure> (dart:io/stdio.dart:309:15)
[custom_lint] 2023-01-08T18:22:00.174957 #2      _rootRunUnary (dart:async/zone.dart:1399:47)
[custom_lint] 2023-01-08T18:22:00.174957 #3      _CustomZone.runUnary (dart:async/zone.dart:1300:19)
[custom_lint] 2023-01-08T18:22:00.174957 #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1209:7)
[custom_lint] 2023-01-08T18:22:00.174957 #5      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
[custom_lint] 2023-01-08T18:22:00.174957 #6      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
[custom_lint] 2023-01-08T18:22:00.174957 #7      _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
[custom_lint] 2023-01-08T18:22:00.174957 #8      _StreamController._add (dart:async/stream_controller.dart:648:7)
[custom_lint] 2023-01-08T18:22:00.174957 #9      _StreamController.add (dart:async/stream_controller.dart:596:5)
[custom_lint] 2023-01-08T18:22:00.174957 #10     _StreamSinkImpl.add (dart:io/io_sink.dart:136:17)
[custom_lint] 2023-01-08T18:22:00.174957 #11     _IOSinkImpl.write (dart:io/io_sink.dart:269:5)
[custom_lint] 2023-01-08T18:22:00.174957 #12     _IOSinkImpl.writeln (dart:io/io_sink.dart:289:5)
[custom_lint] 2023-01-08T18:22:00.174957 #13     _StdSink.writeln (dart:io/stdio.dart:342:11)
[custom_lint] 2023-01-08T18:22:00.174957 #14     _runPlugins (package:custom_lint/custom_lint.dart:84:12)
[custom_lint] 2023-01-08T18:22:00.174957 <asynchronous suspension>
[custom_lint] 2023-01-08T18:22:00.174957 #15     customLint.<anonymous closure> (package:custom_lint/custom_lint.dart:52:7)
[custom_lint] 2023-01-08T18:22:00.174957 <asynchronous suspension>
[custom_lint] 2023-01-08T18:22:00.174957 #16     customLint (package:custom_lint/custom_lint.dart:49:3)
[custom_lint] 2023-01-08T18:22:00.174957 <asynchronous suspension>
[custom_lint] 2023-01-08T18:22:00.174957 #17     entrypoint (file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/custom_lint-0.1.0/bin/custom_lint.dart:31:3)
[custom_lint] 2023-01-08T18:22:00.174957 <asynchronous suspension>
[custom_lint] 2023-01-08T18:22:00.174957 #18     main (file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/custom_lint-0.1.0/bin/custom_lint.dart:35:3)
[custom_lint] 2023-01-08T18:22:00.174957 <asynchronous suspension>
[custom_lint] 2023-01-08T18:22:00.174957
[custom_lint] 2023-01-08T18:55:04.887674 FileSystemException: writeFrom failed, path = '' (OS Error: Broken pipe, errno = 32)
[custom_lint] 2023-01-08T18:55:04.887674 #0      _RandomAccessFile.writeFromSync (dart:io/file_impl.dart:873:7)
[custom_lint] 2023-01-08T18:55:04.887674 #1      _StdConsumer.addStream.<anonymous closure> (dart:io/stdio.dart:309:15)
[custom_lint] 2023-01-08T18:55:04.887674 #2      _rootRunUnary (dart:async/zone.dart:1399:47)
[custom_lint] 2023-01-08T18:55:04.887674 #3      _CustomZone.runUnary (dart:async/zone.dart:1300:19)
[custom_lint] 2023-01-08T18:55:04.887674 #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1209:7)
[custom_lint] 2023-01-08T18:55:04.887674 #5      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
[custom_lint] 2023-01-08T18:55:04.887674 #6      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
[custom_lint] 2023-01-08T18:55:04.887674 #7      _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
[custom_lint] 2023-01-08T18:55:04.887674 #8      _StreamController._add (dart:async/stream_controller.dart:648:7)
[custom_lint] 2023-01-08T18:55:04.887674 #9      _StreamController.add (dart:async/stream_controller.dart:596:5)
[custom_lint] 2023-01-08T18:55:04.887674 #10     _StreamSinkImpl.add (dart:io/io_sink.dart:136:17)
[custom_lint] 2023-01-08T18:55:04.887674 #11     _IOSinkImpl.write (dart:io/io_sink.dart:269:5)
[custom_lint] 2023-01-08T18:55:04.887674 #12     _IOSinkImpl.writeln (dart:io/io_sink.dart:289:5)
[custom_lint] 2023-01-08T18:55:04.887674 #13     _StdSink.writeln (dart:io/stdio.dart:342:11)
[custom_lint] 2023-01-08T18:55:04.887674 #14     _runPlugins (package:custom_lint/custom_lint.dart:84:12)
[custom_lint] 2023-01-08T18:55:04.887674 <asynchronous suspension>
[custom_lint] 2023-01-08T18:55:04.887674 #15     customLint.<anonymous closure> (package:custom_lint/custom_lint.dart:52:7)
[custom_lint] 2023-01-08T18:55:04.887674 <asynchronous suspension>
[custom_lint] 2023-01-08T18:55:04.887674 #16     customLint (package:custom_lint/custom_lint.dart:49:3)
[custom_lint] 2023-01-08T18:55:04.887674 <asynchronous suspension>
[custom_lint] 2023-01-08T18:55:04.887674 #17     entrypoint (file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/custom_lint-0.1.0/bin/custom_lint.dart:31:3)
[custom_lint] 2023-01-08T18:55:04.887674 <asynchronous suspension>
[custom_lint] 2023-01-08T18:55:04.887674 #18     main (file:///Users/USER/.pub-cache/hosted/pub.dartlang.org/custom_lint-0.1.0/bin/custom_lint.dart:35:3)
[custom_lint] 2023-01-08T18:55:04.887674 <asynchronous suspension>
[custom_lint] 2023-01-08T18:55:04.887674

After playing around with the versions, I seem to only be able to run anything with analyzer: 5.2.0 and _fe_analyzer_shared: 50.0.0.

@Biplab-Dutta
Copy link
Contributor

Biplab-Dutta commented Jan 8, 2023

Hey @rrousselGit. Sorry for the late response.
Replying from my main github account. haha
Here's a git repo.
https://github.com/Biplab-Dutta/custom_lint_issue_demo

@kuhnroyal
Copy link
Contributor

I have the exact same project setup, an example project with test cases.

@Biplab-Dutta
Copy link
Contributor

Biplab-Dutta commented Jan 8, 2023

Hi @kuhnroyal. Can you check something for me? Try launching the lint package's code separately on your IDE and see if the analyzer works.

@kuhnroyal
Copy link
Contributor

Hi @kuhnroyal. Can you check something for me? Try launching the lint package's code separately on your IDE and see if the analyzer works.

Yea seems to work.

@rrousselGit
Copy link
Collaborator

@kuhnroyal You have two projects or more in your repository that use different dependency versions.
For custom_lint to work, all projects opened where custom_lint is enabled must use the same dependency versions.

I'll see how I can make the error more obvious, but in any case, you need to fix this on your side.

@rrousselGit
Copy link
Collaborator

@Biplab-Dutta Your custom_lint setup is incorrect.

It's weird that the analyzer crashes, but you shouldn't have a bin folder. There was a breaking change recently on how plugins are created. See the readme/changelog

@Biplab-Dutta
Copy link
Contributor

Should have checked the CHANGELOG 🤦‍♂️.

@Biplab-Dutta
Copy link
Contributor

@rrousselGit looks like the README has not been updated.
image

@rrousselGit
Copy link
Collaborator

Eh I updated the code snippet but forgot to change the path. Will fix

@Biplab-Dutta
Copy link
Contributor

I shall try again tomorrow following the new instructions as shown in the CHANGELOG. Shall let you know if anything goes wrong. Thanks. It's almost 1 am 🥶

@Biplab-Dutta
Copy link
Contributor

So, I gave it a last go before going to bed. @rrousselGit would you mind checking if I am doing something wrong again? The analysis server still crashes after editing the entry points.
https://github.com/Biplab-Dutta/custom_lint_issue_demo

@rrousselGit
Copy link
Collaborator

@Biplab-Dutta You didn't implement the getLints() method, so there's a compilation error.

Afaik the server crashes because it fails to report the error about how your plugin failed to start, so it makes debugging a bit difficult.

@Biplab-Dutta
Copy link
Contributor

Let's not close this issue for now. I will come back to it tomorrow again.

@kuhnroyal
Copy link
Contributor

@kuhnroyal You have two projects or more in your repository that use different dependency versions. For custom_lint to work, all projects opened where custom_lint is enabled must use the same dependency versions.

I'll see how I can make the error more obvious, but in any case, you need to fix this on your side.

Yea I figured and after freezing some deps my test project (example folder inside my lints project) has the expected lints when running dart run custom_lint example.
But the analysis server in IntelliJ is still crashing.

@rrousselGit
Copy link
Collaborator

@kuhnroyal it'd be great if you could share some way to reproduce your issue

@marcotrumpet
Copy link

marcotrumpet commented Jan 9, 2023

I all, I'm having the same issue.. not sure if I did something wrong.. if it can help here is my repo: https://github.com/marcotrumpet/my_custom_lints/tree/bugfix/dart-analysis-server-error
Inside it, there is a package called 'mason_custom_lints' and inside 'my_dart_app' the implementation.
I used it with the past implementation but I have had issues since trying to update to version 0.1.0.

Please ask if you want more specifications I'll continue to inspect this.

Thanks!

EDIT with flutter doctor:

[✓] Flutter (Channel stable, 3.3.5, on macOS 13.0.1 22A400 darwin-arm, locale it-IT)
    • Flutter version 3.3.5 on channel stable at /Users/marcogaletta/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d9111f6402 (3 months ago), 2022-10-19 12:27:13 -0700
    • Engine revision 3ad69d7be3
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/marcogaletta/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.74.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.56.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.0.1 22A400 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 108.0.5359.124

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@rrousselGit
Copy link
Collaborator

It could be based on your SDK version too. Do you have the issue with the stable channel and master channel?

@rrousselGit
Copy link
Collaborator

But my bet is that there's something that doesn't compile in your plugin, which prevents the plugin from starting.

@marcotrumpet
Copy link

marcotrumpet commented Jan 9, 2023

Hey, thanks for your fast response. I'll check with other flutter versions. Before the upgrade btw I had an error from vscode about the error starting the plugin (if there was an error).

@rrousselGit
Copy link
Collaborator

I've cloned your project and it doesn't crash for me.
And it highlights one compilation error:

The available unit doesn't exists

Screenshot 2023-01-09 at 16 26 13

@rrousselGit
Copy link
Collaborator

Fixed the error and it seems to be working fine for me

Screenshot 2023-01-09 at 16 27 24

@marcotrumpet
Copy link

you're too fast :D just fixed that.. also upgraded to flutter 3.3.10 but same error.. wonder if a reboot will solve as always

@marcotrumpet
Copy link

So, disabling custom_lint seems to let server analysis alive and working. But running dart run custom_lint gives
Building package executable... (3.3s) Built custom_lint:custom_lint. some_bloc.dart:1:7 • If the file name ends with _bloc the className must end with Bloc • class_name_should_match_file_name
So it seems something related to vscode probably? notice that it doesn't create a log file since the error

@rrousselGit
Copy link
Collaborator

So it works when using the CLI eh.
Do you mind modifying the source of custom_lint to add a log?

Go in the file: custom_lint/lib/src/v2/server_to_client_channel.dart

Inside _SocketCustomLintServerToClientChannel.init on line 266 add the following:

    final processFuture = _asyncRetry(retryCount: 5, () async {
      port = await _findPossiblyUnusedPort();
      final process = await Process.start(
        Platform.resolvedExecutable,
        [
          '--enable-vm-service=$port',
          join('lib', 'main.dart'),
          await _serverSocket.then((value) => value.port.toString())
        ],
        workingDirectory: _tempDirectory.path,
      );
      return process;
    });

+    void log(Object message) {
+      for (final root in _contextRoots.roots) {
+        final file = File(join(root.root, 'log.txt'));
+        file.writeAsString('$message\n', mode: FileMode.append);
+      }
+    }
+
+    log('Here');
+    processFuture.then(
+      (_) => log('Started successfully'),
+      onError: (err, stack) {
+        log('Error: $err\n$stack');
+      },
+    );

    await processFuture.then(
      _process.complete,
      onError: _process.completeError,
    );

Restarting the project should create a log.txt somewhere in your project.

@kuhnroyal
Copy link
Contributor

kuhnroyal commented Jan 9, 2023

Yea same for me, running in CLI works and outputs the expected lints but constant crashing in IntelliJ.
I now published our custom lints package to our private registry and use it in our app, just to get rid of local path dependencies but it still crashes.

@kuhnroyal
Copy link
Contributor

Here
Started successfully

But keeps crashing

@rrousselGit
Copy link
Collaborator

Funky. At least it shows the problem isn't here.

I'll try some things and make a dev release. I have some theories.
I'll come back to you tomorrow so that you can try it out and see if it fixes the problem.

@kuhnroyal
Copy link
Contributor

kuhnroyal commented Jan 9, 2023

Found something.

When running flutter analyze without the plugin enabled, it just works normal.
With the plugin enabled, Flutter crashes:

Flutter crash report.
Please report a bug at https://github.com/flutter/flutter/issues.

## command

flutter analyze

## exception

_Exception: Exception: analysis server exited with code -6 and output:
[stdout] {"event":"analysis.errors","params":{"file":"/Users/USER/workspace/PROJECT/test/unit/util/pattern_validator_test.dart","errors":[]}}
[stdout] {"event":"analysis.errors","params":{"file":"/Users/USER/workspace/PROJECT/test/unit/util/number_format_test.dart","errors":[]}}
[stderr] ../../runtime/vm/message_snapshot.cc: 576: error: expected: !lib.IsNull()
[stderr] version=2.18.5 (stable) (Tue Nov 22 15:47:29 2022 +0000) on "macos_x64"
[stderr] pid=76493, thread=9991, isolate_group=main(0x7f9f2c872800), isolate=main(0x7f9f2c898200)
[stderr] isolate_instructions=106e7e4c0, vm_instructions=106e7e4c0
[stderr]   pc 0x00000001070e6af4 fp 0x000070000ee31580 dart::Profiler::DumpStackTrace(void*)+0x64
[stderr]   pc 0x0000000106e7e694 fp 0x000070000ee31660 dart::Assert::Fail(char const*, ...) const+0x84
[stderr]   pc 0x000000010704d425 fp 0x000070000ee316c0 dart::ReadApiMessage(dart::Zone*, dart::Message*)+0x8ff5
[stderr]   pc 0x0000000107043494 fp 0x000070000ee31720 dart::MessageDeserializer::Deserialize()+0x234
[stderr]   pc 0x00000001070443e9 fp 0x000070000ee31850 dart::ReadMessage(dart::Thread*, dart::Message*)+0x159
[stderr]   pc 0x000000010701315f fp 0x000070000ee31df0 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >)+0xbf
[stderr]   pc 0x000000010703ed8d fp 0x000070000ee31e60 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x12d
[stderr]   pc 0x000000010703f49f fp 0x000070000ee31eb0 dart::MessageHandler::TaskCallback()+0x1df
[stderr]   pc 0x0000000107177bf7 fp 0x000070000ee31f30 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x147
[stderr]   pc 0x000000010717805e fp 0x000070000ee31f60 dart::ThreadPool::Worker::Main(unsigned long)+0x6e
[stderr]   pc 0x00000001070e28df fp 0x000070000ee31fb0 dart::OSThread::GetMaxStackSize()+0xaf
[stderr]   pc 0x00007ff8144b5259 fp 0x000070000ee31fd0 _pthread_start+0x7d
[stderr]   pc 0x00007ff8144b0c7b fp 0x000070000ee31ff0 thread_start+0xf
[stderr] -- End of DumpStackTrace


## flutter doctor

[✓] Flutter (Channel stable, 3.3.9, on macOS 13.1 22C65 darwin-x64, locale de-DE)
    • Flutter version 3.3.9 on channel stable at /Users/USER/fvm/versions/3.3.9@stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (vor 7 Wochen), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0
    • Pub download mirror https://pub

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/USER/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • ANDROID_HOME = /Users/USER/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/USER/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
    • IntelliJ at /Users/USER/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 71.3.6
    • Dart plugin version 223.8214.16

[✓] VS Code (version 1.73.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.124

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

@rrousselGit
Copy link
Collaborator

Yeah that's an analyzer bug. It was fixed

In theory if you switch to the master channel, the crash will disappear

@marcotrumpet
Copy link

To me is crashing also when I clone the repo to add log.. the thing is why it's working for you with the same code 😨I even tested the 0.1.1 version but still the same

@rrousselGit
Copy link
Collaborator

You mean cloning custom_lint causes a crash too? eh

@marcotrumpet
Copy link

yep, cloning this whole repo and opening with vscode give me a crash.. double check this is not my mac problem by opening other repo (and closing every other one)..

@kuhnroyal
Copy link
Contributor

You mean cloning custom_lint causes a crash too? eh

The plugins for both example projects fail to start for me.
Running dart test fails with a lot of errors.

@rrousselGit
Copy link
Collaborator

What error?

@rrousselGit
Copy link
Collaborator

I've published version 0.1.2-dev in an attempt to fix this.
Give it a go and tell me if there's any improvement

Make sure to look at the custom_lint.log file to see if there's any error in it too.

@Biplab-Dutta
Copy link
Contributor

Shall give it a try tonight..

@kuhnroyal
Copy link
Contributor

It keeps crashing, there is no custom_lint.log being created.
I enabled the Analysis Server logging, these are the last statements before the crash:

1673351366963:PluginReq:{"id"::"0","method"::"plugin.versionCheck","params"::{"byteStorePath"::"/Users/USER/.dartServer/.analysis-driver","sdkPath"::"/Users/USER/fvm/versions/3.3.9@stable/bin/cache/dart-sdk","version"::"1.0.0-alpha.0"}}:file::///Users/USER/.dartServer/.plugin_manager/ac7608e312002641015034095a33ca07/analyzer_plugin/bin/plugin.dart::
1673351366993:PluginRes:{"id"::"0","requestTime"::1673351366969,"result"::{"isCompatible"::true,"name"::"custom_lint","version"::"1.0.0-alpha.0","contactInfo"::"https:://github.com/invertase/dart_custom_lint/issues","interestingFiles"::["*.dart"]}}:file::///Users/USER/.dartServer/.plugin_manager/ac7608e312002641015034095a33ca07/analyzer_plugin/bin/plugin.dart::

@rrousselGit
Copy link
Collaborator

There's nothing of value in those logs sadly

@kuhnroyal
Copy link
Contributor

This has something to do with the Flutter/Dart version. It works on the Flutter beta channel.

@rrousselGit
Copy link
Collaborator

Does it work on the master channel as I suggested before?

If so, a solution could be to bump the minimum Dart SDK constraint on custom_lint; making sure pub get fails if using a too low version

@kuhnroyal
Copy link
Contributor

This works:

[!] Flutter (Channel beta, 3.7.0-1.3.pre, on macOS 13.1 22C65 darwin-x64, locale de-DE)
    • Flutter version 3.7.0-1.3.pre on channel beta at /Users/USER/fvm/versions/3.7.0-1.3.pre@beta
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9b4416aaa7 (vor 6 Tagen), 2023-01-04 17:29:34 -0600
    • Engine revision 7b8906637f
    • Dart version 2.19.0 (build 2.19.0-444.3.beta)

@rrousselGit
Copy link
Collaborator

Thanks, but that's the beta channel. I'd like to know for master

@rrousselGit
Copy link
Collaborator

If it works for both beta+master, the issue could probably be closed.... right?
There's likely going to be a stable release soon with Flutter Forward

@kuhnroyal
Copy link
Contributor

Thanks, but that's the beta channel. I'd like to know for master

Upgrading Flutter, will check in a minute.

@kuhnroyal
Copy link
Contributor

Yea seems to work on master as well.

@rrousselGit
Copy link
Collaborator

I see. Then considering a stable release will probably be made in a few weeks, I'd be open to simply wait for this.

Unless someone else still has an issue?

@marcotrumpet
Copy link

Guys sorry, can't check for a bit. Thanks @rrousselGit for support and @kuhnroyal for help debugging this!

@jonaslundquist
Copy link

hey @rrousselGit! I still get this issue. I've tried 0.1.1 and 0.1.2-dev and I'm running Dart 2.18.6 with analyzer 5.4.0 and analyzer_plugin 0.11.2 - is the error expected?

../../runtime/vm/message_snapshot.cc: 576: error: expected: !lib.IsNull()
version=2.18.6 (stable) (Tue Dec 13 21:15:14 2022 +0000) on "macos_arm64"
pid=59341, thread=11015, isolate_group=main(0x12b867000), isolate=main(0x12b89ca00)
isolate_instructions=1049bd140, vm_instructions=1049bd140
  pc 0x0000000104bbca3c fp 0x0000000171686560 dart::Profiler::DumpStackTrace(void*)+0x68
  pc 0x00000001049bd2c4 fp 0x0000000171686580 dart::Assert::Fail(char const*, ...) const+0x28
  pc 0x0000000104b2e0a8 fp 0x0000000171686600 dart::ReadApiMessage(dart::Zone*, dart::Message*)+0x72f4
  pc 0x0000000104b25e08 fp 0x0000000171686680 dart::MessageDeserializer::Deserialize()+0x244
  pc 0x0000000104b26d40 fp 0x00000001716867f0 dart::ReadMessage(dart::Thread*, dart::Message*)+0x148
  pc 0x0000000104af9994 fp 0x0000000171686da0 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >)+0xcc
  pc 0x0000000104b21c64 fp 0x0000000171686e10 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x154
  pc 0x0000000104b223a0 fp 0x0000000171686e70 dart::MessageHandler::TaskCallback()+0x204
  pc 0x0000000104c410b4 fp 0x0000000171686f30 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x14c
  pc 0x0000000104c41494 fp 0x0000000171686f60 dart::ThreadPool::Worker::Main(unsigned long)+0x78
  pc 0x0000000104bb907c fp 0x0000000171686fc0 dart::OSThread::GetMaxStackSize()+0xac
  pc 0x000000019700906c fp 0x0000000171686fe0 _pthread_start+0x94
-- End of DumpStackTrace
Bad state: The analysis server crashed unexpectedly

@rrousselGit
Copy link
Collaborator

@jonaslundquist That's something fixed on newer versions of Dart

@rrousselGit
Copy link
Collaborator

Closing since a new Flutter/Dart stable version is available

ghost pushed a commit to solid-software/dart_custom_lint that referenced this issue Dec 5, 2023
* Bump version to `0.1.0`

* Pull changes from `solid-metrics` repository

* Update .gitignore

Co-authored-by: Yuri Prykhodko <40931732+solid-yuriiprykhodko@users.noreply.github.com>

* Update example/lib/solid_lints_example.dart

Co-authored-by: Yuri Prykhodko <40931732+solid-yuriiprykhodko@users.noreply.github.com>

* Update `CHANGELOG.md`

* Add code checks with GitHub Actions

* Add support for the number of parameters metric

* Remove DCM references

* Change lint message

* Simplify configuration and remove redundant code

* Fix code comments

* Add missing tests

* Add `lines_of_code` lint

* Fix rule name

* Add test and fix an edge case

* Update lint to match the specification

* Add `avoid_non_null_assertion` lint

* Add missing comment

* Add `avoid_late_keyword` lint

* Update problem message

* Add `avoid_global_state` lint

* Fix failing tests

* Add `avoid_returning_widgets` lint

* Use pattern-matching

* Simplify `isWidgetReturned`

* Update lib/lints/avoid_returning_widgets/avoid_returning_widgets_rule.dart

Co-authored-by: Yuri Prykhodko <40931732+solid-yuriiprykhodko@users.noreply.github.com>

* Cleanup of `getLintRules`

* Fix comment

* rename MetricRule -> RuleConfig

* add a sceleton for the double-literal-format rule

* implement the double-literal-format rule

* fix review warnings

* implement quick-fix for the double-literal-format rule

* fix lint warnings

* add avoid-unnecessary-type-assertions rule ('is' part)

* fix lint warning

* add avoid-unnecessary-type-assertions rule ('whereType' part)

* add quick-fix for unnecessary operator is

* add quick-fix for unnecessary whereType

* fix review warnings; fix a bug

* add utility class for type chekcking methods

* add constants for is and whereType names

* add needed comments

* rewrite _isUnnecessaryWhereType with pattern matching

* rewrite _areGenericsWithSameTypeArgs with pattern matching

* refactoring: move a castTypeInHierarchy to TypeCast class

* implement "avoid unnecessary setstate" rule (invertase#44)

* implement "avoid unnecessary setstate" rule

* fix pr comments

* added idea files to gitignore

* fix pr comments

* Fix merge conflict

* Fix tests and improve GitHub workflow

* Fix workflow file

* Fix conflicts after merge

* Remove non-existing import

* Add missing rule to tests and remove unnecessary GitHub actions step

---------

Co-authored-by: Yaroslav Laptiev <yaroslav.laptiev@wmg.com>
Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

* Add avoid_unnecessary_type_casts_rule

* Refactor types_utils, extract common methods

* Add fix for avoid_unnecessary_type_casts_rule

* Add AvoidUnnecessaryTypeCastsRule.createRule to solid_lints.dart

* Fix 'quickFix' for avoid-unnecessary-type-casts

* Add tests for avoid-unnecessary-type-casts

* Fix formatting

* Add more test cases

* Group code for more readability

* Switch to getters, refactor areGenericsWithSameTypeArgs

* Avoid unrelated type assertions (invertase#48)

* Add avoid-unrelated-type-assertions rule

* Add tests for avoid-unrelated-type-assertions rule

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Feature/newline before return (invertase#52)

* Add newline-before-return rule

* Fix typos, remove unnecessary negation

* Add tests for newline-before-return

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Fixes Issue invertase#54 multiple rule reporting (invertase#55)

* Fix newline-before-return

* Fix avoid-unrelated-type-assertions

* Fix avoid-unnecessary-type-casts

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Feature/no empty block (invertase#53)

* Add no-empty-block rule

* Add tests no-empty-block rule

* Add cyclomatic tests case, fix formatting

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Add no equal then else rule (invertase#56)

* Add no-equal-then-else rule

* Add tests for no-equal-then-else rule

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Feature/member ordering (invertase#51)

* Add required models for member-ordering rule

* Add member-ordering rule

* Add MIT License comments

* Fix parser type mismatch

* Add tests for member-ordering and enable rule

* Organize imports, ignore member-ordering in unrelated test

* Group *_member_group.dart into one directory

* Add more test cases

* Add more test cases

* Add alphabetize test cases

* Add tests for alphabetical-by-type option

* Ignore no-empty-block in test

* Ignore member-ordering in test

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Add avoid unused parameters rule (invertase#49)

* Add avoid-unused-parameters rule

* Add tests for avoid-unused-parameters rule

* Fix function name, remove null check operator and remove negation

* Fix multiple reporting

* Add more test cases

* Fix formatting

* Rename method

* Add constructors and factories unused params handling

* Fix constructors with named field parameters

* Simplify rule run method

* Fix tests

* Fix tests after merge

* Fix tests after merge

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Added no magic number rule (invertase#57)

* Add no-magic-number rule

* Add tests for no-magic-number rule

* Fix import lost in merge

* Ignore no-magic-number in test

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>

* Added prefer condtional expressions rule and fix (invertase#59)

* Add prefer-conditional-expressions rule and fix

* Add tests for prefer-conditional-expressions rule

* fix nested test plugin path

* Fix tests after merge

* Update lint_test/prefer_conditional_expressions_ignore_nested_test/prefer_conditional_expressions_ignore_nested_test.dart

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>
Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Added prefer first rule (invertase#60)

* Add prefer-conditional-expressions rule and fix

* Add tests for prefer-conditional-expressions rule

* fix nested test plugin path

* Fix tests after merge

* Add prefer-first rule and fix

* Add tests for prefer-first rule

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>
Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Add prefer last rule (invertase#61)

* Add prefer-conditional-expressions rule and fix

* Add tests for prefer-conditional-expressions rule

* fix nested test plugin path

* Fix tests after merge

* Add prefer-first rule and fix

* Add tests for prefer-first rule

* Add prefer-last rule & fix

* Add tests for prefer-last rule

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>
Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Add prefer match file name (invertase#62)

* Add prefer-conditional-expressions rule and fix

* Add tests for prefer-conditional-expressions rule

* fix nested test plugin path

* Fix tests after merge

* Add prefer-first rule and fix

* Add tests for prefer-first rule

* Add prefer-last rule & fix

* Add tests for prefer-last rule

* Add prefer-match-file-name rule

* Add tests for prefer-match-file-name rule

* Typos, naming

* Typos, naming

* rm todo comment

* Update lint_test/prefer_match_file_name_test.dart

* Update lint_test/prefer_match_file_name_test.dart

---------

Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>
Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>
Co-authored-by: Yurii Prykhodko <yurii.prykhodko@solid.software>

* Rename custom lints to use snake_case (invertase#66)

* Rename custom lints to use snake_case

* Rename missed parameter

---------

Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

* Take into account the constructor initializer in the avoid_unused_parameters rule (invertase#67)

Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

* Fix linter issues

* Bump custom_lint_builder version

* Update LICENSE to include third party code license

* Allow magic numbers for default values (invertase#72)

* Allow magic numbers for default values

* More tests

---------

Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

* Ignore magic number in constructor initializer (invertase#73)

* Ignore magic number in constructor initializer

* Minor naming improvement

---------

Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

* Remove DCM steps from readme

* Fix avoid-late if initialized (invertase#71)

* Implement proper-super-calls (invertase#77)

* Fix avoid-late if initialized

* Update lint_test/avoid_late_keyword_test.dart

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Custom avoid-late

* Fix naming

* Apply suggestions from code review

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Avoid late simplified

* Update lib/lints/avoid_late_keyword/models/avoid_late_keyword_parameters.dart

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Avoid-late ignored_types

* Avoid-late ignored_types formatted

* Update lib/lints/avoid_late_keyword/models/avoid_late_keyword_parameters.dart

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Avoid-late ignored_types fix

* Avoid-late ignored_types Fix

* Avoid-late allow_initialized testcases

* Update lint_test/avoid_late_keyword_allow_initialized_test/pubspec.yaml

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Update lib/lints/avoid_late_keyword/models/avoid_late_keyword_parameters.dart

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Allow subclasses for avoid-late whitelist

* Fix naming

* Short-circuit of there's no ignored types

* Short-circuit earlier

* Update lib/lints/avoid_late_keyword/avoid_late_keyword_rule.dart

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Avoid-late ignored_types tests

* Avoid-late add testcases

* Proper-super-calls impl

* Proper-super-calls format

* Apply suggestions from code review

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Proper-super-calls refactoring

* Update lib/lints/proper_super_calls/proper_super_calls_rule.dart

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>

* Proper-super-keyword annotation check

* Proper-super-keyword format

* Proper-super-calls cleanup

---------

Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>
Co-authored-by: Yurii Prykhodko <yurii.prykhodko@solid.software>

* Ignore magic numbers in widget parameters (invertase#74)

* Ignore magic numbers in widget parameters

* Add lint parameter to ignore magic numbers in widget params

* Improve the allowed_in_widget_params parameter to exclude magic numbers in nested objects of Widget parameters

* Add tests for disabled allowed_in_widget_params lint parameter

* Remove unnecessary dependency

---------

Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

* Set default severity level to warning (invertase#78)

Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>

---------

Co-authored-by: Nikodem Bernat <n.bernat@outlook.com>
Co-authored-by: Vadym Khokhlov <xvadima@ukr.net>
Co-authored-by: Yaroslav <43727448+laptevw@users.noreply.github.com>
Co-authored-by: Yaroslav Laptiev <yaroslav.laptiev@wmg.com>
Co-authored-by: vladimir-beloded <x-volodymyr.beloded@transcarent.com>
Co-authored-by: Denis Bogatirov <denis.bohatyrov@computools.com>
Co-authored-by: DenisBogatirov <denis.bogatirov@gmail.com>
Co-authored-by: Yurii Prykhodko <144313329+yurii-prykhodko-solid@users.noreply.github.com>
Co-authored-by: solid-vovabeloded <41615621+solid-vovabeloded@users.noreply.github.com>
Co-authored-by: Illia Romanenko <442086+illia-romanenko@users.noreply.github.com>
Co-authored-by: maxxlab <42914015+maxxlab@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants