Browse Source

Disable Python linting by default (fixes #1789) (#1794)

* Disable Python linting by default (fixes #1789)

* Try to simplify

* Return do nothing comment

* Disable linting for the javascript as well

* Apply suggestions from code review

---------

Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk>
Co-authored-by: Xingyao Wang <xingyao6@illinois.edu>
Aleksandar 1 year ago
parent
commit
94a9ec76b0

+ 2 - 2
opendevin/runtime/plugins/swe_agent_commands/cursors_edit_linting.sh

@@ -35,8 +35,8 @@ edit() {
     local new_lines=("${lines[@]:0:$start_line}" "${replacement[@]}" "${lines[@]:$((end_line))}")
     # Write the new stuff directly back into the original file
     printf "%s\n" "${new_lines[@]}" >| "$CURRENT_FILE"
-    # Run linter
-    if [[ $CURRENT_FILE == *.py ]]; then
+    # Run linter if enabled
+    if [[ $CURRENT_FILE == *.py && -n "$RUN_LINT_AFTER_EDIT" ]]; then
         lint_output=$(flake8 --isolated --select=F821,F822,F831,E111,E112,E113,E999,E902 "$CURRENT_FILE" 2>&1)
     else
         # do nothing

+ 2 - 2
opendevin/runtime/plugins/swe_agent_commands/edit_linting.sh

@@ -67,8 +67,8 @@ edit() {
     # Write the new stuff directly back into the original file
     printf "%s\n" "${new_lines[@]}" >| "$CURRENT_FILE"
 
-    # Run linter
-    if [[ $CURRENT_FILE == *.py ]]; then
+    # Run linter if enabled
+    if [[ $CURRENT_FILE == *.py && -n "$RUN_LINT_AFTER_EDIT" ]]; then
         lint_output=$(flake8 --isolated --select=F821,F822,F831,E111,E112,E113,E999,E902 "$CURRENT_FILE" 2>&1)
     else
         # do nothing