Skip to content

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

@jeffcpullen

Description

@jeffcpullen
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions