Commit graph

4254 commits

Author SHA1 Message Date
Paul Gauthier
899fc88a14 Merge branch 'main' into swe-bench 2024-05-22 15:01:03 -07:00
Paul Gauthier
d94da4f809 draft posts 2024-05-22 14:34:12 -07:00
Paul Gauthier
81ec0515bb copy 2024-05-22 12:24:34 -07:00
Paul Gauthier
2374a2166f set version to 0.36.1-dev 2024-05-22 12:16:33 -07:00
Paul Gauthier
8868caf2b1 version bump to 0.36.0 2024-05-22 12:15:53 -07:00
Paul Gauthier
13ada38ecc copy 2024-05-22 12:15:40 -07:00
Paul Gauthier
589f1d510e copy 2024-05-22 12:12:30 -07:00
Paul Gauthier
c74c297aa2 copy 2024-05-22 12:09:35 -07:00
Paul Gauthier
29e92b2398 Updated HISTORY, added linting image 2024-05-22 12:08:50 -07:00
Paul Gauthier
210679f020 Use the test_cmd by default 2024-05-22 12:05:29 -07:00
Paul Gauthier
61ac9b7991 HISTORY 2024-05-22 11:55:14 -07:00
Paul Gauthier
47810310c9 Added linting article 2024-05-22 11:55:10 -07:00
Paul Gauthier
56f5e7e10c expand repomap even in smaller context windows 2024-05-21 11:04:18 -07:00
Paul Gauthier
27948cafa6 linter should display rel fname 2024-05-20 16:18:01 -07:00
Paul Gauthier
61165164d8 Run flake8 --isolated 2024-05-20 12:38:41 -07:00
Paul Gauthier
1effd73e80 Only expand the repomap if we know it will fit into context window 2024-05-20 10:22:57 -07:00
Paul Gauthier
449cbf507f Allow test_cmd to be a callable 2024-05-20 10:22:31 -07:00
Paul Gauthier
fa0aa60c97 Merge branch 'main' into swe-bench 2024-05-20 09:39:29 -07:00
Paul Gauthier
5032ce1a95 bump deps for +grep-ast==0.3.2 2024-05-20 09:19:02 -07:00
Paul Gauthier
57a2c61386 updated lint cmd descriptions 2024-05-20 09:01:22 -07:00
Paul Gauthier
ee516e3958 Added import statement for regular expressions in linter module. 2024-05-20 08:56:42 -07:00
Paul Gauthier
ce5dabd5f1 Removed unused import statement for 're' module. 2024-05-20 08:56:30 -07:00
Paul Gauthier
a115e594c0 Add import statement for 're' module and fix regex pattern in linter.py. 2024-05-20 08:56:21 -07:00
Paul Gauthier
9c28bbc98e Refactored linting process and error handling in commands. 2024-05-20 08:55:49 -07:00
Paul Gauthier
e758b01fb6 Merge branch 'main' into swe-bench 2024-05-19 15:20:46 -07:00
Paul Gauthier
deb13c060c copy 2024-05-19 15:14:22 -07:00
Paul Gauthier
04539feccb bump deps to get grep-ast 0.3.1 2024-05-19 15:10:57 -07:00
Paul Gauthier
5745657991 ask to fix lint/test 2024-05-19 15:02:16 -07:00
Paul Gauthier
038806f694 max_reflex=3, auto fix lint/test 2024-05-19 14:24:06 -07:00
Paul Gauthier
642be2a8f0 S/R uniq prompt 2024-05-19 14:22:29 -07:00
Paul Gauthier
ca18220b77 num_with_malformed_responses 2024-05-19 14:19:06 -07:00
Paul Gauthier
5641483a3b S/R will replace all matches 2024-05-19 10:31:36 -07:00
Paul Gauthier
ec7af731e0 confirm auto lint and test 2024-05-19 10:26:06 -07:00
Paul Gauthier
cb6e7cabb6 Added lint/test_outcome 2024-05-19 08:13:20 -07:00
Paul Gauthier
41c678da09 +litellm.suppress_debug_info 2024-05-19 07:56:13 -07:00
Paul Gauthier
0b18f3b4ef Add check to skip setting up lint commands if none are provided. 2024-05-19 07:42:39 -07:00
Paul Gauthier
afd827b9d9 aider: Fixed f-string error and added missing blank line before the main function.
# Aider chat conversation:

USER: # Fix any errors below, if possible.

## Running: flake8 aider/main.py

aider/main.py:195:27: F541 f-string is missing placeholders
aider/main.py:202:1: E302 expected 2 blank lines, found 1

## See relevant lines below marked with █.

aider/main.py:
...⋮...
180│def parse_lint_cmds(lint_cmds, io):
181│    err = False
182│    res = dict()
183│    for lint_cmd in lint_cmds:
184│        pieces = lint_cmd.split(":")
...⋮...
191│        if lang and cmd:
192│            res[lang] = cmd
193│        else:
194│            io.tool_error(f'Unable to parse --lint-cmd "{lint_cmd}"')
195█            io.tool_error(f'The arg should be "language: cmd --args ..."')
196│            io.tool_error('For example: --lint-cmd "python: flake8 --select=E9"')
197│            err = True
198│    if err:
199│        return
200│    return res
201│
202█def main(argv=None, input=None, output=None, force_git_root=None, return_coder=False):
203│    if argv is None:
204│        argv = sys.argv[1:]
205│
...⋮...

ASSISTANT: Here are the necessary changes to fix the flake8 errors:

1. Correct the f-string to not use placeholders when not needed.
2. Add the missing blank line before the `main` function.

aider/main.py
```python
<<<<<<< SEARCH
            io.tool_error(f'The arg should be "language: cmd --args ..."')
=======
            io.tool_error('The arg should be "language: cmd --args ..."')
>>>>>>> REPLACE
```

aider/main.py
```python
<<<<<<< SEARCH
    return res
=======
    return res

>>>>>>> REPLACE
```
2024-05-19 07:40:54 -07:00
Paul Gauthier
25e44f584b aider: Fixed extra blank lines and added missing whitespace after a comma.
# Aider chat conversation:

USER: # Fix any errors below, if possible.

## Running: flake8 aider/coders/base_coder.py

aider/coders/base_coder.py:43:1: E303 too many blank lines (3)
aider/coders/base_coder.py:334:17: E231 missing whitespace after ','

## See relevant lines below marked with █.

aider/coders/base_coder.py:
...⋮...
 40│
 41│
 42│
 43█def wrap_fence(name):
 44│    return f"<{name}>", f"</{name}>"
 45│
 46│
 47│class Coder:
 48│    abs_fnames = None
...⋮...
331│                self.io.tool_output(json.dumps(self.functions, indent=4))
332│
333│    def setup_lint_cmds(self, lint_cmds):
334█        for lang,cmd in lint_cmds.items():
335│            self.linter.set_linter(lang, cmd)
336│
337│    def show_announcements(self):
...⋮...

ASSISTANT: Here are the necessary changes to fix the flake8 errors:

1. Remove the extra blank lines before the `wrap_fence` function.
2. Add a missing whitespace after the comma in the `setup_lint_cmds` function.

aider/coders/base_coder.py
```python
<<<<<<< SEARCH
class ExhaustedContextWindow(Exception):
    pass

def wrap_fence(name):
=======
class ExhaustedContextWindow(Exception):
    pass

def wrap_fence(name):
>>>>>>> REPLACE
```

aider/coders/base_coder.py
```python
<<<<<<< SEARCH
        for lang,cmd in lint_cmds.items():
=======
        for lang, cmd in lint_cmds.items():
>>>>>>> REPLACE
```
2024-05-19 07:40:48 -07:00
Paul Gauthier
9bd78d7ff3 Refactored lint command parsing and setup logic. 2024-05-19 07:40:41 -07:00
Paul Gauthier
990dda1122 Added empty lines for better readability. 2024-05-19 07:35:27 -07:00
Paul Gauthier
9ee332f5d9 Added options for automatic linting and testing after changes. 2024-05-19 07:34:19 -07:00
Paul Gauthier
398a1300dc aider: Added --auto-lint/--no-auto-lint switch to the parser in aider/args.py.
# Aider chat conversation:

USER: add a --auto-lint/--no-auto-lint switch

ASSISTANT: To add the `--auto-lint/--no-auto-lint` switch, we need to:

1. Add the new argument to the parser in `aider/args.py`.

Here is the *SEARCH/REPLACE* block:

aider/args.py
```python
<<<<<<< SEARCH
    )
=======
    )
    group.add_argument(
        "--auto-lint",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable automatic linting after changes (default: True)",
    )
>>>>>>> REPLACE
```

USER:
# Fix any errors below

## Running: flake8 --select=E9,F821,F823,F831,F406,F407,F701,F702,F704,F706 --show-source aider/args.py

aider/args.py:17:5: F821 undefined name 'group'
    group.add_argument(
    ^

## See relevant line below marked with █.

/Users/gauthier/Projects/aider/aider/args.py:
...⋮...
  9│def get_parser(default_config_files, git_root):
 10│    parser = configargparse.ArgumentParser(
 11│        description="aider is GPT powered coding in your terminal",
 12│        add_config_file_help=True,
 13│        default_config_files=default_config_files,
 14│        config_file_parser_class=configargparse.YAMLConfigFileParser,
 15│        auto_env_var_prefix="AIDER_",
 16│    )
 17█    group.add_argument(
 18│        "--auto-lint",
 19│        action=argparse.BooleanOptionalAction,
 20│        default=True,
 21│        help="Enable/disable automatic linting after changes (default: True)",
...⋮...

ASSISTANT: To fix the error, we need to move the `--auto-lint` argument addition to the correct location within the `get_parser` function, after the `group` variable is defined.

Here is the corrected *SEARCH/REPLACE* block:

aider/args.py
```python
<<<<<<< SEARCH
    group.add_argument(
        "--auto-lint",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable automatic linting after changes (default: True)",
    )

    ##########
=======
    ##########
    group.add_argument(
        "--auto-lint",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable automatic linting after changes (default: True)",
    )
>>>>>>> REPLACE
```

USER:
# Fix any errors below

## Running: flake8 --select=E9,F821,F823,F831,F406,F407,F701,F702,F704,F706 --show-source aider/args.py

aider/args.py:18:5: F821 undefined name 'group'
    group.add_argument(
    ^

## See relevant line below marked with █.

/Users/gauthier/Projects/aider/aider/args.py:
...⋮...
  9│def get_parser(default_config_files, git_root):
 10│    parser = configargparse.ArgumentParser(
 11│        description="aider is GPT powered coding in your terminal",
 12│        add_config_file_help=True,
 13│        default_config_files=default_config_files,
 14│        config_file_parser_class=configargparse.YAMLConfigFileParser,
 15│        auto_env_var_prefix="AIDER_",
 16│    )
 17│    ##########
 18█    group.add_argument(
 19│        "--auto-lint",
 20│        action=argparse.BooleanOptionalAction,
 21│        default=True,
 22│        help="Enable/disable automatic linting after changes (default: True)",
...⋮...

ASSISTANT: The error is occurring because the `group` variable is not defined before it is used. We need to place the `--auto-lint` argument addition after the `group` variable is defined.

Here is the corrected *SEARCH/REPLACE* block:

aider/args.py
```python
<<<<<<< SEARCH
    ##########
    group.add_argument(
        "--auto-lint",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable automatic linting after changes (default: True)",
    )
=======
    group = parser.add_argument_group("Main")
>>>>>>> REPLACE
```

aider/args.py
```python
<<<<<<< SEARCH
    group.add_argument(
=======
    group.add_argument(
        "--auto-lint",
        action=argparse.BooleanOptionalAction,
        default=True,
        help="Enable/disable automatic linting after changes (default: True)",
    )
    group.add_argument(
>>>>>>> REPLACE
```
2024-05-19 06:23:28 -07:00
Paul Gauthier
76038e69d7 Added an argument for enabling/disabling automatic linting after changes. 2024-05-19 06:23:27 -07:00
Paul Gauthier
73dd873f86 Add option to enable/disable automatic linting after changes. 2024-05-19 06:23:20 -07:00
Paul Gauthier
6474139d04 Lint files before fixing errors and commit changes if necessary. 2024-05-18 21:13:19 -07:00
Paul Gauthier
d79a629db0 Fix tool error message to display the correct error information. 2024-05-18 21:06:45 -07:00
Paul Gauthier
fec1a646d5 Refactored linting process to handle FileNotFoundError exceptions. 2024-05-18 21:06:30 -07:00
Paul Gauthier
38de35e924 Set linters based on provided commands in args.lint_cmd. 2024-05-18 21:04:47 -07:00
Paul Gauthier
5a6e72a64b Updated linting functionality to only run linting without committing. 2024-05-18 21:00:45 -07:00
Paul Gauthier
7391903759 Removed redundant lint command option and added support for specifying lint commands for different languages. 2024-05-18 20:57:01 -07:00