@@ -50,6 +50,12 @@ protected function configure()
50
50
'Run as if this was started in <working-dir> instead of the current working directory ' ,
51
51
getcwd ()
52
52
),
53
+ new InputOption (
54
+ 'fix ' ,
55
+ 'f ' ,
56
+ InputOption::VALUE_NONE ,
57
+ 'Automatically fix all the fixable violations '
58
+ )
53
59
])
54
60
->addArgument (
55
61
'paths ' ,
@@ -69,10 +75,11 @@ protected function configure()
69
75
*/
70
76
protected function execute (InputInterface $ input , OutputInterface $ output )
71
77
{
72
- $ paths = $ input ->getArgument ('paths ' );
73
- $ exclude = $ input ->getOption ('exclude ' );
74
- $ level = $ input ->getOption ('level ' );
78
+ $ paths = $ input ->getArgument ('paths ' );
79
+ $ exclude = $ input ->getOption ('exclude ' );
80
+ $ level = $ input ->getOption ('level ' );
75
81
$ currentDir = $ input ->getOption ('working-dir ' );
82
+ $ fix = $ input ->getOption ('fix ' );
76
83
77
84
$ config = new Config ([
78
85
'paths ' => $ paths ,
@@ -87,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
87
94
// Execute the linter.
88
95
$ twig = new StubbedEnvironment ();
89
96
$ linter = new Linter ($ twig , new Tokenizer ($ twig ));
90
- $ report = $ linter ->run ($ config ->findFiles (), $ ruleset );
97
+ $ report = $ linter ->run ($ config ->findFiles (), $ ruleset, $ fix );
91
98
92
99
// Format the output.
93
100
$ reporter = new TextFormatter ($ input , $ output );
0 commit comments