# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

from auto_nag.bzcleaner import BzCleaner


class RegressionButEnhancementTask(BzCleaner):
    def __init__(self):
        super(RegressionButEnhancementTask, self).__init__()

    def description(self):
        return 'Enhancement or task with the "regression" keyword'

    def get_bz_params(self, date):
        params = {
            "resolution": "---",
            "keywords": "regression",
            "keywords_type": "allwords",
            "bug_type": ["task", "enhancement"],
        }
        return params


if __name__ == "__main__":
    RegressionButEnhancementTask().run()

@@ -453,16 +453,40 @@
 ression%22
+, %22crash%22 or %22assertion%22
  keyword
@@ -523,16 +523,69 @@
  date):%0A
+        days_lookup = self.get_config('days_lookup')%0A
         
@@ -625,14 +625,25 @@
 n%22: 
+%5B
 %22---%22,
+ %22FIXED%22%5D,
 %0A   
@@ -663,16 +663,17 @@
 words%22: 
+%5B
 %22regress
@@ -677,16 +677,39 @@
 ession%22,
+ %22crash%22, %22assertion%22%5D,
 %0A       
@@ -732,18 +732,18 @@
 ype%22: %22a
-ll
+ny
 words%22,%0A
@@ -803,31 +803,195 @@
     
-%7D%0A        return params
+    'f1': 'days_elapsed',%0A            'o1': 'lessthan',%0A            'v1': days_lookup,%0A        %7D%0A        return params%0A%0A    def get_autofix_change(self):%0A        return %7B%22type%22: %22defect%22%7D
 %0A%0A%0Ai

add an autofix when it is a regression, crash or assertion (#543)