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

chore(linters): Introduce hadolint config file and reorder linters #832

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MaxymVlasov
Copy link
Collaborator

@MaxymVlasov MaxymVlasov commented Mar 3, 2025

Split from #831

Hadolint supports its own config file, and that make able 3rd-party tools that utilize hadolint also known about specified config options, not pre-commit only

Copy link

coderabbitai bot commented Mar 3, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Introduced a new configuration to customize linting behavior by excluding select checks, optimizing validation efficiency.
    • Streamlined development hooks to improve consistency in linting and formatting processes, including enhanced support for shell script quality.

Walkthrough

This pull request introduces a new configuration file, .hadolint.yaml, which specifies several Dockerfile linting rules to ignore. In addition, the .pre-commit-config.yaml file has been updated to reorganize linting hooks. The updates include reintroducing the hadolint linter without its previous ignore arguments, streamlining the YAML linter section, cleaning up the JSON5 linter section, and making adjustments (additions and removals) to repository configurations for shfmt and shellcheck.

Changes

File Change Summary
.hadolint.yaml Added new configuration file listing ignored Dockerfile linting rules: DL3007, DL3013, DL3027, DL3059, DL4006, SC1091, SC2015, SC3037.
.pre-commit-config.yaml Reorganized linting hooks: hadolint is reintroduced without previous ignore arguments; YAML linter section streamlined; JSON5 section cleaned; repository adjustments (added and removed entries) for shfmt and shellcheck.

Suggested reviewers

  • yermulnik

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c949dd2 and 96af868.

📒 Files selected for processing (2)
  • .hadolint.yaml (1 hunks)
  • .pre-commit-config.yaml (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .hadolint.yaml
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: 🧪 Tests / pytest@🐍3.9@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.13@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.12@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.11@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.11@macos-14
  • GitHub Check: 🧪 Tests / pytest@🐍3.11@macos-13
  • GitHub Check: 🧪 Tests / pytest@🐍3.10@windows-2025
  • GitHub Check: 🧹 Linters / pre-commit@🐍3.13@ubuntu-latest
  • GitHub Check: 🧪 Tests / pytest@🐍3.10@macos-13
  • GitHub Check: 🧪 Tests / pytest@🐍3.10@macos-14
  • GitHub Check: pre-commit
🔇 Additional comments (4)
.pre-commit-config.yaml (4)

50-55: Updated Hadolint Integration in Dockerfile Section
The new Dockerfile section correctly introduces the hadolint hook from the repository https://github.com/hadolint/hadolint at revision v2.12.1-beta. This change aligns with the PR objective of reintroducing hadolint without its previous ignore arguments. Please verify that using a beta release is intentional and acceptable for your project's stability requirements.


56-67: Streamlined YAML Linter Configuration
This section now exclusively configures the yamlfmt hook with its respective arguments, which simplifies the YAML linting setup. Ensure that the removal of any previous hadolint-related configurations in this section is deliberate and that all formatting requirements are still met.


78-85: Refined JSON5 Formatter Setup
The JSON5 section now solely employs the prettier hook to handle .json5 files. This cleanup meets the PR’s intent to streamline the linter configuration for JSON5. Please double-check that the current configuration (e.g., regex targeting .json5$) fully covers your JSON5 files and formatting expectations.


86-99: Updated Bash Linter Configuration
The Bash section now features both shfmt and shellcheck hooks sourced from the jumanjihouse/pre-commit-hooks repository, with explicit arguments provided for shfmt (such as -l, -i '2', -ci, -sr, and -w). This update reorders and refines the Bash linting tools as outlined in the PR objectives. Confirm that these argument choices align with your team's coding standards.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Comment on lines +6 to +9
- DL4006 # Not related to alpine
- SC1091 # Useless check
- SC2015 # Useless check
- SC3037 # Not related to alpine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh such comments require reader to google what the check is about. would be great to have a more clear comments (either the brief description of the check, or a more clear rationale to ignore it globally).
I think it's also best to use inline exclusions per each Dockefile rather than exclude checks globally.

#
# Dockerfile
- repo: https://github.com/hadolint/hadolint
rev: v2.12.1-beta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing some gist of this, but using beta...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants