DamnWidget / anaconda

Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker Vagrant and Docker support for Sublime Text 3 using Jedi, PyFlakes, pep8, MyPy, PyLint, pep257 and McCabe that will never freeze your Sublime Text 3
http://damnwidget.github.io/anaconda/
GNU General Public License v3.0
2.22k stars 259 forks source link

Auto Formatting #648

Open redeemefy opened 7 years ago

redeemefy commented 7 years ago

Expected Behaviour

I have the following code...

    birth_day = int(user_input[3:5])
     birth_month = int(user_input[:2])

I have tried to set rules in "autoformat_select": [] to fix the indentation of the second line. I don't know if one rule is enough or, I need a combination of them like `"E111", "E101".

Actual Behaviour

Either the code stays the same or...

    birth_day = int(user_input[3:5])
        birth_month = int(user_input[:2])

Steps to Reproduce

Create a function and put an extra space character in one of the lines

def get_birthday_from_user():
    user_input = input('What is your birth date? e.i. mm-dd-yyyy: ')
    cuerrent_year = date.today().year
    birth_day = int(user_input[3:5])
     birth_month = int(user_input[:2])

    user_birth_date = date(cuerrent_year, birth_month, birth_day)
    return user_birth_date

ST3, Anaconda and OS versions

OS X - El Capitan ST3 - Build 3126 Anaconda

ST3 Console Logs

reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 83]: no files were indexed out of the 1 queued, abandoning crawl
indexing [job 89]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 99]: no files were indexed out of the 1 queued, abandoning crawl
indexing [job 101]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 108]: no files were indexed out of the 1 queued, abandoning crawl
indexing [job 109]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 114]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 117]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 122]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 125]: no files were indexed out of the 1 queued, abandoning crawl
indexing [job 126]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 130]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
indexing [job 134]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings
reloading settings Packages/User/Anaconda.sublime-settings
Running python -u "/Users/gdiaz/Library/Application Support/Sublime Text 3/Packages/Anaconda/version.py"
indexing [job 140]: no files were indexed out of the 1 queued, abandoning crawl
reloading settings Packages/User/Anaconda.sublime-settings

Anaconda's JsonServer Logs

Note: Anaconda's JsonServer logs can be found in:

2017-04-16 19:28:58,216: INFO    : client requests: pep8
2017-04-16 19:28:58,225: INFO    : About push back to ST3: {"buffer": "from datetime import date\n\n\ndef main():\n    print_header()\n    user_birthday = get_birthday_from_user()\n    number_of_days = compute_days_between_dates(user_birthday)\n    print_birthday_information(number_of_days)\n\n\ndef print_header():\n    print('-------------------------------')\n    print('         BIRTHDAY APP')\n    print('-------------------------------')\n    print()\n\n\ndef get_birthday_from_user():\n    user_input = input('What is your birth date? e.i. mm-dd-yyyy: ')\n    cuerrent_year = date.today().year\n    birth_day = int(user_input[3:5])\n        birth_month = int(user_input[:2])\n\n    user_birth_date = date(cuerrent_year, birth_month, birth_day)\n    return user_birth_date\n\n\ndef compute_days_between_dates(user_birthday):\n    current_date = date.today()\n    dt = user_birthday - current_date\n    return dt.days\n\n\ndef print_birthday_information(total_days):\n    if total_days < 0:\n        total_days *= -1\n        print(f'Your birthday was {total_days} days ago.\\n')\n    elif total_days > 0:\n        print(f'Your birthday is in {total_days} days!!\\n')\n    else:\n        print('Happy birthday!!!!\\n')\n\n\nif __name__ == '__main__':\n    main()\n", "vid": 47, "uid": "effb53555bdd4cd5a888d9e276cabb48", "success": true}

2017-04-16 19:28:58,225: INFO    : client requests: doc
2017-04-16 19:28:58,227: INFO    : About push back to ST3: {"doc": "int\nint(x=0) -&gt; int or long<br>int(x, base=10) -&gt; int or long<br><br>Convert a number or string to an integer, or return 0 if no arguments<br>are given.  If x is floating point, the conversion truncates towards zero.<br>If x is outside the integer range, the function returns a long instead.<br><br>If x is not a number or if base is given, then x must be a string or<br>Unicode object representing an integer literal in the given base.  The<br>literal can be preceded by '+' or '-' and be surrounded by whitespace.<br>The base defaults to 10.  Valid bases are 0 and 2-36.  Base 0 means to<br>interpret the base from the string as an integer literal.<br>&gt;&gt;&gt; int('0b100', base=0)<br>4", "uid": "22357ff9a5bd4d1aab0398be909d5461", "success": true}

2017-04-16 19:28:58,228: INFO    : client requests: lint
2017-04-16 19:28:58,237: INFO    : About push back to ST3: {"vid": 47, "errors": [{"level": "E", "raw_error": "[E] unexpected indent", "lineno": 22, "offset": 8, "message": "[e] %s", "underline_range": true}, {"level": "W", "raw_error": "[W] PEP 8 (E113): unexpected indentation", "lineno": 22, "offset": 8, "message": "[w] pep 8 (%s): %s", "underline_range": true}], "uid": "a8b0c3e2d5ef4945bb39b8937b151805", "success": true}

2017-04-16 19:28:58,699: INFO    : client requests: lint
2017-04-16 19:28:58,707: INFO    : About push back to ST3: {"vid": 47, "errors": [{"level": "E", "raw_error": "[E] unexpected indent", "lineno": 22, "offset": 8, "message": "[e] %s", "underline_range": true}, {"level": "W", "raw_error": "[W] PEP 8 (E113): unexpected indentation", "lineno": 22, "offset": 8, "message": "[w] pep 8 (%s): %s", "underline_range": true}], "uid": "3330b355859a4da6b499133154ebdd6b", "success": true}

2017-04-16 19:30:34,711: INFO    : client requests: lint
2017-04-16 19:30:34,721: INFO    : About push back to ST3: {"vid": 47, "errors": [{"level": "E", "raw_error": "[E] unexpected indent", "lineno": 22, "offset": 8, "message": "[e] %s", "underline_range": true}, {"level": "W", "raw_error": "[W] PEP 8 (E113): unexpected indentation", "lineno": 22, "offset": 8, "message": "[w] pep 8 (%s): %s", "underline_range": true}], "uid": "2db2f6273c8e48d2944bb855db12cddc", "success": true}

2017-04-16 19:32:59,074: INFO    : client requests: lint
2017-04-16 19:32:59,085: INFO    : About push back to ST3: {"vid": 47, "errors": [{"level": "E", "raw_error": "[E] unexpected indent", "lineno": 22, "offset": 8, "message": "[e] %s", "underline_range": true}, {"level": "W", "raw_error": "[W] PEP 8 (E113): unexpected indentation", "lineno": 22, "offset": 8, "message": "[w] pep 8 (%s): %s", "underline_range": true}], "uid": "716c97c6b5f64122aa1548f89790f94a", "success": true}

2017-04-16 19:33:45,412: INFO    : client requests: lint
2017-04-16 19:33:45,424: INFO    : About push back to ST3: {"vid": 47, "errors": [{"level": "E", "raw_error": "[E] unexpected indent", "lineno": 22, "offset": 8, "message": "[e] %s", "underline_range": true}, {"level": "W", "raw_error": "[W] PEP 8 (E113): unexpected indentation", "lineno": 22, "offset": 8, "message": "[w] pep 8 (%s): %s", "underline_range": true}], "uid": "280fdde8926449e5b9da4e096f277c5b", "success": true}
DamnWidget commented 7 years ago

Did you try to use the aggressive setting in your preferences?, you can set it to whatever number that you need or think is good for you, more info

redeemefy commented 7 years ago

I have not. I'm going to click more info and read about it and see if I can fix the issue. Thank you!!