updated lint cmd descriptions

This commit is contained in:
Paul Gauthier 2024-05-20 09:01:22 -07:00
parent ee516e3958
commit 57a2c61386
3 changed files with 5 additions and 8 deletions

View file

@ -313,7 +313,7 @@ def get_parser(default_config_files, git_root):
group.add_argument( group.add_argument(
"--lint", "--lint",
action="store_true", action="store_true",
help="Run the linter on all dirty files, fix problems and commit", help="Lint and fix provided files, or dirty files if none provided",
default=False, default=False,
) )
group.add_argument( group.add_argument(

View file

@ -154,14 +154,14 @@ class Commands:
self.coder.repo.commit(message=commit_message) self.coder.repo.commit(message=commit_message)
def cmd_lint(self, args="", fnames=None): def cmd_lint(self, args="", fnames=None):
"Commit, run the linter on all dirty files, fix problems and commit again" "Lint and fix provided files or in-chat files if none provided"
if not self.coder.repo: if not self.coder.repo:
self.io.tool_error("No git repository found.") self.io.tool_error("No git repository found.")
return return
if not fnames: if not fnames:
fnames = self.coder.repo.get_dirty_files() fnames = self.coder.get_inchat_relative_files()
if not fnames: if not fnames:
self.io.tool_error("No dirty files to lint.") self.io.tool_error("No dirty files to lint.")
@ -170,7 +170,7 @@ class Commands:
lint_coder = None lint_coder = None
for fname in fnames: for fname in fnames:
try: try:
errors = self.coder.linter.lint(fname, cmd=args) errors = self.coder.linter.lint(fname)
except FileNotFoundError as err: except FileNotFoundError as err:
self.io.tool_error(f"Unable to lint {fname}") self.io.tool_error(f"Unable to lint {fname}")
self.io.tool_error(str(err)) self.io.tool_error(str(err))

View file

@ -1,9 +1,9 @@
import os import os
import re
import subprocess import subprocess
import sys import sys
import traceback import traceback
import warnings import warnings
import re
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
@ -205,9 +205,6 @@ def traverse_tree(node):
return errors return errors
import re
def find_filenames_and_linenums(text, fnames): def find_filenames_and_linenums(text, fnames):
""" """
Search text for all occurrences of <filename>:\\d+ and make a list of them Search text for all occurrences of <filename>:\\d+ and make a list of them