File tree Expand file tree Collapse file tree 2 files changed +25
-15
lines changed Expand file tree Collapse file tree 2 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 135135 default = true ;
136136 } ;
137137
138- priority = mkOption {
139- type = types . number ;
140- description = ''
141- Defines the priority order in which hooks are executed.
142- Lower the number, the higher the precedence.
143- '' ;
144- default = 0 ;
145- } ;
146-
147138 fail_fast = mkOption {
148139 type = types . bool ;
149140 description = ''
193184 '' ;
194185 default = [ ] ;
195186 } ;
187+
188+ before = mkOption {
189+ type = types . listOf types . str ;
190+ description =
191+ ''
192+ List of hooks that should run after this hook.
193+ '' ;
194+ default = [ ] ;
195+ } ;
196+
197+ after = mkOption {
198+ type = types . listOf types . str ;
199+ description =
200+ ''
201+ List of hooks that should run before this hook.
202+ '' ;
203+ default = [ ] ;
204+ } ;
205+
196206 } ;
197207
198208 config = {
199209 raw =
200210 {
201- inherit ( config ) name entry language files types types_or exclude_types pass_filenames priority fail_fast require_serial stages verbose always_run args ;
211+ inherit ( config ) name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args before after ;
202212 id = config . name ;
203213 exclude = mergeExcludes config . excludes ;
204214 } ;
Original file line number Diff line number Diff line change 3131 enabledExtraPackages = builtins . concatLists ( mapAttrsToList ( _ : value : value . extraPackages ) enabledHooks ) ;
3232 processedHooks =
3333 let
34- # Sort the list of hooks by priority (lower number = higher priority)
35- sortedHooks = builtins . sort
36- ( a : b : a . priority < b . priority )
34+ sortedHooks = lib . toposort
35+ ( a : b : builtins . elem b . id a . before || builtins . elem a . id b . after )
3736 ( mapAttrsToList
3837 ( id : value :
3938 value . raw // {
4039 inherit id ;
41- priority = value . raw . priority ;
40+ before = value . raw . before ;
41+ after = value . raw . after ;
4242 }
4343 )
4444 enabledHooks
4545 ) ;
4646 in
47- sortedHooks ;
47+ sortedHooks . result ;
4848
4949 configFile =
5050 performAssertions (
You can’t perform that action at this time.
0 commit comments