From a6b004b4e7d8a748bf0ce1f8790c0370d4c56dbb Mon Sep 17 00:00:00 2001 From: John Date: Tue, 6 Apr 2021 16:07:14 -0700 Subject: [PATCH 1/3] Fixed meta-incorrect rule to report errors correctly --- src/ansiblelint/rules/MetaChangeFromDefaultRule.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ansiblelint/rules/MetaChangeFromDefaultRule.py b/src/ansiblelint/rules/MetaChangeFromDefaultRule.py index 96df6aa980..b5a3ee7590 100644 --- a/src/ansiblelint/rules/MetaChangeFromDefaultRule.py +++ b/src/ansiblelint/rules/MetaChangeFromDefaultRule.py @@ -44,7 +44,11 @@ def matchplay( value = galaxy_info.get(field, None) if value and value == default: results.append( - self.create_matcherror('Should change default metadata: %s' % field) + self.create_matcherror( + filename=file, + linenumber=data['__line__'], + message=self.create_matcherror('Should change default metadata: %s' % field) + ) ) return results From 288476eb7e1f0965e8645734f5ca45b59bcfcb2c Mon Sep 17 00:00:00 2001 From: John Date: Tue, 6 Apr 2021 16:08:10 -0700 Subject: [PATCH 2/3] Fixed flake8 errors --- src/ansiblelint/rules/MetaChangeFromDefaultRule.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansiblelint/rules/MetaChangeFromDefaultRule.py b/src/ansiblelint/rules/MetaChangeFromDefaultRule.py index b5a3ee7590..74dd6cd883 100644 --- a/src/ansiblelint/rules/MetaChangeFromDefaultRule.py +++ b/src/ansiblelint/rules/MetaChangeFromDefaultRule.py @@ -45,8 +45,8 @@ def matchplay( if value and value == default: results.append( self.create_matcherror( - filename=file, - linenumber=data['__line__'], + filename=file, + linenumber=data['__line__'], message=self.create_matcherror('Should change default metadata: %s' % field) ) ) From e5fab59ba090326355235da9db25fa87bb68a74c Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 7 Apr 2021 08:45:19 +0100 Subject: [PATCH 3/3] Fix lint --- src/ansiblelint/rules/MetaChangeFromDefaultRule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansiblelint/rules/MetaChangeFromDefaultRule.py b/src/ansiblelint/rules/MetaChangeFromDefaultRule.py index 74dd6cd883..ac1b18dc80 100644 --- a/src/ansiblelint/rules/MetaChangeFromDefaultRule.py +++ b/src/ansiblelint/rules/MetaChangeFromDefaultRule.py @@ -47,7 +47,7 @@ def matchplay( self.create_matcherror( filename=file, linenumber=data['__line__'], - message=self.create_matcherror('Should change default metadata: %s' % field) + message='Should change default metadata: %s' % field, ) )