File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,16 @@ SyntaxTree::Rake::WriteTask.new do |t|
505505end
506506```
507507
508+ #### ` print_width `
509+
510+ If you want to use a different print width from the default (80), you can pass that to the ` print_width ` field, as in:
511+
512+ ``` ruby
513+ SyntaxTree ::Rake ::WriteTask .new do |t |
514+ t.print_width = 100
515+ end
516+ ```
517+
508518#### ` plugins `
509519
510520If you're running Syntax Tree with plugins (either your own or the pre-built ones), you can pass that to the ` plugins ` field, as in:
Original file line number Diff line number Diff line change @@ -35,14 +35,20 @@ class CheckTask < ::Rake::TaskLib
3535 # Defaults to [].
3636 attr_accessor :plugins
3737
38+ # Max line length.
39+ # Defaults to 80.
40+ attr_accessor :print_width
41+
3842 def initialize (
3943 name = :"stree:check" ,
4044 source_files = ::Rake ::FileList [ "lib/**/*.rb" ] ,
41- plugins = [ ]
45+ plugins = [ ] ,
46+ print_width = DEFAULT_PRINT_WIDTH
4247 )
4348 @name = name
4449 @source_files = source_files
4550 @plugins = plugins
51+ @print_width = print_width
4652
4753 yield self if block_given?
4854 define_task
@@ -58,6 +64,7 @@ def define_task
5864 def run_task
5965 arguments = [ "check" ]
6066 arguments << "--plugins=#{ plugins . join ( "," ) } " if plugins . any?
67+ arguments << "--print-width=#{ print_width } " if print_width != DEFAULT_PRINT_WIDTH
6168
6269 SyntaxTree ::CLI . run ( arguments + Array ( source_files ) )
6370 end
Original file line number Diff line number Diff line change @@ -35,14 +35,20 @@ class WriteTask < ::Rake::TaskLib
3535 # Defaults to [].
3636 attr_accessor :plugins
3737
38+ # Max line length.
39+ # Defaults to 80.
40+ attr_accessor :print_width
41+
3842 def initialize (
3943 name = :"stree:write" ,
4044 source_files = ::Rake ::FileList [ "lib/**/*.rb" ] ,
41- plugins = [ ]
45+ plugins = [ ] ,
46+ print_width = DEFAULT_PRINT_WIDTH
4247 )
4348 @name = name
4449 @source_files = source_files
4550 @plugins = plugins
51+ @print_width = print_width
4652
4753 yield self if block_given?
4854 define_task
@@ -58,6 +64,7 @@ def define_task
5864 def run_task
5965 arguments = [ "write" ]
6066 arguments << "--plugins=#{ plugins . join ( "," ) } " if plugins . any?
67+ arguments << "--print-width=#{ print_width } " if print_width != DEFAULT_PRINT_WIDTH
6168
6269 SyntaxTree ::CLI . run ( arguments + Array ( source_files ) )
6370 end
You can’t perform that action at this time.
0 commit comments