Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimizing config file #1983

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auto_nag/round_robin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RoundRobin(object):

_instances: dict = {}

def __init__(self, rotation_definitions=None, people=None, teams=None):
def __init__(self, rotation_definitions=None, people=None, teams=None, days_to_nag: int = 7):
self.people = People.get_instance() if people is None else people
self.components_by_triager: Dict[str, list] = {}
self.rotation_definitions = (
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/assignee_no_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class AssigneeNoLogin(BzCleaner):
def __init__(self):
def __init__(self, unassign_weeks: int = 2, max_ni: int = 7, max_actions: int = 10):
super(AssigneeNoLogin, self).__init__()
self.unassign_weeks = utils.get_config(self.name(), "unassign_weeks", 2)
self.max_ni = utils.get_config(self.name(), "max_ni")
Expand Down
8 changes: 7 additions & 1 deletion auto_nag/scripts/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@


class Component(BzCleaner):
def __init__(self):
def __init__(
self,
confidence_threshold: float = 0.35,
general_confidence_threshold: float = 0.8,
days_lookup: int = 365,
max_days_in_cache: int = 7
Comment on lines +18 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reference to #1437 (comment), both days_lookup and max_days_in_cache are used outside the auto_nag/scripts directory:

Refactoring these is a bit less straightforward, so let us keep it outside the scope of this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Since they are used outside the directory, I should remove them from the init function, correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

):
super().__init__()
self.autofix_component = {}
self.frequency = "daily"
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/copy_duplicate_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class CopyDuplicateInfo(BzCleaner):
def __init__(self):
def __init__(self, days_lookup: int = 10):
super(CopyDuplicateInfo, self).__init__()
self.autofix_data = {}

Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/defectenhancementtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class DefectEnhancementTask(BzCleaner):
def __init__(self):
def __init__(self, max_days_in_cache: int = 7, days_lookup: int = 3):
super().__init__()
self.autofix_type = {}

Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/good_first_bug_unassign_inactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class GoodFirstBugUnassignInactive(BzCleaner):
def __init__(self):
def __init__(self, months_lookup: int = 2):
super(GoodFirstBugUnassignInactive, self).__init__()
self.nmonths = utils.get_config(self.name(), "months_lookup")
self.autofix_assignee = {}
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/has_str_no_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class HasSTRNoRange(BzCleaner):
def __init__(self):
def __init__(self, days_lookup: int = 10):
super(HasSTRNoRange, self).__init__()
self.people = People.get_instance()
self.autofix_reporters = {}
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/inactive_ni_pending.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __str__(self):


class InactiveNeedinfoPending(BzCleaner):
def __init__(self):
def __init__(self, max_actions: int = 3):
super(InactiveNeedinfoPending, self).__init__()
self.max_actions = utils.get_config(self.name(), "max_actions", 7)

Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/leave_open_no_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class LeaveOpenNoActivity(BzCleaner):
def __init__(self):
def __init__(self, months_lookup: int = 6, max_ni: int = 3):
super(LeaveOpenNoActivity, self).__init__()
self.people = People.get_instance()
self.nmonths = utils.get_config(self.name(), "months_lookup")
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/lot_of_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class SeveralCc(BzCleaner):
def __init__(self):
def __init__(self, weeks_lookup: int = 3, number_cc: int = 50):
super(SeveralCc, self).__init__()
self.nweeks = utils.get_config(self.name(), "weeks_lookup")
self.cc = utils.get_config(self.name(), "number_cc")
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/lot_of_votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class SeveralVotes(BzCleaner):
def __init__(self):
def __init__(self, weeks_lookup: int = 3, number_votes: int = 10):
super(SeveralVotes, self).__init__()
self.nweeks = utils.get_config(self.name(), "weeks_lookup")
self.votes = utils.get_config(self.name(), "number_votes")
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/meta_defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class MetaDefect(BzCleaner):
def __init__(self):
def __init__(self, months_lookup: int = 24):
super(MetaDefect, self).__init__()
self.nmonths = utils.get_config(self.name(), "months_lookup")

Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/meta_no_deps_no_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class MetaNoDepsNoActivity(BzCleaner):
def __init__(self):
def __init__(self, months_lookup: int = 12, max_ni: int = 3):
super(MetaNoDepsNoActivity, self).__init__()
self.people = People.get_instance()
self.nmonths = utils.get_config(self.name(), "months_lookup")
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/ni_from_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class NiFromManager(BzCleaner, Nag):
def __init__(self):
def __init__(self, days_lookup: int = 183, number_of_weeks: int = 1):
super(NiFromManager, self).__init__()
self.nweeks = utils.get_config(self.name(), "number_of_weeks", 1)
self.vip = self.get_people().get_rm_or_directors()
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/no_assignee.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class NoAssignee(BzCleaner):
def __init__(self):
def __init__(self, days_lookup: int = 45):
super(NoAssignee, self).__init__()
self.hgdata = {}
self.autofix_assignee = {}
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/no_crashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SocorroError(Exception):


class NoCrashes(BzCleaner):
def __init__(self):
def __init__(self, number_of_weeks: int = 12):
super(NoCrashes, self).__init__()
self.nweeks = utils.get_config(self.name(), "number_of_weeks", 12)
self.summaries = {}
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/not_landed.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


class NotLanded(BzCleaner):
def __init__(self):
def __init__(self, number_of_weeks: int = 2, number_of_years: int = 2):
super(NotLanded, self).__init__()
self.nweeks = utils.get_config(self.name(), "number_of_weeks", 2)
self.nyears = utils.get_config(self.name(), "number_of_years", 2)
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/prod_comp_changed_with_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ProdCompChangedWithPriority(BzCleaner):
(False, True): "component",
}

def __init__(self):
def __init__(self, days_lookup: int = 30):
super(ProdCompChangedWithPriority, self).__init__()
self.autofix_priority = {}
self.skiplist = set(self.get_config("skiplist"))
Expand Down
7 changes: 6 additions & 1 deletion auto_nag/scripts/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@


class Regression(BzCleaner):
def __init__(self):
def __init__(
self,
max_days_in_cache: int = 7,
days_lookup: int = 3,
confidence_threshold: float = 1.0
):
super().__init__()
self.autofix_regression = []

Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/regression_set_status_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class RegressionSetStatusFlags(BzCleaner):
def __init__(self):
def __init__(self, days_lookup: int = 21):
super().__init__()
if not self.init_versions():
return
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/several_dups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class SeveralDups(BzCleaner):
def __init__(self):
def __init__(self, weeks_lookup: int = 3, number_dups: int = 3):
super(SeveralDups, self).__init__()
self.nweeks = utils.get_config(self.name(), "weeks_lookup")
self.ndups = utils.get_config(self.name(), "number_dups")
Expand Down
9 changes: 8 additions & 1 deletion auto_nag/scripts/severity_underestimated.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@


class UnderestimatedSeverity(BzCleaner):
def __init__(self):
def __init__(
self,
weeks_lookup: int = 3,
number_dups: int = 3,
number_votes: int = 10,
number_cc: int = 50,
number_see_also: int = 5
):
super(UnderestimatedSeverity, self).__init__()
self.nweeks = self.get_config("weeks_lookup")
self.ndups = self.get_config("number_dups")
Expand Down
7 changes: 6 additions & 1 deletion auto_nag/scripts/spambug.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@


class SpamBug(BzCleaner):
def __init__(self):
def __init__(
self,
max_days_in_cache: int = 7,
days_lookup: int = 7,
confidence_threshold: float = 0.95
):
super().__init__()
self.autofix_bugs = {}
self.people = people.People.get_instance()
Expand Down
2 changes: 1 addition & 1 deletion auto_nag/scripts/warn_regressed_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class WarnRegressedBy(BzCleaner):
def __init__(self):
def __init__(self, max_days_in_cache: int = 7):
super(WarnRegressedBy, self).__init__()
self.regressions = {}
self.threshold = self.get_config("threshold", 3)
Expand Down
1 change: 1 addition & 0 deletions relman-auto-nag
Submodule relman-auto-nag added at 142df5