- Do: Run the existing Make targets for linting (
make test-shellcheck,make test-echint) before proposing changes; install their dependencies first so they succeed. - Do: Keep edits focused on the touched logic inside
chkdm; mirror surrounding indentation and quoting instead of reformatting large blocks. - Do: Validate changes with a real domain only when you need runtime verification and the environment allows outbound DNS traffic.
- Don't: Introduce new dependencies, rename
chkdm, or change install paths without prior confirmation because downstream scripts and CI expect the current layout. - Don't: Commit generated marker files (
.shellcheck.test-marker,.echint.test-marker) or other runtime artifacts.
chkdomain is a single-file Bash utility that probes well-known DNS resolvers and prints intelligence links for a domain.
- chkdm: Primary Bash script executed by users and tests; optional
CustomDNS.txtlives alongside it when present. - Makefile: Provides install (
sudo make install), uninstall, and lint targets with marker files to skip repeated runs. - README.md: Source of user-facing instructions, DNS resolver lists, and dependency overview.
- .editorconfig: Enforces UTF-8, trailing newline, and two-space indentation for
chkdm, Markdown, and YAML files. - .travis.yml: Canonical CI definition covering shellcheck, echint, and runtime smoke tests on Linux and macOS.
- .github/FUNDING.yml, LICENSE, chkdomain.png, .gitignore: Ancillary funding metadata, licensing, screenshot asset, and ignored marker files.
Run commands from the repository root; the Makefile is the single source of truth.
- Prerequisites: Install
shellcheck(e.g.,apt-get install shellcheck) andechint(npm install -g echint). If a dependency is missing, the correspondingmaketarget will fail (for example,make test-shellcheckexits withshellcheck: Command not found). - Static lint:
make test-shellcheckrunsshellcheck chkdm; remove.shellcheck.test-markerif you need to rerun after a successful pass. - EditorConfig lint:
make test-echintexecutesechint chkdm; delete.echint.test-markerto force a fresh run. - All lint:
make testchains the two targets and printsTests passedon success. - Manual runtime check:
./chkdm example.comexercises the script against live DNS resolvers; createCustomDNS.txtor setCustomDNSFile=/pathwhen testing custom resolver lists. - Install/uninstall:
sudo make installcopieschkdminto/usr/local/bin;sudo make uninstallremoves it, mirroring the CI install tests.
- Language: Bash 4+ script with
function name()declarations and lowercase function names; keep helper names (echo.Red,checkNofilterDNS) consistent. - Indentation: Spaces only;
.editorconfigspecifies two-space indents forchkdm, Markdown, and YAML, but preserve nearby depth (two spaces for simple statements, four for nested blocks). - Quoting and tests: Follow the existing preference for double quotes around variables,
[[ ... ]]conditionals, andcasestatements for result classification. - Data structures: Maintain associative array literals for DNS resolvers with the same key casing and spacing; new resolvers should be grouped with peers and keep human-readable names.
- Comments: Use
#comments with sentence case descriptions, matching the header block and inline notes already inchkdm.
- Static linting: Always rerun
make test-shellcheckandmake test-echint(ormake test) after modifyingchkdmonce the required tools are installed. - Targeted lint: For quick checks, you can run
shellcheck chkdmorechint chkdmdirectly; these mirror the Make targets. - Runtime verification: Validate behavior with
./chkdm <domain>when altering query logic, domain validation, or DNS lists. Be aware that it issues real DNS queries and may require external network access. - Custom DNS paths: When changing the custom DNS handling, reuse
CustomDNS.txtin the repo root or pointCustomDNSFileat a test file to cover those branches.
- Commit style: Follow the existing imperative, capitalized subject format with a blank line before the body (e.g.,
Add Bash version check for better compatibility and error handling). Wrap body lines at 72 characters and explain the what/why. - Scope: Keep each commit focused on a single concern; avoid combining feature work with formatting or cleanup.
- Verification: Include a short note about the lint or runtime commands you ran; ensure all relevant Make targets pass before opening a PR.
- Pull requests: Reference related issues when applicable and note any runtime testing or environment constraints (especially when DNS access was unavailable).
- Allowed without approval: Read/list files, edit
chkdmor documentation with minimal diffs, and run the lint targets after ensuring prerequisites are installed. - Ask before proceeding: Adding dependencies, altering CI (
.travis.yml), modifying install paths, or running privileged commands beyond the documentedsudo make install/sudo make uninstallflow. - Never do: Remove production assets, mass-rename files, or commit local artifacts/credentials. Avoid speculative bulk refactors; discuss larger structural ideas first.
- Operational caution: Runtime tests send live DNS queries; confirm the environment permits it and avoid hammering resolvers unnecessarily.