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

update packages and add examples #20

Merged
merged 3 commits into from
Aug 27, 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
Empty file.
9 changes: 9 additions & 0 deletions examples/sample1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

.PHONY: lint
lint:
rye run ansible-lint -vvv

.PHONY: install
install:
rm -rf .venv
rye sync
42 changes: 42 additions & 0 deletions examples/sample1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# sample1

## sample output

```sh
make lint
```

```log.txt
ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'var__' prefix.
playbooks/debug.yml:8 Task/Handler: Set vars (playbooks/)

fqcn[action-core]: Use FQCN for builtin module actions (set_fact).
playbooks/debug.yml:11 Use `ansible.builtin.set_fact` or `ansible.legacy.set_fact` instead.

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'var__' prefix.
playbooks/debug.yml:14 Task/Handler: Set vars (playbooks/)

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_role__var__' prefix.
playbooks/roles/sample/tasks/main.yml:2 Task/Handler: Set vars (roles/)

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_role__var__' prefix.
playbooks/roles/sample/tasks/main.yml:5 Task/Handler: Set vars (roles/)

fqcn[action-core]: Use FQCN for builtin module actions (set_fact).
playbooks/roles/sample/tasks/main.yml:8 Use `ansible.builtin.set_fact` or `ansible.legacy.set_fact` instead.

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_role__var__' prefix.
playbooks/roles/sample/tasks/main.yml:11 Task/Handler: Set vars (roles/)

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_tasks__var__' prefix.
playbooks/tasks/sample.yml:2 Task/Handler: Set vars (tasks/)

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_tasks__var__' prefix.
playbooks/tasks/sample.yml:5 Task/Handler: Set vars (tasks/)

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_tasks__var__' prefix.
playbooks/tasks/sample.yml:8 Task/Handler: Set vars (tasks/)

ansible-lint-custom-strict-naming<var_name_prefix>: Variables in 'set_fact' should have a 'sample_tasks__var__' prefix.
playbooks/tasks/sample.yml:11 Task/Handler: Set vars (tasks/)
```
19 changes: 19 additions & 0 deletions examples/sample1/playbooks/debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: "Debug"
hosts: localhost
tasks:
- name: "Debug (playbooks/)"
ansible.builtin.debug:
msg: "{{ ansible_facts }}"
- name: Set vars (playbooks/)
ansible.builtin.set_fact:
hoge: "hoge"
- name: Set vars (playbooks/)
set_fact:
hoge: "hoge"
- name: Set vars (playbooks/)
ansible.builtin.set_fact:
sample_role__hoge: "hoge"
- name: Include tasks (playbooks/)
ansible.builtin.include_tasks:
file: "./tasks/sample.yml"
16 changes: 16 additions & 0 deletions examples/sample1/playbooks/roles/sample/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Set vars (roles/)
ansible.builtin.set_fact:
my_var: "hoge"
- name: Set vars (roles/)
ansible.builtin.set_fact:
hoge: "hoge"
- name: Set vars (roles/)
set_fact:
hoge: "hoge"
- name: Set vars (roles/)
ansible.builtin.set_fact:
sample_role__hoge: "hoge"
- name: Debug
ansible.builtin.debug:
msg: "{{ sample_role__hoge }}"
13 changes: 13 additions & 0 deletions examples/sample1/playbooks/tasks/sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Set vars (tasks/)
ansible.builtin.set_fact:
my_var: "hoge"
- name: Set vars (tasks/)
ansible.builtin.set_fact:
hoge: "hoge"
- name: Set vars (tasks/)
ansible.builtin.set_fact:
hoge: "hoge"
- name: Set vars (tasks/)
ansible.builtin.set_fact:
sample_role__hoge: "hoge"
26 changes: 26 additions & 0 deletions examples/sample1/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[project]
name = "sample1"
version = "0.1.0"
description = "Add your description here"
authors = [{ name = "pollenjp", email = "polleninjp@gmail.com" }]
dependencies = [
"ansible-lint>=6.21.1",
# "ansible-lint-custom-strict-naming>=0.1.0",
"ansible-lint-custom-strict-naming @ file:///${PROJECT_ROOT}/../..",
]
readme = "README.md"
requires-python = ">= 3.11"

[build-system]
# use pdm for relative path dependencies
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.rye]
managed = true
dev-dependencies = []

# [[tool.rye.sources]]
# name = "testpypi"
# url = "https://test.pypi.org/simple/"
# type = "index"
97 changes: 97 additions & 0 deletions examples/sample1/requirements-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
ansible-compat==24.8.0
# via ansible-lint
ansible-core==2.17.3
# via ansible-compat
# via ansible-lint
ansible-lint==24.7.0
# via ansible-lint-custom-strict-naming
# via sample1
ansible-lint-custom-strict-naming @ file:///${PROJECT_ROOT}/../..
# via sample1
attrs==24.2.0
# via jsonschema
# via referencing
black==24.8.0
# via ansible-lint
bracex==2.5
# via wcmatch
cffi==1.17.0
# via cryptography
click==8.1.7
# via black
cryptography==43.0.0
# via ansible-core
filelock==3.15.4
# via ansible-lint
importlib-metadata==8.4.0
# via ansible-lint
jinja2==3.1.4
# via ansible-core
jsonschema==4.23.0
# via ansible-compat
# via ansible-lint
jsonschema-specifications==2023.12.1
# via jsonschema
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.5
# via jinja2
mdurl==0.1.2
# via markdown-it-py
mypy-extensions==1.0.0
# via black
packaging==24.1
# via ansible-compat
# via ansible-core
# via ansible-lint
# via black
pathspec==0.12.1
# via ansible-lint
# via black
# via yamllint
platformdirs==4.2.2
# via black
pycparser==2.22
# via cffi
pygments==2.18.0
# via rich
pyyaml==6.0.2
# via ansible-compat
# via ansible-core
# via ansible-lint
# via yamllint
referencing==0.35.1
# via jsonschema
# via jsonschema-specifications
resolvelib==1.0.1
# via ansible-core
rich==13.8.0
# via ansible-lint
rpds-py==0.20.0
# via jsonschema
# via referencing
ruamel-yaml==0.18.6
# via ansible-lint
ruamel-yaml-clib==0.2.8
# via ruamel-yaml
subprocess-tee==0.4.2
# via ansible-compat
# via ansible-lint
wcmatch==9.0
# via ansible-lint
yamllint==1.35.1
# via ansible-lint
zipp==3.20.1
# via importlib-metadata
97 changes: 97 additions & 0 deletions examples/sample1/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
ansible-compat==24.8.0
# via ansible-lint
ansible-core==2.17.3
# via ansible-compat
# via ansible-lint
ansible-lint==24.7.0
# via ansible-lint-custom-strict-naming
# via sample1
ansible-lint-custom-strict-naming @ file:///${PROJECT_ROOT}/../..
# via sample1
attrs==24.2.0
# via jsonschema
# via referencing
black==24.8.0
# via ansible-lint
bracex==2.5
# via wcmatch
cffi==1.17.0
# via cryptography
click==8.1.7
# via black
cryptography==43.0.0
# via ansible-core
filelock==3.15.4
# via ansible-lint
importlib-metadata==8.4.0
# via ansible-lint
jinja2==3.1.4
# via ansible-core
jsonschema==4.23.0
# via ansible-compat
# via ansible-lint
jsonschema-specifications==2023.12.1
# via jsonschema
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.5
# via jinja2
mdurl==0.1.2
# via markdown-it-py
mypy-extensions==1.0.0
# via black
packaging==24.1
# via ansible-compat
# via ansible-core
# via ansible-lint
# via black
pathspec==0.12.1
# via ansible-lint
# via black
# via yamllint
platformdirs==4.2.2
# via black
pycparser==2.22
# via cffi
pygments==2.18.0
# via rich
pyyaml==6.0.2
# via ansible-compat
# via ansible-core
# via ansible-lint
# via yamllint
referencing==0.35.1
# via jsonschema
# via jsonschema-specifications
resolvelib==1.0.1
# via ansible-core
rich==13.8.0
# via ansible-lint
rpds-py==0.20.0
# via jsonschema
# via referencing
ruamel-yaml==0.18.6
# via ansible-lint
ruamel-yaml-clib==0.2.8
# via ruamel-yaml
subprocess-tee==0.4.2
# via ansible-compat
# via ansible-lint
wcmatch==9.0
# via ansible-lint
yamllint==1.35.1
# via ansible-lint
zipp==3.20.1
# via importlib-metadata
Loading
Loading