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

Add vscode settings to devcontainer that avoid common ansible-lint errors #323

Open
jeffcpullen opened this issue Nov 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jeffcpullen
Copy link

ISSUE TYPE
  • Feature Idea
SUMMARY

The sample devcontainer files should include the common file settings to mitigate common linting issues with whitespace and newlines. This minimizes the frustration of failed pipelines due to whitespace formatting errors. If a user/organization doesn't want this, its a simple process just to comment out or delete these lines.

The proposed configuration additions are:

  • "files.insertFinalNewline": true
  • "files.trimFinalNewlines": true
  • "files.trimTrailingWhitespace": true

Example devcontainer.json file with these configurations:

{
  "name": "ansible-dev-container-podman",
  "image": "ghcr.io/ansible/community-ansible-dev-tools:latest",
  "containerUser": "root",
  "runArgs": [
    "--cap-add=SYS_ADMIN",
    "--cap-add=SYS_RESOURCE",
    // The following line stops the ansible-config mknod /dev/null errors
    "--cap-add=CAP_MKNOD",
    "--device",
    "/dev/fuse",
    "--security-opt",
    "seccomp=unconfined",
    "--security-opt",
    "label=disable",
    "--security-opt",
    "apparmor=unconfined",
    "--userns=host",
    "--hostname=ansible-dev-container",
    "--volume",
    "ansible-dev-tools-container-storage:/var/lib/containers"
  ],
  "customizations": {
    "vscode": {
      "extensions": ["redhat.ansible", "redhat.vscode-redhat-account"],
      "settings": {
        "files.insertFinalNewline": true,
        "files.trimFinalNewlines": true,
        "files.trimTrailingWhitespace": true
      }
    }
  }
}

It would be nice to include the same sort of config in the devfile, but the process isn't as clear.

@jeffcpullen jeffcpullen added enhancement New feature or request new New issues and PRs to triaged labels Nov 11, 2024
@audgirka audgirka removed the new New issues and PRs to triaged label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants