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

Add Ruby linter with Steep #4671

Merged
merged 19 commits into from
Jun 25, 2024

Conversation

lloeki
Copy link
Contributor

@lloeki lloeki commented Dec 6, 2023

Continuation of #4376

Fixes #3254

Where are the tests? Have you added tests? Have you updated the tests? Read the
comment above and the documentation referenced in it first. Write tests!

Seriously, read :help ale-dev and write tests.

Working on it (trying to run the test docker thingy).

Added tests (inspired by Rubocop ones)

endfunction

" Handle output from steep
function! ale_linters#ruby#steep#HandleOutput(buffer, lines) abort
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a complex handler function. Add a test for this too. There's a directory for testing functions for handling results.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should finally be able to get back to complete this within a few weeks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a few weeks" heh. On it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@w0rp I have rebased and added the handler test.

Copy link

stale bot commented Apr 22, 2024

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests.
If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.

@stale stale bot added the stale PRs/Issues no longer valid label Apr 22, 2024
@lloeki lloeki force-pushed the feature/ruby-steep-linter branch from 5e84dea to b220b41 Compare May 27, 2024 07:35
@stale stale bot removed the stale PRs/Issues no longer valid label May 27, 2024
@lloeki
Copy link
Contributor Author

lloeki commented May 27, 2024

Hmm, test failure on Appveyor because of Windows paths:

[00:02:18]   Starting Vader: C:\testplugin\test\linter\test_ruby_steep.vader
[00:02:18]     (1/3) [EXECUTE] Executable should default to steep
[00:02:18]     (1/3) [EXECUTE] (X) ['steep', 'steep check  ''C:\testplugin\test\linter\dummy.rb'''] should be equal to ['steep', 'steep check  ''testplugin/test/linter/dummy.rb''']
[00:02:18]     (2/3) [EXECUTE] Should be able to set a custom executable
[00:02:18]     (2/3) [EXECUTE] (X) ['bin/steep', 'bin/steep check  ''C:\testplugin\test\linter\dummy.rb'''] should be equal to ['bin/steep', 'bin/steep check  ''testplugin/test/linter/dummy.rb''']
[00:02:18]     (3/3) [EXECUTE] Setting bundle appends 'exec steep'
[00:02:18]     (3/3) [EXECUTE] (X) ['path to/bundle', '"path to/bundle" exec steep check  ''C:\testplugin\test\linter\dummy.rb'''] should be equal to ['path to/bundle', '"path to/bundle" exec steep check  ''testplugin/test/linter/dummy.rb''']
[00:02:18]   Success/Total: 0/3

@lloeki
Copy link
Contributor Author

lloeki commented May 27, 2024

Noticed the separator was off for Windows, which would break the replacement and made a fix, but it insists on having C: in front still :(

[00:02:28]   Starting Vader: C:\testplugin\test\linter\test_ruby_steep.vader
[00:02:28]     (1/3) [EXECUTE] Executable should default to steep
[00:02:28]     (1/3) [EXECUTE] (X) ['steep', 'steep check  ''C:testplugin\test\linter\dummy.rb'''] should be equal to ['steep', 'steep check  ''testplugin/test/linter/dummy.rb''']
[00:02:28]     (2/3) [EXECUTE] Should be able to set a custom executable
[00:02:28]     (2/3) [EXECUTE] (X) ['bin/steep', 'bin/steep check  ''C:testplugin\test\linter\dummy.rb'''] should be equal to ['bin/steep', 'bin/steep check  ''testplugin/test/linter/dummy.rb''']
[00:02:28]     (3/3) [EXECUTE] Setting bundle appends 'exec steep'
[00:02:28]     (3/3) [EXECUTE] (X) ['path to/bundle', '"path to/bundle" exec steep check  ''C:testplugin\test\linter\dummy.rb'''] should be equal to ['path to/bundle', '"path to/bundle" exec steep check  ''testplugin/test/linter/dummy.rb''']
[00:02:28]   Success/Total: 0/3

Really tough to efficiently debug this as I don't have a Windows setup at hand.

@lloeki
Copy link
Contributor Author

lloeki commented May 29, 2024

@w0rp there were a few corner-case bugs but it's all fixed and test-covered now. WDYT, good to merge?

@lloeki lloeki requested a review from w0rp May 29, 2024 19:25
@lloeki
Copy link
Contributor Author

lloeki commented Jun 10, 2024

Hmm, missed that one locally, will fix:

========================================
Running Vint to lint our code
========================================
Vint warnings/errors follow:

ale_linters/ruby/steep.vim:26:21: Use robust operators `==#` or `==?` instead of `==` (see Google VimScript Style Guide (Matching))
ale_linters/ruby/steep.vim:64:19: Use robust operators `==#` or `==?` instead of `==` (see Google VimScript Style Guide (Matching))

Huh what? Not even whitespace appear to differ.

========================================
diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables
========================================
Differences follow:

--- /tmp/readme.XXMCAcHf
+++ /tmp/doc.XXoaBcKg
@@ -445 +444,0 @@
-Ruby - steep
@@ -446,0 +446 @@
+Ruby - steep

EDIT: from raw logs:

$ cat | od -xa
-Ruby - steep
^D
0000000      522d    6275    2079    202d    7473    6565    0a70        
           -   R   u   b   y  sp   -  sp   s   t   e   e   p  nl        
0000016
$ cat | od -xa
+Ruby - steep
^D
0000000      522b    6275    2079    202d    7473    6565    0a70        
           +   R   u   b   y  sp   -  sp   s   t   e   e   p  nl        
0000016

@hsanson
Copy link
Contributor

hsanson commented Jun 17, 2024

Difference here is the sorting order. In supported-tools.md steep is listed below sorbet while in ale-supported-languages-and-tools.txt is listed below standardrb. Make sure is in same exact order on both files.

========================================
diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables
========================================
Differences follow:

--- /tmp/readme.XXMCAcHf
+++ /tmp/doc.XXoaBcKg
@@ -445 +444,0 @@
-Ruby - steep
@@ -446,0 +446 @@
+Ruby - steep

@lloeki
Copy link
Contributor Author

lloeki commented Jun 21, 2024

Oh my, thanks @hsanson!

Just pushed fixes for the remaining bits. Let's see if CI is green now.

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and patience.

@hsanson hsanson removed the request for review from w0rp June 25, 2024 08:17
@hsanson hsanson merged commit e09520e into dense-analysis:master Jun 25, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

Add support for Steep (Ruby)
3 participants