From cc174d843e972c69242e1cb217bf59346ae0b584 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 25 Jan 2021 12:19:56 +0100 Subject: [PATCH] Add pre-commit Signed-off-by: Matej Focko --- .pre-commit-config.yaml | 19 +++++++++++++++++++ .../roles/fedora/packages/tasks/main.yml | 4 ++-- .../roles/fedora/repositories/tasks/main.yml | 2 +- .../rpmfusion-free-updates-testing.repo.j2 | 1 - .../local/rpmfusion-free-updates.repo.j2 | 1 - .../templates/local/rpmfusion-free.repo.j2 | 1 - .../rpmfusion-nonfree-updates-testing.repo.j2 | 1 - .../local/rpmfusion-nonfree-updates.repo.j2 | 1 - .../templates/local/rpmfusion-nonfree.repo.j2 | 1 - .../rpmfusion-free-updates-testing.repo.j2 | 1 - .../remote/rpmfusion-free-updates.repo.j2 | 1 - .../templates/remote/rpmfusion-free.repo.j2 | 1 - .../rpmfusion-nonfree-updates-testing.repo.j2 | 1 - .../remote/rpmfusion-nonfree-updates.repo.j2 | 1 - .../remote/rpmfusion-nonfree.repo.j2 | 1 - playbooks/roles/fedora/upgrade/tasks/main.yml | 2 +- playbooks/roles/git/tasks/main.yml | 2 +- playbooks/roles/haskell/tasks/main.yml | 2 +- playbooks/roles/shell/templates/init.vim.j2 | 14 +++++++------- .../roles/shell/templates/starship.toml.j2 | 2 +- playbooks/roles/shell/templates/tmux.conf.j2 | 2 +- .../roles/shell/templates/tmux_status.conf.j2 | 2 +- playbooks/roles/ssh/templates/ssh_config.j2 | 2 +- .../vscode/templates/code-url.desktop.j2 | 2 +- .../vscode/templates/keybindings.json.j2 | 2 +- .../roles/vscode/templates/settings.json.j2 | 2 +- scripts/export_keys.sh | 2 +- scripts/generate_gpg.sh | 2 +- 28 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e72ee08 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: https://github.com/prettier/pre-commit + rev: v2.1.2 + hooks: + - id: prettier + - repo: https://github.com/ansible/ansible-lint.git + rev: v4.2.0 + hooks: + - id: ansible-lint + files: \.(yaml|yml)$ diff --git a/playbooks/roles/fedora/packages/tasks/main.yml b/playbooks/roles/fedora/packages/tasks/main.yml index 6c988ac..d3671a1 100644 --- a/playbooks/roles/fedora/packages/tasks/main.yml +++ b/playbooks/roles/fedora/packages/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Upgrade all packages dnf: - name: '*' + name: "*" state: latest - name: Install playerctl and flameshot @@ -12,4 +12,4 @@ state: present - include: shell.yml -- include: haskell.yml \ No newline at end of file +- include: haskell.yml diff --git a/playbooks/roles/fedora/repositories/tasks/main.yml b/playbooks/roles/fedora/repositories/tasks/main.yml index 05847fe..b1cf462 100644 --- a/playbooks/roles/fedora/repositories/tasks/main.yml +++ b/playbooks/roles/fedora/repositories/tasks/main.yml @@ -31,4 +31,4 @@ - rpmfusion-free - rpmfusion-nonfree-updates-testing - rpmfusion-nonfree-updates - - rpmfusion-nonfree \ No newline at end of file + - rpmfusion-nonfree diff --git a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates-testing.repo.j2 b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates-testing.repo.j2 index aa58187..c6418ec 100644 --- a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates-testing.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates-testing.repo.j2 @@ -29,4 +29,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates.repo.j2 b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates.repo.j2 index 89d7673..ac3f67d 100644 --- a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free-updates.repo.j2 @@ -29,4 +29,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free.repo.j2 b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free.repo.j2 index 0325937..7284d60 100644 --- a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-free.repo.j2 @@ -31,4 +31,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates-testing.repo.j2 b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates-testing.repo.j2 index 7cd3fe8..b00cbd1 100644 --- a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates-testing.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates-testing.repo.j2 @@ -29,4 +29,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates.repo.j2 b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates.repo.j2 index fb79a02..7f69190 100644 --- a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree-updates.repo.j2 @@ -29,4 +29,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree.repo.j2 b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree.repo.j2 index d064986..710381b 100644 --- a/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/local/rpmfusion-nonfree.repo.j2 @@ -32,4 +32,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates-testing.repo.j2 b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates-testing.repo.j2 index e4cbddd..662defc 100644 --- a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates-testing.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates-testing.repo.j2 @@ -28,4 +28,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates.repo.j2 b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates.repo.j2 index 1405931..d520472 100644 --- a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free-updates.repo.j2 @@ -28,4 +28,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free.repo.j2 b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free.repo.j2 index e65aa5b..4a66f92 100644 --- a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-free.repo.j2 @@ -30,4 +30,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates-testing.repo.j2 b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates-testing.repo.j2 index d8998fa..6aebcf4 100644 --- a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates-testing.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates-testing.repo.j2 @@ -28,4 +28,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates.repo.j2 b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates.repo.j2 index 6d4d825..a456130 100644 --- a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree-updates.repo.j2 @@ -28,4 +28,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever - diff --git a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree.repo.j2 b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree.repo.j2 index dfb5110..100cb93 100644 --- a/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree.repo.j2 +++ b/playbooks/roles/fedora/repositories/templates/remote/rpmfusion-nonfree.repo.j2 @@ -31,4 +31,3 @@ type=rpm-md gpgcheck=1 repo_gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever - diff --git a/playbooks/roles/fedora/upgrade/tasks/main.yml b/playbooks/roles/fedora/upgrade/tasks/main.yml index 5de5cea..01520ae 100644 --- a/playbooks/roles/fedora/upgrade/tasks/main.yml +++ b/playbooks/roles/fedora/upgrade/tasks/main.yml @@ -7,7 +7,7 @@ - name: Update all packages dnf: - name: '*' + name: "*" state: latest - name: Install system-upgrade plugin diff --git a/playbooks/roles/git/tasks/main.yml b/playbooks/roles/git/tasks/main.yml index 844af79..b77e708 100644 --- a/playbooks/roles/git/tasks/main.yml +++ b/playbooks/roles/git/tasks/main.yml @@ -2,4 +2,4 @@ - name: Create git config template: src: templates/gitconfig.j2 - dest: ~/.gitconfig \ No newline at end of file + dest: ~/.gitconfig diff --git a/playbooks/roles/haskell/tasks/main.yml b/playbooks/roles/haskell/tasks/main.yml index 3c4dcd5..cceb081 100644 --- a/playbooks/roles/haskell/tasks/main.yml +++ b/playbooks/roles/haskell/tasks/main.yml @@ -12,4 +12,4 @@ - name: Install HLint.hs template: src: templates/HLint.hs.j2 - dest: ~/.ghc/HLint.hs \ No newline at end of file + dest: ~/.ghc/HLint.hs diff --git a/playbooks/roles/shell/templates/init.vim.j2 b/playbooks/roles/shell/templates/init.vim.j2 index 4632ef8..7b566c0 100644 --- a/playbooks/roles/shell/templates/init.vim.j2 +++ b/playbooks/roles/shell/templates/init.vim.j2 @@ -13,11 +13,11 @@ " Then run vim and install the plugins using command in normal mode: " :PlugInstall " -" Most of the settings come from vimconfig.com. +" Most of the settings come from vimconfig.com. " We added few handy key mappings: " -" Ctrl+Up/Down Move line or a block of selected lines -" Ctrl+j/k +" Ctrl+Up/Down Move line or a block of selected lines +" Ctrl+j/k " pp Toggle paste mode on and off " Disable search highlight " @@ -80,7 +80,7 @@ if &term =~ '256color' " render properly when inside 256-color tmux and GNU screen. " see also http://snk.tuxfamily.org/log/vim-256color-bce.html set t_ut= -endif +endif " If you happen to still have a problem on some terminal, uncomment: " set t_Co=256 @@ -99,12 +99,12 @@ set textwidth=80 " Line wrap (number of cols) set showmatch " Highlight matching brace set showcmd " Show last command on right set cursorline " Highlight current line - + set hlsearch " Highlight all search results set smartcase " Enable smart-case search set ignorecase " Always case-insensitive set incsearch " Searches for strings incrementally - + set autoindent " Auto-indent new lines set cindent " Use 'C' style program indenting set shiftwidth=4 " Number of auto-indent spaces @@ -113,7 +113,7 @@ set smarttab " Enable smart-tabs set softtabstop=4 expandtab " Number of spaces per Tab set wrap " Wrap lines - + """"" """"" Advanced """"" diff --git a/playbooks/roles/shell/templates/starship.toml.j2 b/playbooks/roles/shell/templates/starship.toml.j2 index f661b69..0a7b939 100644 --- a/playbooks/roles/shell/templates/starship.toml.j2 +++ b/playbooks/roles/shell/templates/starship.toml.j2 @@ -32,4 +32,4 @@ format = "[$path]($style)[$read_only]($read_only_style) " [character] success_symbol = "[%%](bold green)" -error_symbol = "[%%](bold red)" \ No newline at end of file +error_symbol = "[%%](bold red)" diff --git a/playbooks/roles/shell/templates/tmux.conf.j2 b/playbooks/roles/shell/templates/tmux.conf.j2 index bdd5df6..4b46461 100644 --- a/playbooks/roles/shell/templates/tmux.conf.j2 +++ b/playbooks/roles/shell/templates/tmux.conf.j2 @@ -34,4 +34,4 @@ set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-restore 'on' -run '~/.tmux/plugins/tpm/tpm' \ No newline at end of file +run '~/.tmux/plugins/tpm/tpm' diff --git a/playbooks/roles/shell/templates/tmux_status.conf.j2 b/playbooks/roles/shell/templates/tmux_status.conf.j2 index fd4916f..eb792d9 100644 --- a/playbooks/roles/shell/templates/tmux_status.conf.j2 +++ b/playbooks/roles/shell/templates/tmux_status.conf.j2 @@ -7,4 +7,4 @@ set -g status-interval 1 set -g status-justify centre set -g status-position top setw -g window-status-current-format '#[fg=colour2][#I|#W#F]' -setw -g window-status-format '[#I|#W#F]' \ No newline at end of file +setw -g window-status-format '[#I|#W#F]' diff --git a/playbooks/roles/ssh/templates/ssh_config.j2 b/playbooks/roles/ssh/templates/ssh_config.j2 index 3dab22a..91f7a80 100644 --- a/playbooks/roles/ssh/templates/ssh_config.j2 +++ b/playbooks/roles/ssh/templates/ssh_config.j2 @@ -34,4 +34,4 @@ Host git.mfocko.xyz Host git.gauss.mfocko.xyz User git Hostname git.gauss.mfocko.xyz - Port 2222 \ No newline at end of file + Port 2222 diff --git a/playbooks/roles/vscode/templates/code-url.desktop.j2 b/playbooks/roles/vscode/templates/code-url.desktop.j2 index 1540473..c750536 100644 --- a/playbooks/roles/vscode/templates/code-url.desktop.j2 +++ b/playbooks/roles/vscode/templates/code-url.desktop.j2 @@ -9,4 +9,4 @@ NoDisplay=true StartupNotify=true Categories=Utility;TextEditor;Development;IDE; MimeType=x-scheme-handler/vscode-insiders; -Keywords=vscode; \ No newline at end of file +Keywords=vscode; diff --git a/playbooks/roles/vscode/templates/keybindings.json.j2 b/playbooks/roles/vscode/templates/keybindings.json.j2 index b56fe6b..8b31edb 100644 --- a/playbooks/roles/vscode/templates/keybindings.json.j2 +++ b/playbooks/roles/vscode/templates/keybindings.json.j2 @@ -31,4 +31,4 @@ "command": "workbench.action.terminal.focusPrevious", "when": "terminalFocus" } -] \ No newline at end of file +] diff --git a/playbooks/roles/vscode/templates/settings.json.j2 b/playbooks/roles/vscode/templates/settings.json.j2 index e7234ef..b32c052 100644 --- a/playbooks/roles/vscode/templates/settings.json.j2 +++ b/playbooks/roles/vscode/templates/settings.json.j2 @@ -43,4 +43,4 @@ "gitlens.views.repositories.location": "scm", "gitlens.views.search.location": "scm", "diffEditor.renderSideBySide": true -} \ No newline at end of file +} diff --git a/scripts/export_keys.sh b/scripts/export_keys.sh index 4dbb96e..6727667 100644 --- a/scripts/export_keys.sh +++ b/scripts/export_keys.sh @@ -5,4 +5,4 @@ cat ~/.ssh/id_ed25519.pub echo ">>> Exporting public GPG key <<<" ID=$(gpg --list-secret-keys --keyid-format LONG | perl -n -e'/^sec.*\/(\w*)\s+/ && print $1') -gpg --armor --export $ID \ No newline at end of file +gpg --armor --export $ID diff --git a/scripts/generate_gpg.sh b/scripts/generate_gpg.sh index 3ac6e6f..7c42b4b 100644 --- a/scripts/generate_gpg.sh +++ b/scripts/generate_gpg.sh @@ -7,4 +7,4 @@ ID=$(gpg --list-secret-keys --keyid-format LONG | perl -n -e'/^sec.*\/(\w*)\s+/ echo ">>> ID: $ID <<<" echo ">>> Exporting public key <<<" -gpg --armor --export $ID \ No newline at end of file +gpg --armor --export $ID