#1210: Add rule 'rails_migrations_pending'

* Add rule 'rails_migrations_pending'

* Update thefuck/rules/rails_migrations_pending.py

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>

* Add initial command to corrected command

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
This commit is contained in:
Abraham Chan
2021-07-06 03:52:54 -07:00
committed by GitHub
parent 24576b30b2
commit 6111523034
3 changed files with 61 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import re
from thefuck.shells import shell
SUGGESTION_REGEX = r"To resolve this issue, run:\s+(.*?)\n"
def match(command):
return "Migrations are pending. To resolve this issue, run:" in command.output
def get_new_command(command):
migration_script = re.search(SUGGESTION_REGEX, command.output).group(1)
return shell.and_(migration_script, command.script)