Skip to content

Commit

Permalink
Merge pull request #1 from staticdev/bug/fix-linting
Browse files Browse the repository at this point in the history
Fix linting
  • Loading branch information
staticdev authored Jul 3, 2021
2 parents 20335d6 + 2a3d280 commit efc9b0b
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.1
hooks:
- id: prettier
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.1
hooks:
- id: yamllint
args: ["-c=.yamllint", "."]
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v5.0.12
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
18 changes: 18 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
extends: default

rules:
line-length:
max: 180
level: warning
document-start:
level: error
comments:
level: error
truthy:
level: error

ignore: |
.github/stale.yml
.cache
roles
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The `firefox_profiles` is object with profile names als fields. For each profile
datareporting.healthreport.uploadEnabled: "false"
roles:
- basvandenbrink.firefox
- basvandenbrink.firefox
```

## Credits
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ansible-role-firefox"
version = "1.0.0"
version = "0.0.0"
description = "Ansible role to configure Firefox."
authors = ["staticdev <staticdev-support@protonmail.com>"]
license = "MIT"
Expand Down
9 changes: 5 additions & 4 deletions tasks/configure_profile.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Create profiles
firefox_profile:
name: "{{ firefox_profile.key }}"
Expand All @@ -19,11 +20,11 @@

- name: Install user prefs
lineinfile:
path: '{{ create_profile.profile_path }}/prefs.js'
create: yes
path: "{{ create_profile.profile_path }}/prefs.js"
create: true
regexp: '^user_pref\("{{ pref.key }}",\s*\S+?\);\s*$'
line: "user_pref(\"{{ pref.key }}\", {{ ('\"%s\"' | format(pref.value)) if pref.value is string else (pref.value | lower) }});"
with_items: '{{ firefox_profile.value.preferences | default({}) | dict2items }}'
line: 'user_pref("{{ pref.key }}", {{ (''"%s"'' | format(pref.value)) if pref.value is string else (pref.value | lower) }});'
with_items: "{{ firefox_profile.value.preferences | default({}) | dict2items }}"
loop_control:
loop_var: pref
tags: firefox
3 changes: 2 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- name: Configure profiles
include_tasks: configure_profile.yml
with_dict: "{{ firefox_profiles }}"
loop_control:
loop_var: firefox_profile
tags: firefox
tags: firefox
2 changes: 1 addition & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- hosts: localhost

vars:
firefox_profiles:
default:
Expand Down

0 comments on commit efc9b0b

Please sign in to comment.