File tree 3 files changed +26
-2
lines changed
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|
505
505
end
506
506
```
507
507
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
+
508
518
#### ` plugins `
509
519
510
520
If 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
35
35
# Defaults to [].
36
36
attr_accessor :plugins
37
37
38
+ # Max line length.
39
+ # Defaults to 80.
40
+ attr_accessor :print_width
41
+
38
42
def initialize (
39
43
name = :"stree:check" ,
40
44
source_files = ::Rake ::FileList [ "lib/**/*.rb" ] ,
41
- plugins = [ ]
45
+ plugins = [ ] ,
46
+ print_width = DEFAULT_PRINT_WIDTH
42
47
)
43
48
@name = name
44
49
@source_files = source_files
45
50
@plugins = plugins
51
+ @print_width = print_width
46
52
47
53
yield self if block_given?
48
54
define_task
@@ -58,6 +64,7 @@ def define_task
58
64
def run_task
59
65
arguments = [ "check" ]
60
66
arguments << "--plugins=#{ plugins . join ( "," ) } " if plugins . any?
67
+ arguments << "--print-width=#{ print_width } " if print_width != DEFAULT_PRINT_WIDTH
61
68
62
69
SyntaxTree ::CLI . run ( arguments + Array ( source_files ) )
63
70
end
Original file line number Diff line number Diff line change @@ -35,14 +35,20 @@ class WriteTask < ::Rake::TaskLib
35
35
# Defaults to [].
36
36
attr_accessor :plugins
37
37
38
+ # Max line length.
39
+ # Defaults to 80.
40
+ attr_accessor :print_width
41
+
38
42
def initialize (
39
43
name = :"stree:write" ,
40
44
source_files = ::Rake ::FileList [ "lib/**/*.rb" ] ,
41
- plugins = [ ]
45
+ plugins = [ ] ,
46
+ print_width = DEFAULT_PRINT_WIDTH
42
47
)
43
48
@name = name
44
49
@source_files = source_files
45
50
@plugins = plugins
51
+ @print_width = print_width
46
52
47
53
yield self if block_given?
48
54
define_task
@@ -58,6 +64,7 @@ def define_task
58
64
def run_task
59
65
arguments = [ "write" ]
60
66
arguments << "--plugins=#{ plugins . join ( "," ) } " if plugins . any?
67
+ arguments << "--print-width=#{ print_width } " if print_width != DEFAULT_PRINT_WIDTH
61
68
62
69
SyntaxTree ::CLI . run ( arguments + Array ( source_files ) )
63
70
end
You can’t perform that action at this time.
0 commit comments