diff --git a/flake.nix b/flake.nix index eefcaeb..6a19d09 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,48 @@ }; # --- System Outputs --- - outputs = { self, nixpkgs, home-manager, dms, dgop, dank-greeter, dankcalendar, danksearch, zen-browser, antigravity, ... }@inputs: { + outputs = { self, nixpkgs, home-manager, dms, dgop, dank-greeter, dankcalendar, danksearch, zen-browser, antigravity, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + # --- Linting, Formatting & Static Analysis Checks --- + # Executed via `nix flake check` or `nix build .#checks..` + checks.${system} = { + # Python linting via ruff + ruff-lint = pkgs.runCommand "check-ruff-lint" { + nativeBuildInputs = [ pkgs.ruff ]; + } '' + ruff check --no-cache ${self} + touch $out + ''; + + # Python formatting check via ruff + ruff-format = pkgs.runCommand "check-ruff-format" { + nativeBuildInputs = [ pkgs.ruff ]; + } '' + ruff format --check ${self} + touch $out + ''; + + # Python static type analysis via pyright + pyright = pkgs.runCommand "check-pyright" { + nativeBuildInputs = [ pkgs.pyright ]; + } '' + pyright ${self} + touch $out + ''; + + # Shell script linting via ShellCheck + shellcheck = pkgs.runCommand "check-shellcheck" { + nativeBuildInputs = [ pkgs.shellcheck ]; + } '' + find ${self} -type f -name "*.sh" -exec shellcheck -s bash {} + + touch $out + ''; + }; + nixosConfigurations = { # πŸ’» LAPTOP HOST (Mobile Workstation) laptop = nixpkgs.lib.nixosSystem { diff --git a/home/dev.nix b/home/dev.nix index b67057a..188c364 100644 --- a/home/dev.nix +++ b/home/dev.nix @@ -75,7 +75,7 @@ nodejs prettier - # Language Servers (Zed, Neovim, General) + # Language Servers, Linters & Diagnostics (Zed, Neovim, General) nil nixd jdt-language-server @@ -83,6 +83,7 @@ lua-language-server taplo marksman + shellcheck # Cloud CLI, Git Forge & Database Management tea # Gitea official CLI client diff --git a/home/scripts/bundle_project.py b/home/scripts/bundle_project.py index 9103be0..2e3be04 100755 --- a/home/scripts/bundle_project.py +++ b/home/scripts/bundle_project.py @@ -29,7 +29,7 @@ def is_binary(file_path: Path) -> bool: def create_bundle(target_dir: Path, output_file: Path) -> None: """ Creates a single text bundle of a directory structure and its file contents. - + Args: target_dir: The directory to bundle. output_file: The path to write the bundled text file to. @@ -114,8 +114,7 @@ def main() -> None: """ parser = argparse.ArgumentParser( description=( - "Bundle a directory structure and its files into " - "a single text document." + "Bundle a directory structure and its files into a single text document." ) ) parser.add_argument( diff --git a/home/shell/git.sh b/home/shell/git.sh index 03c1564..c431a24 100644 --- a/home/shell/git.sh +++ b/home/shell/git.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # 🌟 Custom Git Automation & Helper Utilities # Sourced in .bashrc to streamline gitignore modifications, commit-push workflows, and new repo setups. @@ -10,7 +11,8 @@ gitignore() { fi # Find the top-level repository directory path - local GIT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null) + local GIT_ROOT + GIT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null) if [ -z "$GIT_ROOT" ]; then echo "Error: Not a Git repository." return 1 @@ -63,7 +65,8 @@ gacp() { fi git add -A git commit -m "$1" - local branch_name=$(git branch --show-current) + local branch_name + branch_name=$(git branch --show-current) git push origin "${branch_name}" echo "Pushed to origin/${branch_name}" } diff --git a/home/shell/interactive.sh b/home/shell/interactive.sh index 2949d4d..411fcfd 100644 --- a/home/shell/interactive.sh +++ b/home/shell/interactive.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # --- Word Deletion & Readline Keybindings --- if [[ -n "$BASH_VERSION" ]] && [[ "$-" == *i* ]]; then # Ctrl+W: Delete entire word under cursor (backward-word + kill-word) diff --git a/home/shell/jump.sh b/home/shell/jump.sh index cdd92c9..0641680 100644 --- a/home/shell/jump.sh +++ b/home/shell/jump.sh @@ -1,13 +1,15 @@ +# shellcheck shell=bash # πŸ—ΊοΈ Fuzzy Navigation & Directory Jump Helpers # Sourced in .bashrc to provide quick, interactive folder traversal using Yazi and fzf. # 1. fm: Interactive file manager wrapper using Yazi. # Synchronizes the active terminal shell working directory to Yazi's exit folder (sticky directory). fm() { - local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" + local tmp + tmp="$(mktemp -t "yazi-cwd.XXXXXX")" yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then - cd -- "$cwd" + cd -- "$cwd" || return fi rm -f -- "$tmp" } diff --git a/home/shell/pdf.sh b/home/shell/pdf.sh index 53c4a00..eb34399 100644 --- a/home/shell/pdf.sh +++ b/home/shell/pdf.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # πŸ“„ Command Line PDF Utilities # Sourced in .bashrc to provide quick file operations on PDF documents. @@ -30,7 +31,7 @@ pdf_dc() { # Handle file overwrite prompts if [[ -f "$output_file" ]]; then echo "Error: Output file '$output_file' already exists." - read -p "Do you want to overwrite it? (y/n): " overwrite + read -r -p "Do you want to overwrite it? (y/n): " overwrite if [[ "$overwrite" != "y" ]]; then echo "Operation cancelled." return 1 diff --git a/home/shell/quicklinks.sh b/home/shell/quicklinks.sh index c0a3719..a386d1b 100644 --- a/home/shell/quicklinks.sh +++ b/home/shell/quicklinks.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # πŸš€ Quicklinks Launcher Utility # Sourced in .bashrc to provide an interactive bookmarks and command-launcher interface. # Parses a pipe-separated config file (`~/.quicklinks`) containing custom CLI commands or URLs. diff --git a/home/shell/todo.sh b/home/shell/todo.sh index 705bbbb..c14fec0 100644 --- a/home/shell/todo.sh +++ b/home/shell/todo.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # πŸ“ Todo.txt & Tuxedo Productivity Helper and Syntax Highlighter # Sourced in .bashrc to provide colorized listings and quick task management shortcuts. @@ -58,7 +59,7 @@ todo() { local task_id task_id=$(echo "$top_task" | awk '{print $1}') echo "Completing: $top_task" - tuxedo do "$task_id" + tuxedo "do" "$task_id" else echo "No tasks found in todo.txt" fi diff --git a/home/shell/wayland.sh b/home/shell/wayland.sh index a31c64f..6bda1da 100644 --- a/home/shell/wayland.sh +++ b/home/shell/wayland.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # πŸ“‹ Custom Wayland Desktop Utilities # Sourced in .bashrc to provide command-line utilities optimized for Wayland compositor environments.