Skip to content

Commit b0f7449

Browse files
authored
Changes for supporting lint in MLC (#161)
* Changes for supporting lint in mlc * increment version to 1.1.0
1 parent ce4dd0c commit b0f7449

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.8
1+
1.1.0

mlc/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def main():
152152
action_parser.add_argument('extra', nargs=argparse.REMAINDER, help='Extra options (e.g., -v)')
153153

154154
# Script specific subcommands
155-
for action in ['docker', 'experiment', 'doc']:
155+
for action in ['docker', 'experiment', 'doc', 'lint']:
156156
action_parser = subparsers.add_parser(action, help=f'{action.capitalize()} a target.')
157157
action_parser.add_argument('target', choices=['script', 'run'], help='Target type (script).')
158158
# the argument given after target and before any extra options like --tags will be stored in "details"
@@ -247,7 +247,7 @@ def main():
247247
if args.target == "repo":
248248
run_args['repo'] = args.details
249249

250-
if args.command in ['docker', 'experiment', 'doc']:
250+
if args.command in ['docker', 'experiment', 'doc', 'lint']:
251251
if args.target == "run":
252252
run_args['target'] = 'script' #allowing run to be used for docker run instead of docker script
253253
args.target = "script"

mlc/script_action.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ def call_script_module_function(self, function_name, run_args):
236236
result = automation_instance.experiment(run_args) # Pass args to the experiment method
237237
elif function_name == "doc":
238238
result = automation_instance.doc(run_args) # Pass args to the doc method
239+
elif function_name == "lint":
240+
result = automation_instance.lint(run_args) # Pass args to the lint method
239241
else:
240242
return {'return': 1, 'error': f'Function {function_name} is not supported'}
241243

@@ -342,6 +344,22 @@ def doc(self, run_args):
342344
"""
343345
return self.call_script_module_function("doc", run_args)
344346

347+
def lint(self, run_args):
348+
"""
349+
####################################################################################################################
350+
Target: Script
351+
Action: lint
352+
####################################################################################################################
353+
354+
The `lint` action automatically formats the contents in `meta.yaml`.
355+
356+
Example Command:
357+
358+
mlc lint script --tags=detect,os
359+
360+
"""
361+
return self.call_script_module_function("lint", run_args)
362+
345363

346364
def help(self, run_args):
347365
# Internal function to call the help function in script automation module.py

0 commit comments

Comments
 (0)