mataku / danger-ktlint Goto Github PK
View Code? Open in Web Editor NEWA Danger Plugin to lint kotlin files using ktlint command line interface.
License: MIT License
A Danger Plugin to lint kotlin files using ktlint command line interface.
License: MIT License
We updated ktlint
to latest version (0.50.0) recently, and Danger-ktlint started failing with a parsing error
!] Invalid Dangerfile file: unexpected token at 07:59:55.010 [main] WARN com.pinterest.ktlint.cli.internal.KtlintCommandLine - Lint has found errors than can be autocorrected using ktlint --format
...
Turns out, ktlint
logs output are on stdout
and are enabled with info
by default.
They might have added a new log recently, but logs should be set to none
as danger-ktlint
is expecting json output
Hi,
I think there's another issue that alludes to this issue but doesn't provide much context. When running with inline_mode: false the ktlint plugin fails as it appears to reference a github api here.
Output from danger:
Did you mean? gitlab
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/plugin_support/plugin.rb:24:in `method_missing'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:70:in `block (3 levels) in send_markdown_comment'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:66:in `each'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:66:in `block (2 levels) in send_markdown_comment'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:65:in `each'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:65:in `block in send_markdown_comment'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:63:in `catch'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:63:in `send_markdown_comment'
from /usr/local/bundle/gems/danger-ktlint-0.0.5/lib/ktlint/plugin.rb:42:in `lint'
from Dangerfile:4:in `eval_file'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/dangerfile.rb:311:in `eval'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/dangerfile.rb:311:in `eval_file'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/dangerfile.rb:204:in `block in parse'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/dangerfile.rb:201:in `instance_eval'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/dangerfile.rb:201:in `parse'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/dangerfile.rb:287:in `run'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/danger_core/executor.rb:29:in `run'
from /usr/local/bundle/gems/danger-8.4.2/lib/danger/commands/runner.rb:73:in `run'
from /usr/local/bundle/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
from /usr/local/bundle/gems/danger-8.4.2/bin/danger:5:in `<top (required)>'
from /usr/local/bundle/bin/danger:25:in `load'
from /usr/local/bundle/bin/danger:25:in `<main>'
Happy to help debug or provide more info
Thanks
Hi
We use in our team danger in our android development, and wants to include ktlint in our danger file, but we already run ktlint before parse danger so it run twice, could be possible to configure it like https://github.com/loadsmart/danger-android_lint to only parse previously generated output file and skip the ktlint task?
Hello,
We have multiple modules in our android app and we're using ktlint-gradle. It creates multiple output files for each subproject in their build directory. You can change output directory but you can't aggregate generated reports.
We want to use this danger plugin and with ktlint-gradle plugin but as far as i see, it's not possible use multiple report files. Is it possible to add a feature that gives support for multiple output files that matches with given regex?
Hello,
We use Ruby 3.2 and danger-ktlint failed.
plugin.rb:180:in `ktlint_result_files': undefined method `exists?' for File:Class (NoMethodError)
if !report_file.nil? && !report_file.empty? && File.exists?(report_file)
^^^^^^^^
Ruby3.2 obsoletes File.exists
.
Ruby 3.2.0 Released
Here, we're doing .join(' ')
with single quotes, but it's missing the single quotes on the edges to ensure that the first and last arguments have start and end single quotes. It should look like this:
results = JSON.parse(`ktlint '#{targets.join(' ')}' --reporter=json --relative`
Is it possible to specify the limit of errors that are printed in the comments for the Bitbucket server?
I see the option available but I get the error below.
[!] Invalid Dangerfile
file: undefined method `limit=' for #Danger::Dangerfile:0x00007fe2e8060040\e[0m
from Dangerfile:66
ktlint.limit = 10 -> here.
ktlint.lint
Is there a better way of specifying options?
is it just for github? or i can use it for gitlab too?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.