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

ci: workflow python black linting #339

Merged
merged 8 commits into from
Jan 10, 2024
Merged
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
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: "**/*.py"

- uses: psf/black@stable
with:
src: ${{ steps.changed-files.outputs.all_changed_files }}
3 changes: 3 additions & 0 deletions changelogs/fragments/339-lint-black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
trivial:
- added python black linting action
2 changes: 0 additions & 2 deletions plugins/callback/grafana_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ class CallbackModule(CallbackBase):
CALLBACK_NEEDS_WHITELIST = True

def __init__(self, display=None):

super(CallbackModule, self).__init__(display=display)

self.headers = {"Content-Type": "application/json"}
Expand All @@ -178,7 +177,6 @@ def __init__(self, display=None):
self.errors = 0

def set_options(self, task_keys=None, var_options=None, direct=None):

super(CallbackModule, self).set_options(
task_keys=task_keys, var_options=var_options, direct=direct
)
Expand Down
1 change: 0 additions & 1 deletion plugins/doc_fragments/api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class ModuleDocFragment(object):

DOCUMENTATION = r"""options:
grafana_api_key:
description:
Expand Down
1 change: 0 additions & 1 deletion plugins/doc_fragments/basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class ModuleDocFragment(object):

DOCUMENTATION = r"""options:
url:
description:
Expand Down
1 change: 0 additions & 1 deletion plugins/lookup/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def grafana_list_dashboards(self):

class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):

grafana_args = terms[0].split(" ")
grafana_dict = {}
ret = []
Expand Down
4 changes: 0 additions & 4 deletions plugins/modules/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ def grafana_dashboard_exists(module, grafana_url, uid, headers):


def grafana_dashboard_search(module, grafana_url, folder_id, title, headers):

# search by title
uri = "%s/api/search?%s" % (
grafana_url,
Expand Down Expand Up @@ -339,7 +338,6 @@ def grafana_dashboard_changed(payload, dashboard):


def grafana_create_dashboard(module, data):

# define data payload for grafana API
payload = {}
if data.get("dashboard_id"):
Expand Down Expand Up @@ -482,7 +480,6 @@ def grafana_create_dashboard(module, data):


def grafana_delete_dashboard(module, data):

# define http headers
headers = grafana_headers(module, data)

Expand Down Expand Up @@ -540,7 +537,6 @@ def grafana_delete_dashboard(module, data):


def grafana_export_dashboard(module, data):

# define http headers
headers = grafana_headers(module, data)

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/grafana_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ def setup_module_object():


def main():

module = setup_module_object()
state = module.params["state"]
title = module.params["name"]
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/grafana_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def setup_module_object():


def main():

module = setup_module_object()
state = module.params["state"]
name = module.params["name"]
Expand Down
Loading